Skip to content

Commit

Permalink
Only generate an attribute prefix if required
Browse files Browse the repository at this point in the history
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 #29
  • Loading branch information
bwrrp committed Jul 13, 2017
1 parent 9be30e8 commit eae9f35
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1358,19 +1358,21 @@ <h2>Extensibility</h2>
"<code>xmlns</code>".
</ol>

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

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

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

<li>The value of <var>candidate prefix</var>;
<li>The value of <var>new prefix</var>;

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

Expand Down

0 comments on commit eae9f35

Please sign in to comment.