Skip to content

Commit 917d5a7

Browse files
KocalHaroenv
authored andcommitted
fix(zepto): apply patch to prevent an error (#263)
madrobby/zepto#1319
1 parent b6539d3 commit 917d5a7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

zepto.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* Zepto v1.2.0 - zepto event assets data - zeptojs.com/license */
33
(function(global, factory) {
44
module.exports = factory(global);
5-
}(/* this ##### UPDATED: here we want to use window/global instead of this which is the current file context ##### */ window, function(window) {
5+
}(/* this ##### UPDATED: here we want to use window/global instead of this which is the current file context ##### */ window, function(window) {
66
var Zepto = (function() {
77
var undefined, key, $, classList, emptyArray = [], concat = emptyArray.concat, filter = emptyArray.filter, slice = emptyArray.slice,
88
document = window.document,
@@ -999,7 +999,11 @@
999999
handler.proxy = function(e){
10001000
e = compatible(e)
10011001
if (e.isImmediatePropagationStopped()) return
1002-
e.data = data
1002+
try {
1003+
var dataPropDescriptor = Object.getOwnPropertyDescriptor(e, 'data')
1004+
if (!dataPropDescriptor || dataPropDescriptor.writable)
1005+
e.data = data
1006+
} 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
10031007
var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args))
10041008
if (result === false) e.preventDefault(), e.stopPropagation()
10051009
return result

0 commit comments

Comments
 (0)