<?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>32393</bug_id>
          
          <creation_ts>2009-12-10 13:34:42 -0800</creation_ts>
          <short_desc>Comments and PIs in the internal subset appear as siblings of the doctype</short_desc>
          <delta_ts>2023-12-30 06:00:13 -0800</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>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, WPTImpact</keywords>
          <priority>P3</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Pieters (:zcorpan)">zcorpan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>mike</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>170507</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Pieters (:zcorpan)">zcorpan</who>
    <bug_when>2009-12-10 13:34:42 -0800</bug_when>
    <thetext>Comments and PIs that appear in the internal subset are inserted to the DOM as children of the document, after the doctype node. This is bogus. In the Infoset, they&apos;d be children of the doctype. In the DOM, they&apos;d be dropped on the floor, basically.

This makes a difference for xml-stylesheet PIs.

Opera and Mozilla don&apos;t insert comments and PIs in the internal subset as children of the document.

http://canvex.lazyilluminati.com/misc/dom-viewer/x.html?&lt;!DOCTYPE%20x[&lt;!--comment--&gt;&lt;%3Fpi%3F&gt;]&gt;&lt;x/&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>170623</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-12-10 19:50:14 -0800</bug_when>
    <thetext>What is the use case for putting xml-stylesheet PI into the internal subset?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>170658</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Pieters (:zcorpan)">zcorpan</who>
    <bug_when>2009-12-11 01:57:46 -0800</bug_when>
    <thetext>No use case; that&apos;s why WebKit shouldn&apos;t allow it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1502962</commentid>
    <comment_count>3</comment_count>
    <who name="Lucas Forschler">lforschler</who>
    <bug_when>2019-02-06 09:03:24 -0800</bug_when>
    <thetext>Mass moving XML DOM bugs to the &quot;DOM&quot; Component.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1503701</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Pieters (:zcorpan)">zcorpan</who>
    <bug_when>2019-02-07 04:18:44 -0800</bug_when>
    <thetext>New URL to reproduce:

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/6580

says [object ProcessingInstruction] should say [object DocumentType].

&lt;!DOCTYPE html&gt;
...&lt;iframe src=&quot;data:text/xml,&lt;!DOCTYPE html [&lt;?x?&gt;]&gt;&lt;html xmlns=&apos;http://www.w3.org/1999/xhtml&apos;&gt;&lt;script&gt;alert(document.documentElement.previousSibling)&lt;/script&gt;&lt;/html&gt;&quot;&gt; 

or:

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/6581

The xml-stylesheet should not apply but is applied.

&lt;!DOCTYPE html&gt;
...&lt;iframe src=&quot;data:text/xml,&lt;!DOCTYPE html [&lt;?xml-stylesheet href=&apos;data:text/css,*{background:red}&apos;?&gt;]&gt;&lt;html xmlns=&apos;http://www.w3.org/1999/xhtml&apos;&gt;There should be no red.&lt;/html&gt;&quot;&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1890252</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-10 04:19:39 -0700</bug_when>
    <thetext>I am able to reproduce this based on Test cases from Comment 04:

Test Case 1 - http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=6580

*** Safari 15.6 on macOS 12.5 ***

[object ProcessingInstruction]

&amp; DOM View:

DOCTYPE: html

*** Chrome Canary 106 ***

[object ProcessingInstruction]

&amp; DOM View:

DOCTYPE: html
HTML
HEAD
BODY
#text: ...
IFRAME src=&quot;data:text/xml,&lt;!DOCTYPE html [&lt;?x?&gt;]&gt;&lt;html xmlns=&apos;http://www.w3.org/1999/xhtml&apos;&gt;&lt;script&gt;alert(document.documentElement.previousSibling)&lt;/script&gt;&lt;/html&gt;&quot;

*** Firefox Nightly 106 ***

[object DocumentType]

&amp; DOM View:

    DOCTYPE: html
    HTML
        HEAD
        BODY
            #text: ...
            IFRAME src=&quot;data:text/xml,&lt;!DOCTYPE html [&lt;?x?&gt;]&gt;&lt;html xmlns=&apos;http://www.w3.org/1999/xhtml&apos;&gt;&lt;script&gt;alert(document.documentElement.previousSibling)&lt;/script&gt;&lt;/html&gt;&quot;

___________

Test Case 2 - http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=6581

*** Safari 15.6 on macOS 12.5 ***

Show Red background in iframe

*** Chrome Canary 106 ***

Show Red background in iframe

*** Firefox Nightly 106 ***

Does not show &quot;Red&quot; background in iframe

_________

Just wanted to share updated test results. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1890341</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-08-10 10:52:07 -0700</bug_when>
    <thetext>&lt;rdar://problem/98459822&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1928684</commentid>
    <comment_count>7</comment_count>
    <who name="Simon Pieters (:zcorpan)">zcorpan</who>
    <bug_when>2023-01-26 12:57:37 -0800</bug_when>
    <thetext>Tests: https://github.com/web-platform-tests/wpt/pull/38136</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2002299</commentid>
    <comment_count>8</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-12-30 06:00:13 -0800</bug_when>
    <thetext>WPT Test Case: https://wpt.fyi/results/dom/nodes/ProcessingInstruction-in-doctype.xhtml?label=master&amp;label=experimental&amp;aligned=

https://wpt.fyi/results/dom/nodes/Comment-in-doctype.xhtml?label=master&amp;label=experimental&amp;aligned=

https://wpt.fyi/results/css/cssom/xml-stylesheet-pi-in-doctype.xhtml?label=master&amp;label=experimental&amp;aligned=</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>