Closed
Bug 507243
Opened 15 years ago
Closed 14 years ago
document.querySelector() and querySelectorAll() failing
Categories
(Firefox :: General, defect)
Firefox
General
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: willy.schott, Unassigned)
Details
(Whiteboard: [CLOSEME 2011-1-1])
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729) Trying to select DOM nodes containing a period character in the id attribute fails. According to http://www.w3.org/TR/html401/types.html#h-6.2 the period is valid in ID and NAME attributes, so Firefox should return the matching nodes. Reproducible: Always Steps to Reproduce: 1. Create a valid HTML document containing a node like this: <div id="part1.part2"></div> 2. Open the document in Firefox 3.5.1 3. Open a JavaScript console (for example Firebug) and execute: console.log(document.querySelector('#part1.part2'); Actual Results: null Expected Results: <div id="part1.part2"> It might be problematic to distinct between <div id="part1.part2"> and <div id="part1" class="part2">, but both elements are matching the expression '#part1.part2', and therefore both should be returned in case of doubt, so the application gets the chance to decide.
Comment 1•15 years ago
|
||
Presumably you have to escape it (as in \. ) because . is used for class selectors.
Reporter | ||
Comment 2•15 years ago
|
||
Does not work as expected, sorry.
Comment 3•15 years ago
|
||
I think \. just tells the JS parser to treat is a plain dot character, that is, the string of characters that the CSS selector parser sees is still #part1.part2 I think you have to use #part1\\.part2 in your example for the CSS parser to see #part1\.part2 which will match the element. Inside a <style></style> section, or in a separate CSS file, it should be sufficient with one backslash though. Please correct me if I'm wrong.
Comment 4•14 years ago
|
||
Reporter, are you still seeing this issue with Firefox 3.6.12 or later in safe mode? If not, please close. These links can help you in your testing. http://support.mozilla.com/kb/Safe+Mode http://support.mozilla.com/kb/Managing+profiles Also, please consider using the most recent Firefox 4 beta build, your bug may be resolved there.
Whiteboard: [CLOSEME 2011-1-1]
Comment 5•14 years ago
|
||
No reply, INCOMPLETE. Please retest with Firefox 3.6.13 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•