Ticket #2939 (closed bug: fixed)
Selectors using style attribute broken
| Reported by: | remysharp | Owned by: | flesler |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3 |
| Component: | selector | Version: | 1.2.5 |
| Keywords: | selector style | Cc: | |
| Blocking: | Blocked by: |
Description
Demonstrations:
http://remysharp.com/demo/selector-issue.html
Using the style attribute in the selector either returns the wrong number of results or throws exception.
Tested in FF2 and Safari (test above makes use of console.log).
Example selectors broken:
$(div[style]); returns total number of elements regardless of result
$(div[style="color"]); throws exception
Change History
comment:2 Changed 5 years ago by flesler
- Owner set to flesler
- Status changed from new to assigned
Will try to check this asap.
comment:3 Changed 5 years ago by flesler
- Component changed from core to selector
Could you recheck with 1.2.6 ?
comment:4 Changed 5 years ago by remysharp
Sorry, I thought I sent this check back - no it doesn't work with latest 1.2.6:
comment:5 Changed 5 years ago by flesler
- need changed from Review to Commit
- Status changed from assigned to closed
- Resolution set to fixed
comment:6 Changed 2 years ago by sandy
Can you check in version 1.6.2. It does seem to work in this version.
comment:7 Changed 2 years ago by sandy
oops! sorry what i meant was It doesn't seem to work in this version.
comment:8 Changed 2 years ago by rwaldron
@sandy can you provide a complete reduced test case on jsFiddle to help us assess your ticket!
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

I think I've found a/the fix, but I've only been able to test on a Mac so far, Opera 9*, Safari 3, FF2 - not IE testing as yet, all browsers give the right result.
File: src/selector.js rev: 5696
Change line 339 from (note intentional spaces in OR to prevent formatting):
if ( z == null | | /href|src|selected/.test(m[2]) )
To:
if ( z == null | | /style|href|src|selected/.test(m[2]) )
Diff: http://codedumper.com/ocopo#9-10 (I couldn't paste the diff properly)