<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>11099</bug_id>
          
          <creation_ts>2010-10-19 22:16:01 +0000</creation_ts>
          <short_desc>clarify that &quot;element&apos;s tag name&quot; and &quot;attribute&apos;s name&quot; are qualified name</short_desc>
          <delta_ts>2011-08-04 05:15:37 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>LC1 HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#serializing-html-fragments</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>cam</cc>
    
    <cc>hsivonen</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>41589</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2010-10-19 22:16:01 +0000</bug_when>
    <thetext>Section: http://www.whatwg.org/specs/web-apps/current-work/#serializing-html-fragments

Comment:
clarify that &quot;element&apos;s tag name&quot; and &quot;attribute&apos;s name&quot; are qualified name

Posted from: 85.227.159.236</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41599</commentid>
    <comment_count>1</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2010-10-20 08:04:45 +0000</bug_when>
    <thetext>I think we shouldn&apos;t use the qualified name for xlink:href and stuff. Instead we should hard-code the xlink prefix to the serializer and emit &quot;xlink:&quot; followed by the localName for attributes in the XLink namespace.

Likewise, I think elements should serialize using the localName even if someone has managed to inject a prefix into the DOM.

Rationale on both counts: Parseability using the HTML parsing algorithm.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41617</commentid>
    <comment_count>2</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2010-10-20 21:00:26 +0000</bug_when>
    <thetext>Agreed wrt xlink namespace attributes.  (I guess it doesn&apos;t matter for xml and xmlns namespaces, since they&apos;re required to use the given prefixes anyway.)

For other elements and attributes with a prefix, I don&apos;t really have an opinion.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41663</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2010-10-22 10:30:52 +0000</bug_when>
    <thetext>Then you have to deal with the situation where the element has used the xlink prefix for something else.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41666</commentid>
    <comment_count>4</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2010-10-22 12:39:06 +0000</bug_when>
    <thetext>When serializing an HTML fragment, namespaces that aren&apos;t hard-wired to the HTML parsing algorithm will fail to round-trip anyway. Since they are going to break anyway, let&apos;s break them in the easiest way possible:
 1) If an attribute is in the XLink, XML or XMLNS namespace, prefix with xlink:, xml: or xmlns:
 2) Otherwise, always use the local name for both attributes and elements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41667</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2010-10-22 12:50:21 +0000</bug_when>
    <thetext>xmlns=&quot;...&quot; (in XMLNS namespace) would turn into xmlns:xmlns=&quot;...&quot; with your proposal, but that&apos;s easy to fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41670</commentid>
    <comment_count>6</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2010-10-22 13:27:00 +0000</bug_when>
    <thetext>Also, that does not deal with &lt;a x:test=&quot;1&quot; y:test=&quot;2&quot;&gt; where x and y are bound to the &quot;x&quot; and &quot;y&quot; namespaces.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41727</commentid>
    <comment_count>7</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2010-10-25 09:10:31 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; Also, that does not deal with &lt;a x:test=&quot;1&quot; y:test=&quot;2&quot;&gt; where x and y are bound
&gt; to the &quot;x&quot; and &quot;y&quot; namespaces.

How do you propose those be dealt with? No matter what, you get a result that won&apos;t round-trip using the HTML parser.

