Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement isDefaultPrevented event method for AngularJS compatibility #864

Closed
wants to merge 1 commit into from

Conversation

metrofun
Copy link

AngularJS relies on a proprietary method - isDefaultPrevented, so how about implementing this method?
It costs only 3 additional lines =)

@mislav
Copy link
Collaborator

mislav commented Nov 28, 2013

Hmm not sure. This entails calling fix() for every event handler invocation. A little expensive?

@metrofun
Copy link
Author

Well, right. But how about smth like this?

Event.prototype.isDefaultPrevented = function(){ return this.defaultPrevented };

It solves the issue with Angular and costs only one extra line. On the other hand it works only for Chrome 18+, Firefox 6+.

@mislav
Copy link
Collaborator

mislav commented Nov 29, 2013

We now support IE 10 so any code that we add should be supported in all browsers.

@metrofun
Copy link
Author

I've just checked it in IE10 and fortunately it works.
Also seems like a "defaultPrevented" property is supported in all modern desktop browsers http://docs.webplatform.org/wiki/dom/properties/defaultPrevented .
Not sure about mobile ones.

mislav added a commit that referenced this pull request Dec 1, 2013
Previously, these methods were only available in event delegation handlers:
- isDefaultPrevented
- isPropagationStopped
- isImmediatePropagationStopped

For compatibility with jQuery and for avoiding cross-browser differences,
now every event is extended with these methods before it's passed to an
event handler.

Alt. for #864
@mislav mislav closed this in 8d6dd61 Dec 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants