Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

querySelector requires escaped ids to be compatible with HTML5 #47

Open
menismu opened this issue Apr 4, 2018 · 0 comments
Open

querySelector requires escaped ids to be compatible with HTML5 #47

menismu opened this issue Apr 4, 2018 · 0 comments

Comments

@menismu
Copy link
Owner

menismu commented Apr 4, 2018

Issue reported: mozilla#444
Reported by: @chadananda

querySelectorAll is being called with a raw id value. This will not work with HTML5 style ids which are not CSS compatible.

For example, simply using a simple numeric id (id='1') results in the error:

Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '#1 ' is not a valid selector.

An official css.escape() method is in the works
http://dev.w3.org/csswg/cssom/#the-css.escape%28%29-method

Meanwhile, Mathias Bynens has provided a polyfill:
https://github.com/mathiasbynens/CSS.escape

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant