Re: HTML element content models vs. components

On Tue, Sep 27, 2011 at 11:53 PM, Dominic Cooney <> wrote:
> On Wed, Sep 28, 2011 at 3:39 PM, Roland Steiner
> <> wrote:
> > Expanding on the general web component discussion, one area that hasn't been
> > touched on AFAIK is how components fit within the content model of HTML
> > elements.
> > Take for example a list
> > (
> > <ol> and <ul> have "Zero or more <li> elements" as content model, while <li>
> > is specified to only be usable within <ol>, <ul> and <menu>.
> > Now it is not inconceivable that someone would like to create a component
> > <x-li> that acts as a list item, but expands on it. In order to allow this,
> > the content model for <ol>, <ul>, <menu> would need to be changed to
> > accomodate this. I can see this happening in a few ways:
> >
> > A.) allow elements derived from a certain element to always take their place
> > within element content models.
> > In this case, only components whose host element is derived from <li> would
> > be allowed within <ol>, <ul>, <menu>, whether or not it is rendered (q.v.
> > the "Should the shadow host element be rendered?" thread on this ML).
> >
> > B.) allow all components within all elements.
> > While quite broad, this may be necessary in case the host element isn't
> > rendered and perhaps derivation isn't used. Presumably the shadow DOM in
> > this case contains one - or even several - <li> elements as topmost elements
> > in the tree.
> >
> > C.) Just don't allow components to be used in places that have a special
> > content model.
> I prefer this one, because:
> 1. It is very simple.
> 2. It discourages people from using components in cases already handled by HTML.

+1 as a first step. We can start with this and see how authors react.
I suspect that without actual running code and people trying things
out, we could be debating this for a very long time :)

Also, the "content model" is a bit of a loaded term. It's only about
what browsers actually do. IRL, it's perfectly ok to plop an <li>
element anywhere in your DOM tree. The only special-casing logic that
HTMLLiElement has is to deal with the rendering, as Morrita-san
already pointed out
This is not the case for all elements though. And we won't weed out
all edge cases by principled studying. We gotta start simple and let
peeps run code! :)


Received on Wednesday, 28 September 2011 18:13:13 UTC