[whatwg] onchange attribute on output elements?
Johnny Stenback
jst at mozilla.org
Tue Jun 15 11:19:08 PDT 2004
Ian Hickson wrote:
> On Thu, 10 Jun 2004, Johnny Stenback wrote:
>
>>There's no onchange attribute on output elements, in stead the spec
>>tells you to use DOM mutation events. Thsoe are a pain to use, and
>>there's no declarative way to register handlers (in HTML at least). Why
>>not support what developers are used to when dealing with form controls,
>>onchange="..."?
>
>
> Ok, added, but this scares me a little. Any author who puts a
> non-deterministic value change in the <output> element's "onformchange"
> attribute will cause an infinite loop:
>
> <script> var x = 0; </script>
> There have been <output onformchange="value = ++x">0</value> changes.
>
> The moment you touch the form, the script will start an infinite loop. And
> this is even a quite reasonable thing to do, IMHO.
>
> (The "change" event's default action is to fire "formchange" on every
> control in the form.)
>
> Any ideas for getting around this cleanly? (i.e. without saying "output"'s
> "change" event is an exception.)
Nothing comes to mind right now. But this is a problem that should be
solved in the spec regardless of how event handlers are registerd on
output controls. You'll have the exact same problem if you're using
mutation events on the output element.
--
jst
More information about the whatwg
mailing list