WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
189431
CDATA section are not supported in SVG/MathML in HTML
https://bugs.webkit.org/show_bug.cgi?id=189431
Summary
CDATA section are not supported in SVG/MathML in HTML
Simon Pieters (:zcorpan)
Reported
2018-09-07 14:03:02 PDT
See
https://github.com/whatwg/html/issues/4016
Simple test case data:text/html,<svg><!|CDATA[ ><p>FAIL
Attachments
Add attachment
proposed patch, testcase, etc.
Simon Pieters (:zcorpan)
Comment 1
2018-09-07 14:13:24 PDT
The test case has a typo. CDATA sections are supported, but not in HTML integration points when the current node is still an SVG or MathML element. For example:
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/6207
<!DOCTYPE html> <svg><title><![CDATA[x]]></title></svg>
Ahmad Saleem
Comment 2
2022-08-09 13:46:51 PDT
I am able to reproduce based on test case from
Comment 01
, where in the DOM View, I get following across browsers: *** Safari 15.6 on macOS 12.5 *** #comment: [CDATA[x]] *** Chrome Canary 106 *** #comment: [CDATA[x]] *** Firefox Nightly 105 *** #text: x _____ Just wanted to update the results. Thanks!
Radar WebKit Bug Importer
Comment 3
2022-08-10 10:59:03 PDT
<
rdar://problem/98460240
>
Anne van Kesteren
Comment 4
2023-12-18 08:40:55 PST
I looked into fixing this and as a start I commented on
https://github.com/whatwg/html/issues/4015
. Here's the patch I have, but I would like the standards discussion to conclude: diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp index c138725bb0f0..f63339ac6a35 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -337,13 +337,13 @@ void HTMLTreeBuilder::constructTree(AtomHTMLToken&& token) else processToken(WTFMove(token)); - bool inForeignContent = !m_tree.isEmpty() - && !isInHTMLNamespace(adjustedCurrentStackItem()) + auto inForeignNamespace = !m_tree.isEmpty() && !isInHTMLNamespace(adjustedCurrentStackItem()); + m_parser.tokenizer().setShouldAllowCDATA(inForeignNamespace); + + auto inForeignContent = inForeignNamespace && !HTMLElementStack::isHTMLIntegrationPoint(m_tree.currentStackItem()) && !HTMLElementStack::isMathMLTextIntegrationPoint(m_tree.currentStackItem()); - m_parser.tokenizer().setForceNullCharacterReplacement(m_insertionMode == InsertionMode::Text || inForeignContent); - m_parser.tokenizer().setShouldAllowCDATA(inForeignContent); #if ASSERT_ENABLED m_destructionProhibited = false;
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug