Standup 3/27/2009: Gem repo forked?

Interesting Things

IE doesn’t allow you to change the type of an input. If you create an input with createElement, IE will not allow you to change that element to a button. This was discovered when a project’s javascript dom builder code was modified to generate inputs of type=button rather than type=submit. The cross-browser solution was to create some other temporary dom element such as a div and then set the innerHtml of that element to a type=button input, then extract that child element and return it in the builder call. Yeah!

Ask for Help

“What’s the best way to get gems for forked repos?”

There was quite a discussion on this. The specific issue is that the team is trying to use Compass (Chris Eppstein gave a talk on Compass at Pivotal on 3/18-look for the future video on our Talks Page.) For the moment, since compass depends on the edge version of sass you must first manually install sass before installing the compass gem.

One suggestion was to submit a fix for the gem. This is not a good solution in this case since the new version of sass/haml is expected to be released soon, fixing compass and simplifying its installation.

Pivotal will likely host its own internal gem server at some point to deal with issues like this.

6 Comments

Kyle says:

Github?

March 27, 2009 at 9:26 pm

Chris Eppstein says:

If it’s a rails app, I recommend that you just vendor the gem until the official release. Haml can be installed as a frozen gem or you can just check it out from github into your vendor/plugins/haml directory.

March 27, 2009 at 10:07 pm

Joseph Palermo says:

Quick correction on the IE problem.

While Input elements in IE have the problem that you can’t change the `type` attribute, they do let you set it once after you have created it.

The problem we were having was with Button elements. The spec says they should default to type `submit`, but IE defaults them to a type of `button`. IE also doesn’t let you change the `type` attribute, making it impossible to create a submit Button element in IE using createElement(‘button’).

A nicer work around for the changing type issue is to clone the input using cloneNode, change the type of the cloned input, and replace the existing input with the cloned one. No erronous elements or innerHTML required.

March 28, 2009 at 8:55 am

Chad Woolley says:

@chris – the gem had native components, so we didn’t vendor it.

The problem with building our fork on GitHub was that HAML had a non-standard package procedure which did filesystem access.

I can’t get cloneNode to work in IE. When I clone an input of type “text” or “password”, the newly created node still has the original type, and attempting to set it fails in IE.

What I typically do in this case is create an new input, and set the type to what I want, then copy over the id and className attributes, not very clean at all, so if you’ve got a way to do it with cloneNode, let me know.