Skip to content

Commit

Permalink
fix(zepto): apply patch to prevent an error (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocal authored and Haroenv committed Oct 31, 2018
1 parent b6539d3 commit 917d5a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zepto.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* Zepto v1.2.0 - zepto event assets data - zeptojs.com/license */
(function(global, factory) {
module.exports = factory(global);
}(/* this ##### UPDATED: here we want to use window/global instead of this which is the current file context ##### */ window, function(window) {
}(/* this ##### UPDATED: here we want to use window/global instead of this which is the current file context ##### */ window, function(window) {
var Zepto = (function() {
var undefined, key, $, classList, emptyArray = [], concat = emptyArray.concat, filter = emptyArray.filter, slice = emptyArray.slice,
document = window.document,
Expand Down Expand Up @@ -999,7 +999,11 @@
handler.proxy = function(e){
e = compatible(e)
if (e.isImmediatePropagationStopped()) return
e.data = data
try {
var dataPropDescriptor = Object.getOwnPropertyDescriptor(e, 'data')
if (!dataPropDescriptor || dataPropDescriptor.writable)
e.data = data
} catch (e) {} // when using strict mode dataPropDescriptor will be undefined when e is InputEvent (even though data property exists). So we surround with try/catch
var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args))
if (result === false) e.preventDefault(), e.stopPropagation()
return result
Expand Down

0 comments on commit 917d5a7

Please sign in to comment.