dom-listener
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -77,10 +77,20 @@ (function() { | ||
DOMListener.prototype.dispatchEvent = function(event) { | ||
var currentTarget, handler, immediatePropagationStopped, inlineListeners, listener, propagationStopped, selectorBasedListeners, syntheticEvent, _i, _j, _len, _len1, _ref, _results; | ||
var currentTarget, defaultPrevented, handler, immediatePropagationStopped, inlineListeners, key, listener, propagationStopped, selectorBasedListeners, syntheticEvent, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _results; | ||
currentTarget = event.target; | ||
propagationStopped = false; | ||
immediatePropagationStopped = false; | ||
syntheticEvent = Object.create(event, { | ||
defaultPrevented = false; | ||
syntheticEvent = Object.create(event.constructor.prototype, { | ||
type: { | ||
value: event.type | ||
}, | ||
detail: { | ||
value: event.detail | ||
}, | ||
eventPhase: { | ||
value: Event.BUBBLING_PHASE | ||
}, | ||
target: { | ||
value: currentTarget | ||
}, | ||
currentTarget: { | ||
@@ -103,10 +113,28 @@ get: function() { | ||
} | ||
}, | ||
preventDefault: { | ||
value: function() { | ||
defaultPrevented = true; | ||
return event.preventDefault(); | ||
} | ||
}, | ||
defaultPrevented: { | ||
get: function() { | ||
return defaultPrevented; | ||
} | ||
} | ||
}); | ||
_ref = Object.keys(event); | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
key = _ref[_i]; | ||
if (syntheticEvent[key] == null) { | ||
syntheticEvent[key] = event[key]; | ||
} | ||
} | ||
_results = []; | ||
while (true) { | ||
inlineListeners = (_ref = this.inlineListenersByEventName[event.type]) != null ? _ref.get(currentTarget) : void 0; | ||
inlineListeners = (_ref1 = this.inlineListenersByEventName[event.type]) != null ? _ref1.get(currentTarget) : void 0; | ||
if (inlineListeners != null) { | ||
for (_i = 0, _len = inlineListeners.length; _i < _len; _i++) { | ||
handler = inlineListeners[_i]; | ||
for (_j = 0, _len1 = inlineListeners.length; _j < _len1; _j++) { | ||
handler = inlineListeners[_j]; | ||
handler.call(currentTarget, syntheticEvent); | ||
@@ -123,4 +151,4 @@ if (immediatePropagationStopped) { | ||
if ((selectorBasedListeners != null) && typeof currentTarget.matches === 'function') { | ||
for (_j = 0, _len1 = selectorBasedListeners.length; _j < _len1; _j++) { | ||
listener = selectorBasedListeners[_j]; | ||
for (_k = 0, _len2 = selectorBasedListeners.length; _k < _len2; _k++) { | ||
listener = selectorBasedListeners[_k]; | ||
if (!(currentTarget.matches(listener.selector))) { | ||
@@ -127,0 +155,0 @@ continue; |
{ | ||
"name": "dom-listener", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A listener for delegated DOM events.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/dom-listener", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11054
171