User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:188.8.131.52) 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 , so the element doesn't match the selector |#t|. This behavior is correct.  <http://www.w3.org/TR/css3-selectors/#id-selectors>
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 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.