Skip to main content

Bug Tracker

Side navigation

#7874 closed bug (duplicate)

Opened December 30, 2010 03:56PM UTC

Closed December 31, 2010 06:15PM UTC

Last modified March 13, 2012 02:48PM UTC

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:
Description

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

Tested in IE7 Browser Mode in IE8 on Windows XP SP3

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

        $('input').filter(function(){
            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
    </script>
Attachments (0)
Change History (4)

Changed December 30, 2010 05:13PM UTC by danheberden comment:1

_comment0: 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 \ \ 1293730581623590

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.

Changed December 31, 2010 02:09AM UTC by miketaylr comment:2

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:

http://miketaylr.com/test/qunit/html5booleans_deep.html

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.

Changed December 31, 2010 06:15PM UTC by snover comment:3

resolution: → duplicate
status: newclosed

Changed December 31, 2010 06:15PM UTC by snover comment:4

Duplicate of #5637.