question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The "id" attribute is not handled according to HTML5 specification

See original GitHub issue

The ‘#’ in a selector seems to follow the HTML4 specifications, so a selector like this : #1 raises a SelectorSyntaxError.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
facelessusercommented, Jul 26, 2019

CSS syntax doesn’t support ids that start with numbers unless you use an escape. HTML spec does support numbers, and you could even use weird unicode characters. People often will use CSS friendly ids to avoid this kind of issue as well, but it isn’t invalid HTML. Same goes for classes.

0reactions
vertebarbecommented, Jul 26, 2019

Thank you for your quick response and your help, as I said I had already a workaround for websites that use these types of id, but I can see that this is not a problem in the implementation !

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are valid values for the id attribute in HTML?
For HTML5: The value must be unique amongst all the IDs in the element's home subtree and must contain at least one character....
Read more >
3.2 Elements — HTML5 - W3C
The id attribute specifies its element's unique identifier (ID) . The value must be unique amongst all the IDs in the element's home...
Read more >
id - HTML: HyperText Markup Language - MDN Web Docs
The id global attribute defines an identifier (ID) which must be unique in the whole document. Its purpose is to identify the element...
Read more >
HTML Standard
1 Introduction; 2 Common infrastructure; 3 Semantics, structure, and APIs of HTML documents; 4 The elements of HTML; 5 Microdata; 6 User interaction ......
Read more >
8.9 HTML5-Friendly Markup - Java Platform, Enterprise Edition
Here, the jsf prefix is placed on the id attribute so that the HTML5 input tag's attributes are treated as part of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found