Skip to content

Commit 841fcfd

Browse files
committed
Remove more XML-derived attribute name validation
* Change the behavior of the dataset named setter. * Change the conformance-related definitions for custom data attributes and custom element attributes. Closes #11439.
1 parent 5589e0c commit 841fcfd

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

source

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,10 +1744,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
17441744
type <code>button</code>, meaning they have the local name "<code data-x="">button</code>" and
17451745
(implicitly as defined above) the <span>HTML namespace</span>.</p>
17461746

1747-
<p>Attribute names are said to be <dfn>XML-compatible</dfn> if they match the <code
1748-
data-x="xml-Name">Name</code> production defined in XML and they contain no U+003A COLON
1749-
characters (:). <ref>XML</ref></p>
1750-
17511747

17521748
<h4>DOM trees</h4>
17531749

@@ -3345,6 +3341,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
33453341
<li><dfn data-x-href="https://dom.spec.whatwg.org/#abortcontroller-signal-abort">signal abort</dfn></li>
33463342
<li><dfn data-x="AbortSignal-add" data-x-href="https://dom.spec.whatwg.org/#abortsignal-add">add</dfn></li>
33473343
<li>The <dfn data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name">get an attribute by name</dfn> algorithm</li>
3344+
<li><dfn data-x-href="https://dom.spec.whatwg.org/#valid-attribute-local-name">valid attribute local name</dfn></li>
33483345
<li><dfn data-x-href="https://dom.spec.whatwg.org/#valid-element-local-name">valid element local name</dfn></li>
33493346
</ul>
33503347

@@ -14242,8 +14239,8 @@ background: transparent">blue&lt;/span>.&lt;/p></code></pre>
1424214239

1424314240
<p>A <dfn>custom data attribute</dfn> is an attribute in no namespace whose name starts with the
1424414241
string "<dfn><code data-x="attr-data-*">data-</code></dfn>", has at least one character after the
14245-
hyphen, is <span>XML-compatible</span>, and contains no <span data-x="ASCII upper alpha">ASCII
14246-
upper alphas</span>.</p>
14242+
hyphen, is a <span>valid attribute local name</span>, and contains no <span
14243+
data-x="ASCII upper alpha">ASCII upper alphas</span>.</p>
1424714244

1424814245
<p class="note">All attribute names on <span>HTML elements</span> in <span>HTML documents</span>
1424914246
get ASCII-lowercased automatically, so the restriction on ASCII uppercase letters doesn't affect
@@ -14429,8 +14426,8 @@ interface <dfn interface>DOMStringMap</dfn> {
1442914426

1443014427
<li><p>Insert the string <code data-x="">data-</code> at the front of <var>name</var>.</p></li>
1443114428

14432-
<li><p>If <var>name</var> does not match the XML <code data-x="xml-Name">Name</code> production,
14433-
throw an <span>"<code>InvalidCharacterError</code>"</span> <code>DOMException</code>.</p></li>
14429+
<li><p>If <var>name</var> is not a <span>valid attribute local name</span>, then throw an
14430+
<span>"<code>InvalidCharacterError</code>"</span> <code>DOMException</code>.</p></li>
1443414431

1443514432
<li><p><span data-x="concept-element-attributes-set-value">Set an attribute value</span> for the
1443614433
<code>DOMStringMap</code>'s <span data-x="concept-DOMStringMap-element">associated element</span>
@@ -73326,10 +73323,10 @@ document.body.append(parent);
7332673323

7332773324
<p>Any namespace-less attribute that is relevant to the element's functioning, as determined by
7332873325
the element's author, may be specified on an <span>autonomous custom element</span>, so long as
73329-
the attribute name is <span>XML-compatible</span> and contains no <span data-x="ASCII upper
73330-
alpha">ASCII upper alphas</span>. The exception is the <code data-x="attr-is">is</code> attribute,
73331-
which must not be specified on an <span>autonomous custom element</span> (and which will have no
73332-
effect if it is).</p>
73326+
the attribute name is a <span>valid attribute local name</span> and contains no <span
73327+
data-x="ASCII upper alpha">ASCII upper alphas</span>. The exception is the <code
73328+
data-x="attr-is">is</code> attribute, which must not be specified on an <span>autonomous custom
73329+
element</span> (and which will have no effect if it is).</p>
7333373330

7333473331
<p><span data-x="customized built-in element">Customized built-in elements</span> follow the
7333573332
normal requirements for attributes, based on the elements they extend. To add custom

0 commit comments

Comments
 (0)