Object iteration order

Andrea Giammarchi andrea.giammarchi at gmail.com
Mon Jan 7 11:12:21 PST 2013

why is iteration order important here? the event notification order is
where mousedown will always be called before click, am I missing something?
Anyway, this is same discussion we are having in another thread where
concerns are:
  1. where is the bubbling/capturing flag ?
  2. is that object.handleEvent ready ?
  3. will be event.off() the counter part ?

Last, from my POV, what is wrong with this suggestion ?

Element.prototype.on = function on(type, handler, capture) {
  // either this.addEventListener(type, handler, !!capture);
  // or ...
    i = 0,
    c = !!capture,
    t = [].concat(type),
    h = [].concat(handler);
    i < t.length; i++
  ) this.addEventListener(t[i], i in h ? h[i] : handler, c);

  return this;

You have granted order too ...

element.on(["click", "resize"], [callback1, calback2]);


element.on(["click", "resize"], sameHandler);


  .on("click", cb1)
  .on("resize", cb2)


On Mon, Jan 7, 2013 at 5:25 AM, Anne van Kesteren <annevk at annevk.nl> wrote:

> In "DOM-land" we're designing new APIs that take objects as arguments.
> Unless objects meet the criteria in
> https://mail.mozilla.org/pipermail/es-discuss/2010-December/012469.html
> invocation of the API method might result in implementation-specific
> behavior. See also
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=20158
> Given the convenience of being able to do something like
>   element.on({click: callback1, resize: callback2})
> we're probably going to run with it, but I thought I'd give a heads
> up. Maybe someone here has a better idea or maybe iteration order will
> finally be settled on? :-)
> --
> http://annevankesteren.nl/
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130107/352a6f7e/attachment-0001.html>

More information about the es-discuss mailing list