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

Add restrictions / warnings about invalid id values #213

Closed
AmeliaBR opened this issue Jul 20, 2016 · 1 comment
Closed

Add restrictions / warnings about invalid id values #213

AmeliaBR opened this issue Jul 20, 2016 · 1 comment

Comments

@AmeliaBR
Copy link
Contributor

Currently the section on the id attribute says:

Must reflect the element's ID [DOM4]. The ‘id’ attribute must be any value other than the empty string.

Some problems with that:

  • Lots of uses of id (target fragments, ARIA ID REF values) at least assume that each id is a single token. If you have an id with whitespace, it becomes pretty much useless. Similarly, if ids are not unique, things don't work correctly.
  • Even the HTML spec requires "When specified on HTML elements, the id attribute value must be unique amongst all the IDs in the element's tree and must contain at least one character. The value must not contain any space characters."
  • If the SVG is in an XML document (including a stand-alone SVG), XML validity puts many additional requirements on id. Exactly which requirements depends on whether it's XML 1.0 (default) or 1.1 (specified by a processing instruction at the top of the file).

Since SVG elements can be inside HTML documents, I'm okay with making any valid HTML id a valid SVG id. But that's still more restrictive then what we currently have, and we should definitely add a warning that not all id values that meet that requirement will be valid in an XML document.

@AmeliaBR
Copy link
Contributor Author

Closed by 09a1a0a

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

2 participants