[Webkit-unassigned] [Bug 203868] New: Parsing HTML fragments assigns a wrong namespace if the parents is an SVG <foreignObject>

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 5 15:51:11 PST 2019


https://bugs.webkit.org/show_bug.cgi?id=203868

            Bug ID: 203868
           Summary: Parsing HTML fragments assigns a wrong namespace if
                    the parents is an SVG <foreignObject>
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: sabouhallawa at apple.com

Created attachment 382855

  --> https://bugs.webkit.org/attachment.cgi?id=382855&action=review

test case

Open the attached test case.

Expected: The svg should have two <foreignObject> elements. Inside each element there should be an <h2> element followed by a <table> element.
Result: There is only one <foreignObject> element visible. The other element is not displayed.

In the WebInspector copy the second <foreignObject> to the clipboard and paste it in a text editor. This will be the result. Notice the wrong namespace in the tags <h2> and <table>

<?xml version="1.0"?>
<foreignObject xmlns="http://www.w3.org/2000/svg" x="200" width="200" height="100">
  <div xmlns="http://www.w3.org/1999/xhtml">
    <section>
      <h2 xmlns="http://www.w3.org/2000/svg">Header 2</h2>
      <table xmlns="http://www.w3.org/2000/svg">
        <thead>
          <tr>
            <th>Cell 2-1</th>
            <th>Cell 2-2</th>
            <th>Cell 2-3</th>
          </tr>
        </thead>
      </table>
    </section>
  </div>
</foreignObject>

The bug happens only when calling innerHTML. And it happens because the XMLDocumentParser sets the namespace "http://www.w3.org/2000/svg" to the elements, it creates from the fragment, if the page is an SVG document.

This bug can be seen also when showing the results of the SVG WPT tests in the browser. For example, when opening this test http://web-platform-tests.live/svg/painting/parsing/fill-opacity-valid.svg WebKit, the results section will not be shown.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191105/6783f7ca/attachment.htm>


More information about the webkit-unassigned mailing list