[whatwg] Repetition Model (was: WF2 changes: uri->url, ERROR_* constants dropped; status update)
Dean Edwards
dean at edwards.name
Wed Mar 23 11:39:35 PST 2005
Jim Ley wrote:
> On Wed, 23 Mar 2005 17:32:28 +0000, Dean Edwards <dean at edwards.name> wrote:
>
>>I like the repetition model but maybe it needs more work. But not much
>>more. I feel we are very close to a simple yet useful mechanism. If we
>>did separate it into a separate module then we would have time to tweak
>>it...
>
>
> My current view, which I've not had time to fully write up yet, is
> that the repetition model proposed is effectively unimplementable in
> IE in an efficient manner.
>
> 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. Another
alternative is to require the author to attach the repetition interface.
Not that big a deal really...
Your point about substitution is valid for a large amount of repeats.
This is something that maybe needs more discussion. One alternative to
looping over all attributes is to use "outerHTML" and a RegExp.
> I think whilst it's a good generic solution, implementing it in script
> for a specific solution gives such a large performance improvement
> that the IE script emulation approach will be impractical.
>
I think that performance only becomes a problem for a large number of
repeats, say a hundred or so.
-dean
More information about the whatwg
mailing list