Skip to main content

Bug Tracker

Side navigation

#9618 closed bug (wontfix)

Opened June 19, 2011 11:31PM UTC

Closed June 20, 2011 01:45AM UTC

Last modified June 20, 2011 09:10AM UTC

invalid attribute selector works in IE9 when it should fail

Reported by: WanderingZombie Owned by:
Priority: low Milestone: 1.next
Component: selector Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description
<html>
<body>
<div id="stoprId_1"></div>
<div id="stoprId_2"></div>
<div id="stoprId_3"></div>
</body>
</html>

$(document).ready(function(){
alert($('[id^="stoprId_"').length +"-"+
$('[id^="stoprId_"]').length);
});

will show 3-3 in IE9 and 0-3 in Firefox. jQuery is not behaving in a consistent manner

See http://jsfiddle.net/WanderingZombie/vMNau/

Attachments (0)
Change History (2)

Changed June 20, 2011 01:45AM UTC by dmethvin comment:1

component: unfiledselector
priority: undecidedlow
resolution: → wontfix
status: newclosed

This was reported before, although I can't find the ticket. IE9 is trying to be helpful I suppose and auto-adds a closing bracket when it should be throwing an error.

Since the selector in question isn't valid, and since we're passing it to querySelectorAll for processing, I don't think it's productive to try and address this in jQuery merely to get an error thrown. You could file a report against IE to get the bug fixed, but that's most likely futile.

Changed June 20, 2011 09:10AM UTC by WanderingZombie comment:2

Replying to [comment:1 dmethvin]:

This was reported before, although I can't find the ticket. IE9 is trying to be helpful I suppose and auto-adds a closing bracket when it should be throwing an error.

Yes, but jQuery should surely have checked that the selector syntax was correct before attempting to process it and at that point returned the same consistent value regardless of browser.

Since the selector in question isn't valid, and since we're passing it to querySelectorAll for processing, I don't think it's productive to try and address this in jQuery merely to get an error thrown. You could file a report against IE to get the bug fixed, but that's most likely futile.

If jQuery behaved consistently across all browsers I could be persuaded to agree, however the invalid syntax does not conform to documented jQuery syntax and should thefore result in a jQuery error of some sort. Not doing so means that jQuery cannot be trusted to work reliably cross browser which after all is THE major benefit of using jQuery!