Skip to content

Commit d6d4573

Browse files
committed
Only generate an attribute prefix if required
If implemented as specified, the prefix set for an attribute in the DOM would never be preserved during serialization. This change only generates the new prefix if the prefix is either missing (which is not allowed for namespaced attributes), or if it conflicts with another local namespace definition of the prefix for a different namespace. Fixes w3c#29
1 parent 9be30e8 commit d6d4573

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

index.html

+7-5
Original file line numberDiff line numberDiff line change
@@ -1358,19 +1358,21 @@ <h2>Extensibility</h2>
13581358
"<code>xmlns</code>".
13591359
</ol>
13601360

1361-
<li>Otherwise, the <var>attribute namespace</var> in not the <a>XMLNS namespace</a>. Run
1362-
these steps:
1361+
<li>Otherwise, the <var>attribute namespace</var> is not the <a>XMLNS namespace</a>. If
1362+
<var>candidate prefix</var> is null, run these steps:
13631363
<ol>
1364-
<li>Let <var>candidate prefix</var> be the result of <a>generating a prefix</a> providing
1365-
<var>map</var>, <var>attribute namespace</var>, and <var>prefix index</var> as input.
1364+
<li>Let <var>new prefix</var> be <var>attr</var>'s <code><a>prefix</a></code> attribute if it is
1365+
not <code>null</code> and the <var>local prefixes map</var> does not contain a key matching
1366+
<var>attr</var>'s <code><a>prefix</a></code>, or the result of <a>generating a prefix</a> providing
1367+
<var>map</var>, <var>attribute namespace</var>, and <var>prefix index</var> as input otherwise.
13661368

13671369
<li>Append the following to <var>result</var>, in the order listed:
13681370
<ol>
13691371
<li>"<code> </code>" (U+0020 SPACE);
13701372

13711373
<li>The string "<code>xmlns:</code>";
13721374

1373-
<li>The value of <var>candidate prefix</var>;
1375+
<li>The value of <var>new prefix</var>;
13741376

13751377
<li>"<code>="</code>" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
13761378

0 commit comments

Comments
 (0)