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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>83056</bug_id>
          
          <creation_ts>2012-04-03 12:19:01 -0700</creation_ts>
          <short_desc>Serializing SVG removes namespace from attributes</short_desc>
          <delta_ts>2013-08-29 10:22:30 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>XML</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.7</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://bl.ocks.org/2294676</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Ian">enjalot</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>alex</cc>
    
    <cc>ap</cc>
    
    <cc>rwlbuis</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>594732</commentid>
    <comment_count>0</comment_count>
    <who name="Ian">enjalot</who>
    <bug_when>2012-04-03 12:19:01 -0700</bug_when>
    <thetext>I&apos;ve coded an example which uses DOM serialization to rasterize some SVG with Canvas:
http://bl.ocks.org/2294676

In Webkit (but not Firefox) I have to run a regular expression on my serialized SVG to add back the xlink: to my xlink:href attributes.

This may be caused by this bug: https://bugs.webkit.org/show_bug.cgi?id=22958

It may be related to an issue here: http://stackoverflow.com/questions/8979267/xmlserializer-strips-xlink-from-xlinkhtml-svg-image-tag
but I&apos;m not sure it&apos;s the same thing since I am not dynamically generating these DOM elements</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>595829</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-04-04 13:07:44 -0700</bug_when>
    <thetext>Duplicate of bug 79586?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>595836</commentid>
    <comment_count>2</comment_count>
    <who name="Rob Buis">rwlbuis</who>
    <bug_when>2012-04-04 13:13:57 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; Duplicate of bug 79586?

Very likely. Fixing 79586 should fix this one as well.
Cheers,

Rob.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>901593</commentid>
    <comment_count>3</comment_count>
    <who name="Alex Milowski">alex</who>
    <bug_when>2013-06-18 17:13:16 -0700</bug_when>
    <thetext>This is the same as bug 22958.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>902801</commentid>
    <comment_count>4</comment_count>
    <who name="Rob Buis">rwlbuis</who>
    <bug_when>2013-06-22 11:26:36 -0700</bug_when>
    <thetext>This seems fixed to me. I think the 79586 bugfix fixed this as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>902812</commentid>
    <comment_count>5</comment_count>
      <attachid>205257</attachid>
    <who name="Alex Milowski">alex</who>
    <bug_when>2013-06-22 16:14:06 -0700</bug_when>
    <thetext>Created attachment 205257
Example of two ways to do the same thing

The attached example does the same thing slightly differently.   Both are correct from a DOM/JS perspective but the second requires the serializer to generate a prefix.  The current serializer code fails to do this correctly.

Thus, it really depends on how you define fixed.  Is it fixed to leave a known issue?  IMHO, this is really fixed when bug 22958 is fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>902817</commentid>
    <comment_count>6</comment_count>
    <who name="Rob Buis">rwlbuis</who>
    <bug_when>2013-06-22 19:18:16 -0700</bug_when>
    <thetext>Hi Alex,

