Side navigation
#12893 closed bug (notabug)
Opened November 14, 2012 12:43PM UTC
Closed November 14, 2012 12:59PM UTC
Last modified November 14, 2012 04:19PM UTC
.find using an id selector only returns one element
Reported by: | finbar.murphy@ag-itechnology.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Using a '#id' selector in a .find only returns the first element, in 1.7 it return all matching.
I know that it's not much of an identifier if there is more then one but !
Attachments (0)
Change History (4)
Changed November 14, 2012 12:59PM UTC by comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
Changed November 14, 2012 03:22PM UTC by comment:2
Well, it's not invalid to have the same ID value used multiple times in a document (unfortunately this is by spec), but we don't support it because then we can't use shortcut methods like getElementById
when parsing the selector. Just don't do it.
Side note: Dave is right when he says the id cannot start with digits. It must be a valid javascript identifier.
Changed November 14, 2012 03:46PM UTC by comment:3
From the spec:
The value must be unique amongst all the IDs in the element's home subtree and must contain at least one character.
Changed November 14, 2012 04:19PM UTC by comment:4
Yea I take that back. Could have sworn the spec said the opposite. Oh well.
A document with multiple elements having the same ID value is invalid. This example takes it a step further and uses only digits for the ID value, which is invalid as well. If you're not sure what this means, please ask for help on the forum or StackOverflow.