[whatwg] repetition model

Peter-Paul Koch gassinaumasis at hotmail.com
Sun Jun 13 15:26:17 PDT 2004

> > 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

Unfortunately it only shows up in Mozilla (getElementsByTagName('repeat'))

>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.

If by scripting we don't need the repeat tag.

> > 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 causes an error only in Opera, but only Mozilla actually inserts the 
element. IE and Safari don't do anything.

> > 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?

Replace it, rather, by an existing tag with a non-existing attribute, for 

<div WFaction="repeat">

or whatever. This way it's accessible to W3C DOM scripts, which bear the 
brunt of repeating anyway until native support for Web Forms is reached.

If you want Web Forms to be implementable right now (by JavaScript), you'll 
have to (temporarily?) redefine several elements as existing XHTML tags.

ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
Column "Keep it Simple": http://www.digital-web.com/types/keep_it_simple/

Play online games with your friends with MSN Messenger 

More information about the whatwg mailing list