[svgwg] Add restrictions / warnings about invalid `id` values

AmeliaBR has just created a new issue for 
https://github.com/w3c/svgwg:

== Add restrictions / warnings about invalid `id` values ==
Currently [the section on the `id` 
attribute](https://svgwg.org/svg2-draft/struct.html#Core.attrib) 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 `id`s are 
not unique, things don't work correctly.

- Even [the HTML spec 
requires](https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute)
 "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.

Please view or discuss this issue at 
https://github.com/w3c/svgwg/issues/213 using your GitHub account

Received on Wednesday, 20 July 2016 19:05:29 UTC