[dojo-contributors] issue with last stopImmediatePropagation patch (#14728)

Bill Keese bill at dojotoolkit.org
Thu Jun 21 18:28:03 EDT 2012


Wow, that's adding a lot of code to work around a theoretical case.
I admit I was surprised by OpenLayers' dodgy behavior of creating a
global object called Event, but I'd be even more surprised if someone
was overriding the definition of window... and while we are talking
about theoretical cases, what if someone overrode the definition of
document.createEvent?   You have to draw the line somewhere.


On Fri, Jun 22, 2012 at 12:46 AM, Bryan Forbes <bryan at reigndropsfall.net> wrote:
> Bill Keese wrote:
>> I'd say you can just check in that fix, it's trivial.
>
> This patch needs some revision. First, we shouldn't be using `window` in
> the first place:
>
> has.add("event-stopimmediatepropogation", window.Event &&
> !!window.Event.prototype.stopImmediatePropagation);
>
> should be
>
> has.add("event-stopimmediatepropogation", typeof Event === "function" &&
> !!Event.prototype.stopImmediatePropagation);
>
>
> Second, we shouldn't be using an inference. We should be testing actual
> event objects:
>
> has.add("event-stopimmediatepropogation", function(global, document){
>        var e;
>        if(document.createEvent){
>                e = document.createEvent("HTMLEvents");
>        }else if(document.createEventObject){
>                e = document.createEventObject();
>        }
>        return e && !!e.stopImmediatePropagation;
> });
>
> This approach avoids the case where libraries create objects that they
> shouldn't be creating.
>
> Third, the name of the original has test is typo'ed: "propogation"
> should be "propagation".
>
>> On Thu, Jun 21, 2012 at 11:14 PM, Patrick Ruzand <pruzand at gmail.com> wrote:
>>> Hello,
>>>
>>> just to let you know that I have marked the #14728  as blocker for
>>> 1.8. The reason is since this patch, the dojox/geo/openlayer module
>>> doesn't work anymore with IE7/8 (see comment 5 in ticket for details).
>>>
>>> If someone could take a look (fix seems very simple btw)
>>>
>>> thanks
>>> --
>>> Patrick
>>> _______________________________________________
>>> dojo-contributors mailing list
>>> dojo-contributors at mail.dojotoolkit.org
>>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
>> _______________________________________________
>> dojo-contributors mailing list
>> dojo-contributors at mail.dojotoolkit.org
>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
>
> --
> Bryan Forbes
> http://www.reigndropsfall.net
>
> GPG Fingerprint
> 3D7D B728 713A BB7B B8B1  5B61 3888 17E0 70CA 0F3D
>
>
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
>


More information about the dojo-contributors mailing list