[whatwg] onchange attribute on output elements?

Ian Hickson ian at hixie.ch
Sun Jun 13 14:06:05 PDT 2004

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

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

More information about the whatwg mailing list