<?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>181642</bug_id>
          
          <creation_ts>2018-01-14 23:38:43 -0800</creation_ts>
          <short_desc>insertAdjacentHTML of string including elements with prefixed attributes not working</short_desc>
          <delta_ts>2023-10-23 17:14:27 -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>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>66424</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Johannes Wilm">mail</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>annevk</cc>
    
    <cc>ap</cc>
    
    <cc>cdumez</cc>
    
    <cc>mail</cc>
    
    <cc>rniwa</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1389241</commentid>
    <comment_count>0</comment_count>
    <who name="Johannes Wilm">mail</who>
    <bug_when>2018-01-14 23:38:43 -0800</bug_when>
    <thetext>1. Load an XML file, for example one of the files inside an ODT or DOCX file. 

2. Try to insert a string in a place where this is valid at the end using element.insertAdjacentHTML(&apos;beforeend&apos;, string) or element.innerHTML += string.

3a. If the string contains attributes with prefixes, such as &apos;&lt;manifest:file-entry manifest:full-path=&quot;Picture.jpg&quot; manifest:media-type=&quot;image/jpg&quot;/&gt;&apos; the insertion fails and a syntax error is thrown.

3b. If the strings does not contain attributes with prefixes, such as &apos;&lt;manifest:file-entry full-path=&quot;Picture.jpg&quot; media-type=&quot;image/jpg&quot;/&gt;&apos; the insertion succeeds (but the result is not what was hoped for).

This does work in Firefox and Chrome and all existing child elements of element look just like the string in 3a, including prefixes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1401922</commentid>
    <comment_count>1</comment_count>
      <attachid>334580</attachid>
    <who name="Johannes Wilm">mail</who>
    <bug_when>2018-02-25 09:22:19 -0800</bug_when>
    <thetext>Created attachment 334580
insertAdjacentHTML with prefixed attributes, minimal testcase

This works in Firefox and Chrome and not Safari.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1445986</commentid>
    <comment_count>2</comment_count>
    <who name="Johannes Wilm">mail</who>
    <bug_when>2018-07-28 09:08:00 -0700</bug_when>
    <thetext>Still present in Technology Preview 61 (Safari 12.0)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955254</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-05-13 12:04:39 -0700</bug_when>
    <thetext>Took test and changed it into JSFiddle: https://jsfiddle.net/L9uk0s2p/

*** Chrome Canary 115 ***

Nothing in Console

*** Safari Technology Preview 169 ***

&quot;&lt;a class=&apos;gotoLine&apos; href=&apos;#45:22&apos;&gt;45:22&lt;/a&gt; SyntaxError: The string did not match the expected pattern.&quot;

*** WebKit ToT (264046@main) *** [Minibrowser]

&quot;&lt;a class=&apos;gotoLine&apos; href=&apos;#45:22&apos;&gt;45:22&lt;/a&gt; SyntaxError: The string did not match the expected pattern.&quot;


*** Firefox Nightly 115 ***

&quot;&lt;a class=&apos;gotoLine&apos; href=&apos;#45:0&apos;&gt;45:0&lt;/a&gt; SyntaxError: An invalid or illegal string was specified&quot;

_____________________________

From Comment 01, it seems that Firefox also changed the behavior since it was working fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955351</commentid>
    <comment_count>4</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2023-05-15 00:19:51 -0700</bug_when>
    <thetext>This also happens for innerHTML.

It seems like we don&apos;t implement https://html.spec.whatwg.org/#xml-fragment-parsing-algorithm correctly.

Maybe Firefox changed their XML parser recently?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1987017</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-10-23 17:14:27 -0700</bug_when>
    <thetext>I took additional tests for this from Blink: https://src.chromium.org/viewvc/blink?view=revision&amp;revision=191940

and now trying to merge in PR for fixing bug 66424.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>334580</attachid>
            <date>2018-02-25 09:22:19 -0800</date>
            <delta_ts>2018-02-25 09:22:19 -0800</delta_ts>
            <desc>insertAdjacentHTML with prefixed attributes, minimal testcase</desc>
            <filename>insertAdjacentXML.js</filename>
            <type>text/plain</type>
            <size>514</size>
            <attacher name="Johannes Wilm">mail</attacher>
            
              <data encoding="base64">bGV0IHBhcnNlciA9IG5ldyB3aW5kb3cuRE9NUGFyc2VyKCkKbGV0IHN0cmluZyA9IGA8P3htbCB2
ZXJzaW9uPSIxLjAiPz48Y3A6Y29yZVByb3BlcnRpZXMgeG1sbnM6Y3A9Imh0dHA6Ly9zY2hlbWFz
Lm9wZW54bWxmb3JtYXRzLm9yZy9wYWNrYWdlLzIwMDYvbWV0YWRhdGEvY29yZS1wcm9wZXJ0aWVz
IiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhzaT0i
aHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiPjxkYzp0aXRsZT48L2Rj
OnRpdGxlPjwvY3A6Y29yZVByb3BlcnRpZXM+YApsZXQgZG9tID0gcGFyc2VyLnBhcnNlRnJvbVN0
cmluZyhzdHJpbmcsICd0ZXh0L3htbCcpCmxldCBlbCA9IGRvbS5xdWVyeVNlbGVjdG9yKCdjb3Jl
UHJvcGVydGllcycpCmVsLmluc2VydEFkamFjZW50SFRNTCgnYmVmb3JlZW5kJywnPGRjdGVybXM6
bW9kaWZpZWQgeHNpOnR5cGU9ImRjdGVybXM6VzNDRFRGIj48L2RjdGVybXM6bW9kaWZpZWQ+JykK
Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>