Bug Tracker

Modify

Ticket #7874 (closed bug: duplicate)

Opened 3 years ago

Last modified 2 years ago

IE7 attribute selector bug

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

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>

Change History

comment:1 Changed 3 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 3 years ago by danheberden (previous) (diff)

comment:2 Changed 3 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:

 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.

comment:3 Changed 3 years ago by snover

  • Status changed from new to closed
  • Resolution set to duplicate

comment:4 Changed 3 years ago by snover

Duplicate of #5637.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.