Ticket #7897 (closed bug: invalid)
Descendant id selector bug in IE when running in IE7 mode
| Reported by: | riaanl@… | Owned by: | riaanl@… |
|---|---|---|---|
| Priority: | undecided | Milestone: | |
| Component: | unfiled | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Descendant id selector does not work in IE when running in IE7 mode ( http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx).
In the example @ http://jsfiddle.net/riaanl/TGwGW/, the selector ('#uiContainerX #txtName') to find the first input #txtName in #uiContainerX works; But when trying to access the other input #txtName with selector '#uiContainerX #txtName' does not work and returns an unexpected object.
Expected Result:
$('#uiContainerX #txtName').attr('id') >> txtName
$('#uiContainerY #txtName').attr('id') >> txtName
$('#uiContainerY [id=txtName]').attr('id') >> txtName
$('#txtName', '#uiContainerY').attr('id') >> txtName
The result in ie with IE7 mode ON:
$('#uiContainerX #txtName').attr('id') >> txtName
$('#uiContainerY #txtName').attr('id') >> undefined
$('#uiContainerY [id=txtName]').attr('id') >> txtName
$('#txtName', '#uiContainerY').attr('id') >> txtName
Change History
comment:2 Changed 2 years ago by jitter
- Owner set to riaanl@…
- Status changed from new to pending
- Milestone 1.6 deleted
Thanks for taking the time to contribute to the jQuery project by writing a bug report. Your test case contains invalid html as there are two elements with the same id "txtName" which isn't allowed ( http://www.w3.org/TR/html5/elements.html#the-id-attribute)
Please report back if you can provide a test case with valid html which still reproduces the error described.
comment:3 Changed 2 years ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

to replicate the issue, one must add
to the head section of the page.