-
Notifications
You must be signed in to change notification settings - Fork 378
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
Should parser extensibility be a design goal? #113
Comments
My take:
|
I can kinda see why some folks might want to have a void custom element (at least from a parsing perspective). As for the other craziness around |
Self closing elements DO seem like a useful thing to have. I don't think we want to make parsing behavior polymorphic as done for table and tr elements though. It makes HTML parsing incompatible with XML parser, and all sorts of insanity ensues. One way to mitigate this problem would be let any element that has For script and style, I don't think we necessarily want the exact same parsing rule that takes care of Note that upgrading makes even less sense once we allow the parser behavior depend on element definition since we wouldn't know how to parse an element until the definition is available, and we certainly don't want to make the parsing rule racy. |
Hmm, what are the pros and cons of this vs. letting elements with - appear anywhere a div can appear? I don't really have an opinion either way, but it's probably worth enumerating.
Could you clarify a bit? From what I recall of CDATA, it involves ugly
Definitely. I think that any elements which opt-in to unusual parsing rules would either need a sentinel in their tag name (strawman: |
No, script data ignores What I'm proposing is to let an element implicitly begin a CDATA section. e.g. treat
This is the only way.
This would be racy if the script, which contains the element definition, loads asynchronously.
I disagree. Some custom elements having to be defined prior to the use and others being upgraded later would be super confusing for consumers of custom elements. |
I don't really agree it would be that confusing, but the opt-in via unusual parsing rules neatly sidesteps the issue, since it means all elements (including those with unusual parsing rules) can be upgraded. Since you seem to prefer that solution anyway, I think we're in accord. |
I think |
(I don't think subclassing is the solution. Composition seems better since you might not want all the baggage that |
That seems fair. Can we try to nail down:
|
I sort of feel like the default parsing should be While I agree that |
Hmm I didn't realize
Well, there'd need to be some abstraction at least, to distinguish the character sequence |
You don't think the scanner for |
Anything that you would want to parse differently than 'normal' HTML can be shoved into a
and if a custom element author wanted to make use of that, they could choose how to do that for their particular element -- whether that means instructing consumers to make it a child element, or provide it the ID of the script element, or whatever. As for the ability to specify a valid content model, that's kind of what the shadow DOM already aims to provide. If a component author wants to move invalid children (i.e. children not matching a slot or content selector) to the outside of the element instead of just ignoring them (like what you mentioned with tables and forms) they can do that, although it seems pointless. |
Some thoughts...
|
During the teleconference I think the only viable option to the parser that was mentioned was some kind of switch for the tree builder, so you can opt into a much simpler model. Anything that requires deep changes to the existing parser is unlikely to succeed. |
I think some people were still supportive of the idea of using rare or currently-invalid sigils to switch to a different parsing mode, e.g. |
Okay, fair enough, if we still want to consider that. |
(Trailing |
From ad-hoc reducing Some have
view-source:http://www.aujourdhui-en-france.fr/ view-source:http://ww1.jaruratmand.com/ view-source:http://gongbe.com/ view-source:http://www.philipmorrisdirect.co.uk/ None of the matches had element names with For either of these, a space before it is required because otherwise the character becomes part of the element name or attribute name. The sigil could be In order to not break pages like the ones above, I suggest any sigil to change parser behavior be limited to elements that have |
Oh, OK, right... As I commented in whatwg/html#721 (comment) I think that is less flexible. Also if |
@domenic do you still think that's realistic? My impression is still that nobody really wants to touch the parser. |
I still think it's realistic... I don't know if there's appetite for it. @dominiccooney @rniwa @travisleithead @smaug---- what do you think of the idea (as a "custom elements v2" future feature) of modifying the parser so that Does it sound doable and reasonable, or is modifying the parser in such a way a bad idea that you never endorse? |
TPAC F2F conclusion: nobody really wants to do this. The use cases are better served by is="" or similar. One of the particular problems brought up was backward compatibility with browsers that don't implement this; is="" is much better for that. |
Hello, Why not just plain old |
We might be able to support self-closing tags for an element with However, what we're discussing is changing the parsing mode to avoid HTML parser's quirks or customize its behavior so the discussion here is a bit tangential to that even though the syntax we've been discussing looks like a self-closing tag so it's a bit confusing. |
Forked from #112 (comment)
The text was updated successfully, but these errors were encountered: