Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-listener

Package Overview
Dependencies
Maintainers
6
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-listener - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

42

lib/dom-listener.js

@@ -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;

2

package.json
{
"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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc