NEW 181642
insertAdjacentHTML of string including elements with prefixed attributes not working
https://bugs.webkit.org/show_bug.cgi?id=181642
Summary insertAdjacentHTML of string including elements with prefixed attributes not ...
Johannes Wilm
Reported 2018-01-14 23:38:43 PST
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('beforeend', string) or element.innerHTML += string. 3a. If the string contains attributes with prefixes, such as '<manifest:file-entry manifest:full-path="Picture.jpg" manifest:media-type="image/jpg"/>' the insertion fails and a syntax error is thrown. 3b. If the strings does not contain attributes with prefixes, such as '<manifest:file-entry full-path="Picture.jpg" media-type="image/jpg"/>' 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.
Attachments
insertAdjacentHTML with prefixed attributes, minimal testcase (514 bytes, text/plain)
2018-02-25 09:22 PST, Johannes Wilm
no flags
Johannes Wilm
Comment 1 2018-02-25 09:22:19 PST
Created attachment 334580 [details] insertAdjacentHTML with prefixed attributes, minimal testcase This works in Firefox and Chrome and not Safari.
Johannes Wilm
Comment 2 2018-07-28 09:08:00 PDT
Still present in Technology Preview 61 (Safari 12.0)
Ahmad Saleem
Comment 3 2023-05-13 12:04:39 PDT
Took test and changed it into JSFiddle: https://jsfiddle.net/L9uk0s2p/ *** Chrome Canary 115 *** Nothing in Console *** Safari Technology Preview 169 *** "<a class='gotoLine' href='#45:22'>45:22</a> SyntaxError: The string did not match the expected pattern." *** WebKit ToT (264046@main) *** [Minibrowser] "<a class='gotoLine' href='#45:22'>45:22</a> SyntaxError: The string did not match the expected pattern." *** Firefox Nightly 115 *** "<a class='gotoLine' href='#45:0'>45:0</a> SyntaxError: An invalid or illegal string was specified" _____________________________ From Comment 01, it seems that Firefox also changed the behavior since it was working fine.
Anne van Kesteren
Comment 4 2023-05-15 00:19:51 PDT
This also happens for innerHTML. It seems like we don't implement https://html.spec.whatwg.org/#xml-fragment-parsing-algorithm correctly. Maybe Firefox changed their XML parser recently?
Ahmad Saleem
Comment 5 2023-10-23 17:14:27 PDT
I took additional tests for this from Blink: https://src.chromium.org/viewvc/blink?view=revision&revision=191940 and now trying to merge in PR for fixing bug 66424.
Note You need to log in before you can comment on or make changes to this bug.