The alerts in following code do not show the same result in IE6 due to
a bug[1] (also discussed on stackoverflow.com[2]).

$('<input type="hidden" />').attr('name', 'foo').appendTo
(document.body);
alert(document.getElementsByName('foo').length);  // Alert shows "0"
in IE6 and "1" in other browsers


$('<input type="hidden" name="bar" />').appendTo(document.body);
alert(document.getElementsByName('bar').length);  // Alert shows "1"
in all browsers.

Working demo: http://jsbin.com/urajo

Should jQuery normalize or at least warn the user about this
discrepancy (like it does when attempting to change the 'type'
attribute on <input/> elements)?

[1]: 
http://webbugtrack.blogspot.com/2007/10/bug-235-createelement-is-broken-in-ie.html
[2]: 
http://stackoverflow.com/questions/1650797/setting-name-of-dom-created-element-fails-in-ie-workaround

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to