W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2004

[whatwg] repetition model

From: Ian Hickson <ian@hixie.ch>
Date: Sun, 13 Jun 2004 19:43:14 +0000 (UTC)
Message-ID: <Pine.LNX.4.58.0406131926010.3032@dhalsim.dreamhost.com>

(Note: I'm going through all the Web Forms 2 comments that were sent to
this list in chronological order. At the moment I'm dealing with e-mails
from last Thursday.)

On Thu, 10 Jun 2004, Dean Edwards wrote:
>
> but i have some reservations. i'm confused by the <repeat> element. this
> is the first time i've seen such a construct in an xml language. if this
> kind of construct is normal, please ignore the rest of my comments and
> direct me to a suitable resource so i can do some reading!
>
> my main reservation is that, for the first time, my DOM does not look
> exactly like my markup.

<script> blocks have long been able to change the DOM during parse time.
There are also some bugs in IE that cause it to remove entire elements
from the DOM (in particular <object>) under certain conditions. So it's
not the first time, per se. :-)

I agree it is odd though.


> now i have this "repeat" element. does it show up in the DOM?

It's well defined:

   http://whatwg.org/specs/web-forms/current-work/#repeat0

As soon as the <repeat> element is inserted into the document, whether by
being in the original markup or via scripting, a repetition block is
inserted into the DOM at the appropriate place, and the <repeat> element
is then removed.

I agree it is a bit unusual. I don't really see another way to do it
though. Suggestions are welcome.


> presumably generated rows and form controls do.

Yes.


> can i do this?
>    document.createElement("repeat");
> will that throw an error?

You can do it and it won't cause an error. If you try to insert it into
the document using, e.g., appendChild(), then the element will be replaced
by a repetition block in the final DOM, as described in the spec above.


> it seems like the <repeat> element is more like a programming
> instruction than real content.

True. We could use a PI instead, but I don't think IE supports that (you
wouldn't be able to tell there was a PI in the DOM, right?).


> this takes (X)HTML in a new direction.

That's the intention of the WHATWG. :-)


> imho, something like the <repeat> construct belongs in the realm of
> jsp/asp/php. maybe this functionality can be included as a DOM method
> for completeness?

It is a DOM method too. In fact, it's defined in terms of two DOM methods.
And it could indeed be done on the server side, although it would be a
lot uglier.

Should I just remove it for now?

I don't really see what to replace it with. It's a rather important part
of the demo in the introduction:

   http://whatwg.org/specs/web-forms/current-work/#introduction0

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Sunday, 13 June 2004 12:43:14 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:34 UTC