When getting the element associated with an id using IDTargetObserver, ids with a spaces character are ignored

RESOLVED INVALID

Status

()

Core
DOM: Core & HTML
RESOLVED INVALID
7 years ago
7 years ago

People

(Reporter: mounir, Unassigned)

Tracking

({testcase})

Trunk
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
Created attachment 482514 [details]
testcase

This is not consistent with .getElementById() which accept spaces in ids even if that's invalid. As a consequence, .form and .list doesn't have the same behavior (see test case).
(Reporter)

Comment 1

7 years ago
The testcase only works with a nightly build.
Uh... there should be no such restriction.  Can you point me to the relevant .form and .list code?
And in particular, getElementById and IDTargetObservers use the same exact hashtable...
(Reporter)

Comment 4

7 years ago
(In reply to comment #2)
> Uh... there should be no such restriction.  Can you point me to the relevant
> .form and .list code?

GetList:
http://mxr.mozilla.org/mozilla-central/source/content/html/content/src/nsHTMLInputElement.cpp#1110

GetForm:
It's harder because it's returning mForm which is set in different ways, the observer is added like that:
http://mxr.mozilla.org/mozilla-central/source/content/html/content/src/nsGenericHTMLElement.cpp#2796

AFAIK, there is nothing checking for space characters in the id in those code so I'm assuming the difference comes from the different way we use to get the elements associated with the ids.
(Reporter)

Comment 5

7 years ago
Sorry, my testcase was stupid so do I :(
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.