W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2004

[whatwg] output element event scope

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 14 Dec 2004 08:38:12 +0000 (UTC)
Message-ID: <Pine.LNX.4.61.0412140833270.19348@dhalsim.dreamhost.com>
On Tue, 14 Dec 2004, Brad Fults wrote:
>
> In the Web Forms 2.0 CFC[1] there is the following example:
> 
> <form>
>  <p>
>   <input name="a" type="number" step="any" value="0"> *
>   <input name="b" type="number" step="any" value="0"> =
>   <output name="result" onforminput="value = a.value * b.value">0</output>
>  </p>
> </form>
> 
> I understand the aim of the simplified code, but this goes completely
> against current pracitces as far as scope. Currently the onforminput
> event handler is in the global (default) scope and so will look for
> objects in that scope. There will be no objects named 'a' or 'b' and
> 'value' would refer to window.value.

That isn't actually true. That code works. Try it (first changing the 
event handler to something that exists, of course, like onclick):

   http://junkyard.damowmow.com/169

See also the third paragraph of 8.1. Event listeners in the Web Apps 
draft, which defines why it works:

   http://whatwg.org/specs/web-apps/current-work/#event

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 14 December 2004 00:38:12 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:38 UTC