[whatwg] repetition model
ian at hixie.ch
Fri Jun 25 09:45:54 PDT 2004
On Thu, 24 Jun 2004, Avi Bryant wrote:
> [...] Copying template pieces of DOM doesn't bother me in the slightest,
> but the [id] text replacement rings serious alarm bells.
I do agree that the [id] stuff is somewhat dodgy. I really am at a loss of
how to do a better solution, though. And it does work quite well.
> Effectively you're upping the meta level: parts of the document are no
> longer HTML, but a description of how to produce HTML.
HTML4 already has this (<object declare>).
> Attributes that were previously treated as opaque atomic strings now
> have to be parsed. That means you have to deal with escaping issues,
> and the complexity bleeds all over the place (prefixing attributes with
> ? Come on...).
I agree that the -prefix hack is a hack. Do you have a better solution?
> It's treading a fine line between markup and behavior (can we show that
> the repetition model is turing complete?), and I'd rather see anything
> that even approaches that line be in Ecmascript instead.
As someone who has implemented his own repeating model, both client-side
and server-side, I have to say, the proposed model is a lot easier to use
than any hand-implemented version.
> However, I think the model could still work fine without the macro
> expansion. The main use case seems to be to give unique name attributes
> to each set of inputs. If your server is handling the submission
> correctly, this shouldn't be necessary anyway: the values get submitted
> in order anyway, so the values from each row should be grouped, right?
> The numbers are redundant.
This is an interesting point. It means that if the author doesn't want any
of the [id] nonsense, he need simply not put an ID on the template, and
then that entire part of the model is simply ignored.
Given that, to the author, the complexity here is basically "opt-in", I am
not convinced that it removing it altogether is the way forward. There are
cases where having uniquely numbered rows really helps with the
server-side processing (for example, some CGI libraries merge all the
values with the same name into one array, keeping the relative order
between individual control names, but losing the overall order that the
names came in). This is especially important with nested repeats, where
the "add" button has to refer to a template that has been repeated.
Templates are identified by IDs, so you need a unique ID for each repeated
template. (There's an example of this in the spec.)
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg