[whatwg] Repetition Model (was: WF2 changes: uri->url, ERROR_* constants dropped; status update)

Jim Ley jim.ley at gmail.com
Wed Mar 23 14:56:43 PST 2005

On Wed, 23 Mar 2005 19:39:35 +0000, Dean Edwards <dean at edwards.name> wrote:
> Jim Ley wrote:
> > The requirement to iterate over every element in the document looking
> > for the attribute, and the requirement to iterate over every attribute
> > in every element in the template looking to perform the substitution
> > when inserting make it all very, very slow (the IE attributes
> > collection contains more than just the attributes defined, and setting
> > attributes like name are not actually well supported)
> >
> Yes you would have to iterate over each element to attach the repetition
> template interface. Olav Junker Kjær provided a solution to this speed
> this up a little:
> * {
> behavior:expression((this.repeat)?"url(repetitionElement.htc)":"");
> display: expression((this.repeat=="template")?"none":this.display);
> }
> this is an order of magnitude quicker than using DOM methods. 

I can't agree that it's an acceptable solution - whilst it's true it
can be quicker to initially to do it, however the expression is
continously processed at interval later - onfocus etc. and you can't
remove the behaviour until sime time after the document has loaded.
see ( http://groups-beta.google.com/group/comp.lang.javascript/msg/8fb010f87ab971f3

For example adding this to a reasonable document like my homepage,
means that there's a 1.5 sec delay when I focus the window etc.

* {
display: expression((this.repeat=="template")?"none":this.display);
chicken: expression(window.status=(globalCount++));

even without the chicken, which is particularly slow, it stil takes a
noticeable delay
> I think that performance only becomes a problem for a large number of
> repeats, say a hundred or so.

in testing (not of a complete implementation or anything, but of the
components involved in doing it) then a regular sized page, with one
repeat element with quite a few elements in it gave what was to me
unacceptable performance.


More information about the whatwg mailing list