[Webkit-unassigned] [Bug 210595] New: [GTK] The <style> element should not convert \n into <br>

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 16 01:15:15 PDT 2020


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

            Bug ID: 210595
           Summary: [GTK] The <style> element should not convert \n into
                    <br>
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcrha at redhat.com
                CC: bugs-noreply at webkitgtk.org

The <style> element inside <head> can use \n as a separator between CSS rules (yes, they should be in a comment, but it's still possible to write them as regular text inside the element). When I want to get the content of the HTML document the \n are converted into <br> tags, which can lead to broken CSS rules when this HTML is loaded back. This conversion happens when setting style.innerText value.

Steps:
a) open the MiniBrowser and there the Inspector
b) run in the Inspector Console:

   document.documentElement.innerHTML = "<head><style> body {color:orange;}\nbody {background:blue;}</style></head><body>text</body>"

   * you see a blue document with orange 'text' at the top, as expected.
   * the 'Elements' tab shows the <style> element content as one long line, as expected.

c) run in the Inspector Console:

   document.head.firstElementChild.innerText = "body {color:green;}\nbody {background:red;}"

   * you see a red document with green 'text' at the top, as expected.
   * the 'Elements' tab shows the <style> element content with <br> element, where \n was used, which is wrong.

d) run in the Inspector Console:

   document.documentElement.innerHTML = document.documentElement.innerHTML

   * you see a white document with green 'text' at the top, which is wrong.
   * the 'Elements' tab shows the <style> element content with <br> as a regular text, not as an element, which is wrong.

The expected is that:
* after c) the <style>'s content will not contain <br> element
* after d) there will be absolutely no change in the view, neither in the HTML content/structure

This is with the trunk at r259630.

-- 
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/20200416/bd0685fb/attachment-0001.htm>


More information about the webkit-unassigned mailing list