Skip to content
This repository has been archived by the owner on Jun 29, 2018. It is now read-only.

querySelector requires escaped ids to be compatible with HTML5 #444

Open
chadananda opened this issue Jun 1, 2015 · 0 comments
Open

querySelector requires escaped ids to be compatible with HTML5 #444

chadananda opened this issue Jun 1, 2015 · 0 comments

Comments

@chadananda
Copy link

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant