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

[whatwg] output element event scope

From: Brad Fults <bfults@gmail.com>
Date: Tue, 14 Dec 2004 00:16:06 -0800
Message-ID: <1959130b04121400167495bb49@mail.gmail.com>
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.

I propose that this code be changed to reflect what is currently
supported and practiced, as I don't see adequate benefit coming from
such a radical change of scope behavior.

If this were to be implemented with current methods, it would read,

onforminput="this.value = this.form.elements.a.value *
this.form.elements.b.value"

--
Brad Fults
NeatBox
Received on Tuesday, 14 December 2004 00:16:06 UTC

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