Unbreak accidental back-compat break with event optimization (#2222)

This was supposed to be purely additive. See here for more details:

https://github.com/MithrilJS/mithril.js/pull/1949#issuecomment-417824513
This commit is contained in:
Isiah Meadows 2018-09-18 10:14:21 -04:00 committed by GitHub
parent f4ddcc4b24
commit c703b03253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 80 additions and 11 deletions

View file

@ -364,10 +364,18 @@ module.exports = function(options) {
e.preventDefault = function() {
prevented = true
}
Object.defineProperty(e, "$defaultPrevented", {
configurable: true,
get: function () { return prevented }
})
var stopped = false
e.stopPropagation = function() {
stopped = true
}
Object.defineProperty(e, "$propagationStopped", {
configurable: true,
get: function () { return prevented }
})
e.eventPhase = 1
try {
for (var i = parents.length - 1; 0 <= i; i--) {