Closed Bug 561549 Opened 14 years ago Closed 14 years ago

selector api dont work with dom creted by DomParser

Categories

(Core :: DOM: CSS Object Model, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: to.kandy, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.4) Gecko/20100413 Firefox/3.6.4 (.NET CLR 3.5.30729)
Build Identifier: 

Problem with work (querySelector|querySelectorAll|mozMatchesSelector) with id(#) and class(.) if created by DOMParser


Reproducible: Always

Steps to Reproduce:
alert((new DOMParser).parseFromString('<test><div id="t" /></test>', "text/xml")
					.documentElement
					.querySelector('div[id="t"]')
					.mozMatchesSelector('#t'))


Actual Results:  
false

Expected Results:  
true

in ff 3.6 and ff3.7
The attribute |id| you're using isn't considered to be an "ID-typed attribute" as defined in Selectors Level 3 [1], so the element doesn't match the selector |#t|. This behavior is correct.

[1] <http://www.w3.org/TR/css3-selectors/#id-selectors>
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
And specifically, your <div> node isn't HTML, since you didn't put it in the HTML namespace.  It's just an unknown element, and doesn't have any ID-type attributes associated with it.
You need to log in before you can comment on or make changes to this bug.