(In reply to comment #5)
&gt; Created an attachment (id=205257) [details]
&gt; Example of two ways to do the same thing
&gt; 
&gt; The attached example does the same thing slightly differently.   Both are correct from a DOM/JS perspective but the second requires the serializer to generate a prefix.  The current serializer code fails to do this correctly.
&gt; 
&gt; Thus, it really depends on how you define fixed.  Is it fixed to leave a known issue?  IMHO, this is really fixed when bug 22958 is fixed.

I meant fixed in the sense that the blocks page works. Or rather, when taking it and removing the webkit specific replace hack it works.
I am updating my patch for bug 16496, hopefully it can fix more than just that bug, since it seems like there is some overlap in the XMLSerializer bugs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>902861</commentid>
    <comment_count>7</comment_count>
    <who name="Alex Milowski">alex</who>
    <bug_when>2013-06-23 20:46:45 -0700</bug_when>
    <thetext>Sure.  That makes sense.  

I don&apos;t know what the policy is for closing bugs like this.  Certainly the problem described for that particular page is fixed within the current code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>902943</commentid>
    <comment_count>8</comment_count>
    <who name="Rob Buis">rwlbuis</who>
    <bug_when>2013-06-24 07:08:28 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; Sure.  That makes sense.  
&gt; 
&gt; I don&apos;t know what the policy is for closing bugs like this.  Certainly the problem described for that particular page is fixed within the current code.

Well, the latest patch on bug 16496 fixes both of the problems in your testcase. So once that goes in, we can close this bug too, though we have to check whether we want to keep your testcase in the tests.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>903071</commentid>
    <comment_count>9</comment_count>
    <who name="Alex Milowski">alex</who>
    <bug_when>2013-06-24 14:35:33 -0700</bug_when>
    <thetext>(In reply to comment #8)
&gt; (In reply to comment #7)
&gt; &gt; Sure.  That makes sense.  
&gt; &gt; 
&gt; &gt; I don&apos;t know what the policy is for closing bugs like this.  Certainly the problem described for that particular page is fixed within the current code.
&gt; 
&gt; Well, the latest patch on bug 16496 fixes both of the problems in your testcase. So once that goes in, we can close this bug too, though we have to check whether we want to keep your testcase in the tests.

I took a peek at this patch.  It doesn&apos;t look like it handles the general problems with the serializer but certainly can address issues with the SVG and xlink namespace/prefix.

The real fix requires an adjustment to the algorithm to keep track of generated prefixes and/or their declaration.  That is, you need to general prefixes as necessary, not just for known namespaces, and the keep track of their scope.  Neither of those happen currently in the MarkupAccumulator.cpp code.

See bug 117764 for some more esoteric examples of where this breaks down.

That said, I&apos;m happy to close out specific bugs with smaller changes and wait for the general one to be addressed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>903078</commentid>
    <comment_count>10</comment_count>
    <who name="Rob Buis">rwlbuis</who>
    <bug_when>2013-06-24 14:51:54 -0700</bug_when>
    <thetext>Hi Alex,

(In reply to comment #9)
&gt; (In reply to comment #8)
&gt; &gt; (In reply to comment #7)
&gt; &gt; &gt; Sure.  That makes sense.  
&gt; &gt; &gt; 
&gt; &gt; &gt; I don&apos;t know what the policy is for closing bugs like this.  Certainly the problem described for that particular page is fixed within the current code.
&gt; &gt; 
&gt; &gt; Well, the latest patch on bug 16496 fixes both of the problems in your testcase. So once that goes in, we can close this bug too, though we have to check whether we want to keep your testcase in the tests.
&gt; 
&gt; I took a peek at this patch.  It doesn&apos;t look like it handles the general problems with the serializer but certainly can address issues with the SVG and xlink namespace/prefix.
&gt; 
&gt; The real fix requires an adjustment to the algorithm to keep track of generated prefixes and/or their declaration.  That is, you need to general prefixes as necessary, not just for known namespaces, and the keep track of their scope.  Neither of those happen currently in the MarkupAccumulator.cpp code.

Yeah, my thinking was follow the &quot;hardcoded&quot; handling of attribute prefixes (xlink, xml xmlns) in appendAttribute for now to be on the safe side. I am relying on review iterations to improve the code quality :)
 
&gt; See bug 117764 for some more esoteric examples of where this breaks down.

Thanks.

&gt; That said, I&apos;m happy to close out specific bugs with smaller changes and wait for the general one to be addressed.

Yep, see above, I am trying to be pragmatic about it. It is hard enough to pass all/not brrak tests and/or make the serialized test output sane :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>904345</commentid>
    <comment_count>11</comment_count>
    <who name="Rob Buis">rwlbuis</who>
    <bug_when>2013-06-27 14:06:38 -0700</bug_when>
    <thetext>&gt; I took a peek at this patch.  It doesn&apos;t look like it handles the general problems with the serializer but certainly can address issues with the SVG and xlink namespace/prefix.
&gt;
&gt;
&gt; The real fix requires an adjustment to the algorithm to keep track of generated prefixes and/or their declaration.  That is, you need to general prefixes as necessary, not just for known namespaces, and the keep track of their scope.  Neither of those happen currently in the MarkupAccumulator.cpp code.

I am starting fixing this in bug 19121. It would be nice if you could have a look :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>922527</commentid>
    <comment_count>12</comment_count>
    <who name="Rob Buis">rwlbuis</who>
    <bug_when>2013-08-29 10:22:30 -0700</bug_when>
    <thetext>Committed r154779: &lt;http://trac.webkit.org/changeset/154779&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>205257</attachid>
            <date>2013-06-22 16:14:06 -0700</date>
            <delta_ts>2013-06-22 16:14:06 -0700</delta_ts>
            <desc>Example of two ways to do the same thing</desc>
            <filename>83056.xhtml</filename>
            <type>application/xhtml+xml</type>
            <size>1051</size>
            <attacher name="Alex Milowski">alex</attacher>
            
              <data encoding="base64">PGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPgo8aGVhZD48dGl0bGU+
QnVnIDgzMDU2PC90aXRsZT48L2hlYWQ+Cjxib2R5Pgo8c2NyaXB0IHR5cGU9InRleHQvamF2YXNj
cmlwdCI+Ci8vIDgzMDU2IGV4YW1wbGUgZnJvbSBzdGFja292ZXJsZm93CnZhciB0ZW1wID0gZG9j
dW1lbnQuY3JlYXRlRWxlbWVudE5TKCJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIsImltYWdl
Iik7CnRlbXAuc2V0QXR0cmlidXRlTlMobnVsbCwieCIsIjAiKTsKdGVtcC5zZXRBdHRyaWJ1dGVO
UyhudWxsLCJ5IiwiMCIpOwp0ZW1wLnNldEF0dHJpYnV0ZU5TKG51bGwsImhlaWdodCIsIjgwIik7
CnRlbXAuc2V0QX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