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

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.



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

...but in practice I think it's a pretty minimal risk.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 21 February 2014 22:28:59 UTC