Open zcorpan opened 5 years ago
I looked into this as part of https://bugs.webkit.org/show_bug.cgi?id=189431.
If there is an adjusted current node and it is not an element in the HTML namespace, then switch to the CDATA section state.
Now as per the WebKit bug, Chromium and WebKit also require the parser to not be in an integration point.
Now the interesting test is the combination of CDATA and U+0000 in this state.
Gecko again appears to follow the specification and not emit U+0000 as is required by "in body", but is that what we want? We should probably treat U+0000 explicitly when tokenizing CDATA to ensure it does not get lost.
cc @whatwg/html-parser
"in foreign content" indeed isn't an insertion mode.
My understanding of the reason why CDATA sections are allowed as children of HTML integration points is that SVG desc
and title
as well as MathML annotation-xml
could legitimately contain non-HTML, so supporting CDATA sections maximizes compatibility with copypaste from XML.
What do you think about the U+0000 case?
https://html.spec.whatwg.org/multipage/parsing.html#the-insertion-mode
https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign is not mentioned, although it is where CDATA sections are supported. If in foreign content is not an insertion mode, then the insertion mode doesn't affect whether CDATA sections are supported...