I can see why what I proposed may not the the proper defense in depth properties, though. (Consider x:onclick with x bound to a namespace.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41730</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2010-10-25 12:27:39 +0000</bug_when>
    <thetext>I think serializing using the qualified name and implementing SVG2&apos;s way of not needing namespaced attributes -- not sure if that is drafted yet -- is the way to go.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41797</commentid>
    <comment_count>9</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2010-10-27 23:53:51 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; I think serializing using the qualified name and implementing SVG2&apos;s way of not
&gt; needing namespaced attributes -- not sure if that is drafted yet -- is the way
&gt; to go.

Nothing like that is drafted yet.  I think we should make {http://www.w3.org/1999/xlink}href attributes be serialized as &quot;xlink:href&quot;, and worry about XLink-less href later when the SVG spec and implementations are supporting it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41806</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2010-10-28 09:27:16 +0000</bug_when>
    <thetext>As I said, that creates theoretical problems for attributes that already have the xlink prefix. When setting SVG namespaced attributes in the HTML DOM just make sure they have the right prefix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41863</commentid>
    <comment_count>11</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2010-10-30 01:04:07 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; As I said, that creates theoretical problems for attributes that already have
&gt; the xlink prefix. When setting SVG namespaced attributes in the HTML DOM just
&gt; make sure they have the right prefix.

I don&apos;t think it should be required to use the right prefix when calling setAttributeNS.  I think many people do setAttribute(&quot;http://www.w3.org/1999/xlink&quot;, &quot;href&quot;, &quot;blah&quot;).

I don&apos;t think we should care too much about attributes set using the &quot;xlink&quot; prefix but not the XLink namespace; this issue is all about choosing where to break roundtripability.  My suggestion:

  * Known attributes in the XLink, XML and XMLNS namespaces get serialized
    such that they will round trip correctly when being parsed again -- i.e.,
    they will be serialized using &quot;xlink&quot;, &quot;xml&quot; and &quot;xmlns&quot; prefixes.  (Except
    for xmlns=&quot;&quot; of course.)

  * All other attributes in a namespace get serialized just as their qualified
    name.  If this qualified name matches one of the known attribute (regardless
    of whether it was specified on the element), then don&apos;t serialize it.
    (Optional design decision: If the qualified name had no prefix, also don&apos;t
    serialize it.  If not, then run the simply allow the possibility of
    identically named attributes when serializing an element.)

That seems simpler than defining a way for the troublesome attributes to be serialized by munging their names somehow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41864</commentid>
    <comment_count>12</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2010-10-30 01:10:02 +0000</bug_when>
    <thetext>(In reply to comment #11)
&gt; I don&apos;t think it should be required to use the right prefix when calling
&gt; setAttributeNS.  I think many people do
&gt; setAttribute(&quot;http://www.w3.org/1999/xlink&quot;, &quot;href&quot;, &quot;blah&quot;).

(They do setAttributeNS, that is.  In SVG content.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43577</commentid>
    <comment_count>13</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-12-27 23:46:43 +0000</bug_when>
    <thetext>I guess we could also just drop anything that isn&apos;t in a supported namespace.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43782</commentid>
    <comment_count>14</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2011-01-03 14:43:59 +0000</bug_when>
    <thetext>I suspect that would break stuff. Throwing data away also does not seem like a good idea.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43877</commentid>
    <comment_count>15</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-01-06 22:38:56 +0000</bug_when>
    <thetext>We&apos;re going to be throwing away the namespace anyway.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43878</commentid>
    <comment_count>16</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-01-06 22:57:54 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Partially Accepted
Change Description: see diff given below
Rationale:

I ended up doing a mixture of the proposals above.

If it&apos;s an element in the HTML, SVG, or MathML namespaces, then there&apos;s no prefix, regardless of the DOM. Otherwise, I just let the qualified name through and round-tripping will break.

If it&apos;s an attribute in the XML, XMLNS, or XLink namespaces, then there&apos;s the canonical prefix (with an exception for xmlns:xmlns=&quot;&quot;). If there&apos;s no namespace, there&apos;s no prefix. Otherwise, I just let the qualified name through and round-tripping will break.

I didn&apos;t do anything to stop duplicate attributes from being output, or to stop namespace prefixes bound to non-canonical namespaces from stomping over the canonical mapping&apos;s namespace, etc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43879</commentid>
    <comment_count>17</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-01-06 22:58:51 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r5743.
Check-in comment: teach the fragment serialisation algorithm about namespaces
http://html5.org/tools/web-apps-tracker?from=5742&amp;to=5743</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53606</commentid>
    <comment_count>18</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2011-08-04 05:15:37 +0000</bug_when>
    <thetext>mass-move component to LC1</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>