Re: Form submission participation (was Re: Goals for Shadow DOM review)

On Feb 21, 2014, at 2:28 PM, Ian Hickson <ian@hixie.ch> wrote:

> On Fri, 21 Feb 2014, Maciej Stachowiak wrote:
>> 
>> I'd guess most sophisticated webapps do not use attribute-based event 
>> handlers (as opposed to addEventListener), so they would not get this 
>> convenient scoping benefit.
> 
> That's not clear to me. I mean, certainly today, with div soup, they 
> don't. But that's at least partly because there's no sane way to do it 
> when your markup isn't really declarative in any useful sense.
> 
> When you have Web components that let you get the effect you want while 
> sticking to a terse markup language, it becomes much more feasible to 
> return to using inline event handlers.

Might be, but I'm not sure you can center a design on a hypothetical future change in web developer behavior.

> 
>> If you're looking at an out-of-line function, then your comparison is:
>> 
>> this.a.value = process(value)
>> this.querySelector("#a").value = process(value)
>> 
>> which is a less dramatic difference.
> 
> It's a pretty compelling difference, IMHO.
> 
> 
>> Also, the short version gives you the risk of namespace conflicts with 
>> the built-in methods and properties of form.
> 
> You can do this instead if that feels like a real risk:
> 
>  this.elements.a.value = process(value)

Which is hardly an upgrade at all over:
this.querySelector("#a").value = process(value)

Cheers,
Maciej

Received on Saturday, 22 February 2014 00:38:47 UTC