Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#7874 closed bug (duplicate)

IE7 attribute selector bug

Reported by: musicisair Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:


Test Case: http://jsfiddle.net/A89A6/1/

Tested in IE7 Browser Mode in IE8 on Windows XP SP3

    <input autofocus>
        $('input[autofocus]').length // returns 0

            var attr = $(this).attr("autofocus");
            // I'm not sure about the spec for autofocus. This probably isn't totally correct
            return attr != null && attr != false;
        }).length // returns 1

Change History (4)

comment:1 Changed 12 years ago by danheberden

A wee bit more detail: http://jsfiddle.net/danheberden/r9XSe/ - and also, #7128

IE6 and IE7 report 1 and 4, whilst the rest, 3 and 4

If you have <input name /> and input <input />, other browsers will have an entry in the attributes array for name, that is one of the array values will be that of name.

In ie6/7, however, the name key of the attribute object ( instead of just an array value ) has the same name value whether present or not ("") unless actually assigned a value. The only identifier there, is, if node.attributes[ whateverAttr ].specifi == true or not.

Last edited 12 years ago by danheberden (previous) (diff)

comment:2 Changed 12 years ago by miketaylr

Yeah, jQuery/Sizzle sorta bites the dust here. There are ways to get around it however. I wrote this test page sometime a year ago when I was looking into this myself:


I don't have any IE's handy, but--IIRC--I think input[foo=] will make it work. Please double check, I'm just going off memory.

comment:3 Changed 12 years ago by snover

Resolution: duplicate
Status: newclosed

comment:4 Changed 12 years ago by snover

Duplicate of #5637.

Note: See TracTickets for help on using tickets.