Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify using CDATA in HTML context #10801

Open
SetTrend opened this issue Nov 26, 2024 · 3 comments
Open

Clarify using CDATA in HTML context #10801

SetTrend opened this issue Nov 26, 2024 · 3 comments
Labels
clarification Standard could be clearer document conformance

Comments

@SetTrend
Copy link

SetTrend commented Nov 26, 2024

What is the issue with the HTML Standard?

Currently, the HTML standard doesn't get clear on whether a <![CDATA[ ]]> section may be used in HTML context:

https://html.spec.whatwg.org/multipage/syntax.html#cdata-sections

There is just an example that – speaking only for the example itself – claims "CDATA sections can only be used in foreign content (MathML or SVG)."

Is this statement true for HTML? Then it should be moved outside the example heading.

@domenic
Copy link
Member

domenic commented Nov 27, 2024

Per spec it's a conformance error; see https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state.

I agree that this should probably be stated somewhere near where you list, instead of just inside the parser. I'm not really sure what the best conventions are for this sort of duplicate conformance requirement, but I know we have a variety of them.

I guess this is already implicit in https://html.spec.whatwg.org/#elements-2 actually?

The contents of the element must be placed between just after the start tag (which might be implied, in certain cases) and just before the end tag (which again, might be implied in certain cases). The exact allowed contents of each individual element depend on the content model of that element, as described earlier in this specification.

and no content models allow CDATA sections.

But yeah, your idea of just moving this sentence outside of the example might be reasonable.

@domenic domenic added clarification Standard could be clearer document conformance labels Nov 27, 2024
@annevk
Copy link
Member

annevk commented Nov 27, 2024

I think it could be a note instead of being part of the example, but we probably wouldn't want to restate it normatively as it indeed already follows from where it is referenced?

@domenic
Copy link
Member

domenic commented Nov 27, 2024

@annevk, I thought you were the one who generally argued for the duplicate-normative-conformance-requirements approach, per whatwg/url#704 (comment) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer document conformance
Development

No branches or pull requests

3 participants