Thomas Fuchs
2005-Aug-09 09:09 UTC
[Rails-spinoffs] [ANN] trunk restructuring, new util.js
Hi all, The latetest trunk revision 1983 features are more streamlined directory layout and a new util.js file, that acts as a collector for stuff that doesn''t fit in elsewhere. To get a grip at the new Builder functionality look at the test in test/unit/builder_test.html (works only with Firefox). Note the "klass" instead of "class", this circumvents a Firefox 1.0.6 bug (works in DP 1.1). Thomas
Martin Bialasinski
2005-Aug-09 12:02 UTC
[Rails-spinoffs] [ANN] trunk restructuring, new util.js
On 09/08/05, Thomas Fuchs <thomas@fesch.at> wrote:> Note the "klass" instead of "class", this circumvents a Firefox 1.0.6 > bug (works in DP 1.1).Wouldn''t it be better to use className ? la DOM? Makes it easier to use existing JS docs with this method. Bye, Martin
Thomas Fuchs
2005-Aug-09 12:26 UTC
[Rails-spinoffs] [ANN] trunk restructuring, new util.js
can do. it''s only a exception anyway. Thomas Am 09.08.2005 um 19:49 schrieb Martin Bialasinski:> On 09/08/05, Thomas Fuchs <thomas@fesch.at> wrote: > > >> Note the "klass" instead of "class", this circumvents a Firefox 1.0.6 >> bug (works in DP 1.1). >> > > Wouldn''t it be better to use className ? la DOM? Makes it easier to > use existing JS docs with this method. > > Bye, > Martin >
Rick Olson
2005-Aug-23 12:15 UTC
[Rails-spinoffs] Builder issues and a fix... was [ANN] trunk restructuring, new util.js
> >> Note the "klass" instead of "class", this circumvents a Firefox 1.0.6 > >> bug (works in DP 1.1). > >> > > > > Wouldn''t it be better to use className ? la DOM? Makes it easier to > > use existing JS docs with this method.Sorry to bring up an old thread, but I had an issue with this. IE doesn''t seem to apply the class unless you set the className property. element.setAttribute( attribute==''className'' ? ''class'' : attribute, value); becomes if(attribute == ''className'') element.className = value; else element.setAttribute(attribute, value); I had another issue when trying to set event handlers (onclick, onsubmit, etc). IE requires you to add the event handler the "right way." It would be nice if Builder would intercept those and attach the even automatically. I tried, but I ran into some weird issues. I"ll have to get a public demo up if I can reproduce it. Another attribute that IE has problems with is disabled. You need to set form_field.disabled = true || false as opposed to setAttribute(''disabled'', ''disabled''); -- rick http://techno-weenie.net
Martin Bialasinski
2005-Aug-23 16:57 UTC
[Rails-spinoffs] Builder issues and a fix... was [ANN] trunk restructuring, new util.js
On 23/08/05, Rick Olson <technoweenie@gmail.com> wrote: [ IE bugs in setAttribute() ] Not surprisingly IE messes things up... :-( I changed the code in my copy to } else if(this._isStringOrNumber(attributes[attribute])) { element[attribute] = value; } and specify the attributes in the notation the Node elements expect them. This is reliable between browsers, AFAIK. Bye, Martin
Thomas Fuchs
2005-Aug-26 14:53 UTC
[Rails-spinoffs] Builder issues and a fix... was [ANN] trunk restructuring, new util.js
I guess Builder has to be smarter here. This breaks stuff like setting the style attribute. Maybe IE can somehow be tricked into it, something like .innerHTML += "" or so, not pretty, but IE really doesn''t get it here. Thomas Am 24.08.2005 um 00:17 schrieb Martin Bialasinski:> On 23/08/05, Rick Olson <technoweenie@gmail.com> wrote: > [ IE bugs in setAttribute() ] > > Not surprisingly IE messes things up... :-( > > I changed the code in my copy to > > } else if(this._isStringOrNumber(attributes[attribute])) { > element[attribute] = value; > } > > and specify the attributes in the notation the Node elements expect > them. This is reliable between browsers, AFAIK. > > Bye, > Martin > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Martin Bialasinski
2005-Aug-30 10:33 UTC
[Rails-spinoffs] Builder issues and a fix... was [ANN] trunk restructuring, new util.js
The problem with IE and setAttribute is, that IE doesn''t treat it as "setting things like in HTML", but as "setting things like in JS". So setAttribute expects the attribute specified like the JS property and just so with the value. x.setAttribute(y,z) is just another way to write x.y = z, just a different syntax, no different semantics. Therefore, e.g. y.attribute("onclick", funcReference) is needed and not y.attribute("onclick", "code string"). Or the before mentioned y.attribute("disabled", true) This is also the reason why you need setAttribute(''className'', ...) in IE, and not setAttribute(''class'', ...) A big heap of mess... Bye, Martin
Thomas Fuchs
2005-Sep-01 15:46 UTC
[Rails-spinoffs] Builder issues and a fix... was [ANN] trunk restructuring, new util.js
I''ve made a fresh start at this and committed the results with revision 2090. The Builder now uses an .innerHTML do-it-yourself approach to build the attributes and the initial element. After doing some digging around I''ve found that this is the only way to make that work with IE6, including the "style" attribute and inline event handlers. Not so pretty, but seems to work now. I''ve removed the special "style handling" code for now, if anyone wants that in again, please submit a patch. Thomas Am 30.08.2005 um 17:31 schrieb Martin Bialasinski:> The problem with IE and setAttribute is, that IE doesn''t treat it as > "setting things like in HTML", but as "setting things like in JS". > > So setAttribute expects the attribute specified like the JS property > and just so with the value. > x.setAttribute(y,z) is just another way to write x.y = z, just a > different syntax, no different semantics. > > Therefore, e.g. y.attribute("onclick", funcReference) is needed and > not y.attribute("onclick", "code string"). Or the before mentioned > y.attribute("disabled", true) > > This is also the reason why you need setAttribute(''className'', ...) in > IE, and not setAttribute(''class'', ...) > > A big heap of mess... > > Bye, > Martin >