Side navigation
#8751 closed bug (duplicate)
Opened April 02, 2011 10:49AM UTC
Closed April 02, 2011 04:14PM UTC
Last modified April 02, 2011 04:14PM UTC
Selector for [type=foo] does not work in IE7 and lower
Reported by: | alexg | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | attributes | Version: | 1.5.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi all, I'm a total noob at hacking jquery but while developing a webpage came accross this problem. In IE <=7 selectors such as $('input[type=checkbox]') don't work because of a known bug where element.getAttribute('type') returns a boolean. This is a big problem because some frameworks rely on these selectors.
I think I found a fix to this, which is to change the line 3671 in jquery-1.5.2 from:
return elem.getAttribute( "type" );
to
return elem.getAttributeNode( "type" ).nodeValue;
The non-shorthand version is one function call slower but works in all browsers.
I'd like someone more experienced with jquery to review this and patch the code if appropriate.
Thanks
This will be address in 1.6 attrHooks feature
Also, heads up: http://api.jquery.com/attribute-equals-selector/
attribute selectors requre quotes around the attribute value