Socket
Socket
Sign inDemoInstall

dom-delegate

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-delegate - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

2

build/dom-delegate.js

@@ -99,3 +99,3 @@ (function(e){if("function"==typeof bootstrap)bootstrap("delegate",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeDelegate=e}else"undefined"!=typeof window?window.Delegate=e():global.Delegate=e()})(function(){var define,ses,bootstrap,module,exports;

Delegate.prototype.captureForType = function(eventType) {
return eventType === 'error';
return ['error', 'blur', 'focus'].indexOf(eventType) !== -1;
};

@@ -102,0 +102,0 @@

@@ -1,1 +0,1 @@

(function(e){if("function"==typeof bootstrap)bootstrap("delegate",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeDelegate=e}else"undefined"!=typeof window?window.Delegate=e():global.Delegate=e()})(function(){return function(e,t,r){function n(r,i){if(!t[r]){if(!e[r]){var s="function"==typeof require&&require;if(!i&&s)return s(r,!0);if(o)return o(r,!0);throw Error("Cannot find module '"+r+"'")}var a=t[r]={exports:{}};e[r][0].call(a.exports,function(t){var o=e[r][1][t];return n(o?o:t)},a,a.exports)}return t[r].exports}for(var o="function"==typeof require&&require,i=0;r.length>i;i++)n(r[i]);return n}({1:[function(e,t){"use strict";function r(e){e&&this.root(e),this.listenerMap={},this.handle=r.prototype.handle.bind(this)}t.exports=r,r.tagsCaseSensitive=null,r.prototype.root=function(e){var t,r=this.listenerMap;if("string"==typeof e&&(e=document.querySelector(e)),this.rootElement)for(t in r)r.hasOwnProperty(t)&&this.rootElement.removeEventListener(t,this.handle,this.captureForType(t));if(!e||!e.addEventListener)return this.rootElement&&delete this.rootElement,this;this.rootElement=e;for(t in r)r.hasOwnProperty(t)&&this.rootElement.addEventListener(t,this.handle,this.captureForType(t));return this},r.prototype.captureForType=function(e){return"error"===e},r.prototype.on=function(e,t,n,o){var i,s,a,l;if(!e)throw new TypeError("Invalid event type: "+e);if("function"==typeof t&&(n=t,t=null,o=n),void 0===o&&(o=null),"function"!=typeof n)throw new TypeError("Handler must be a type of Function");return i=this.rootElement,s=this.listenerMap,s[e]||(i&&i.addEventListener(e,this.handle,this.captureForType(e)),s[e]=[]),t?/^[a-z]+$/i.test(t)?(null===r.tagsCaseSensitive&&(r.tagsCaseSensitive="i"===document.createElement("i").tagName),l=r.tagsCaseSensitive?t:t.toUpperCase(),a=this.matchesTag):/^#[a-z0-9\-_]+$/i.test(t)?(l=t.slice(1),a=this.matchesId):(l=t,a=this.matches):(l=null,a=this.matchesRoot.bind(this)),s[e].push({selector:t,eventData:o,handler:n,matcher:a,matcherParam:l}),this},r.prototype.off=function(e,t,r){var n,o,i,s,a;if("function"==typeof t&&(r=t,t=null),i=this.listenerMap,!e){for(a in i)i.hasOwnProperty(a)&&this.off(a,t,r);return this}if(s=i[e],!s||!s.length)return this;for(n=s.length-1;n>=0;n--)o=s[n],t&&t!==o.selector||r&&r!==o.handler||s.splice(n,1);return s.length||(delete i[e],this.rootElement&&this.rootElement.removeEventListener(e,this.handle,this.captureForType(e))),this},r.prototype.handle=function(e){var t,r,n,o,i,s,a,l="ftLabsDelegateIgnore";if(e[l]!==!0)for(a=e.target,a.nodeType===Node.TEXT_NODE&&(a=a.parentNode),n=this.rootElement,s=this.listenerMap[e.type],r=s.length;a&&r;){for(t=0;r>t&&(o=s[t],o);t++)if(o.matcher.call(a,o.matcherParam,a)&&(i=this.fire(e,a,o)),i===!1)return e[l]=!0,void 0;if(a===n)break;r=s.length,a=a.parentElement}},r.prototype.fire=function(e,t,r){var n,o;return null!==r.eventData?(o=e.data,e.data=r.eventData,n=r.handler.call(t,e,t),e.data=o):n=r.handler.call(t,e,t),n},r.prototype.matches=function(e){if(e){var t=e.prototype;return t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector}}(HTMLElement),r.prototype.matchesTag=function(e,t){return e===t.tagName},r.prototype.matchesRoot=function(e,t){return this.rootElement===t},r.prototype.matchesId=function(e,t){return e===t.id},r.prototype.destroy=function(){this.off(),this.root()}},{}]},{},[1])(1)});
(function(e){if("function"==typeof bootstrap)bootstrap("delegate",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeDelegate=e}else"undefined"!=typeof window?window.Delegate=e():global.Delegate=e()})(function(){return function(e,t,r){function n(r,i){if(!t[r]){if(!e[r]){var s="function"==typeof require&&require;if(!i&&s)return s(r,!0);if(o)return o(r,!0);throw Error("Cannot find module '"+r+"'")}var a=t[r]={exports:{}};e[r][0].call(a.exports,function(t){var o=e[r][1][t];return n(o?o:t)},a,a.exports)}return t[r].exports}for(var o="function"==typeof require&&require,i=0;r.length>i;i++)n(r[i]);return n}({1:[function(e,t){"use strict";function r(e){e&&this.root(e),this.listenerMap={},this.handle=r.prototype.handle.bind(this)}t.exports=r,r.tagsCaseSensitive=null,r.prototype.root=function(e){var t,r=this.listenerMap;if("string"==typeof e&&(e=document.querySelector(e)),this.rootElement)for(t in r)r.hasOwnProperty(t)&&this.rootElement.removeEventListener(t,this.handle,this.captureForType(t));if(!e||!e.addEventListener)return this.rootElement&&delete this.rootElement,this;this.rootElement=e;for(t in r)r.hasOwnProperty(t)&&this.rootElement.addEventListener(t,this.handle,this.captureForType(t));return this},r.prototype.captureForType=function(e){return-1!==["error","blur","focus"].indexOf(e)},r.prototype.on=function(e,t,n,o){var i,s,a,l;if(!e)throw new TypeError("Invalid event type: "+e);if("function"==typeof t&&(n=t,t=null,o=n),void 0===o&&(o=null),"function"!=typeof n)throw new TypeError("Handler must be a type of Function");return i=this.rootElement,s=this.listenerMap,s[e]||(i&&i.addEventListener(e,this.handle,this.captureForType(e)),s[e]=[]),t?/^[a-z]+$/i.test(t)?(null===r.tagsCaseSensitive&&(r.tagsCaseSensitive="i"===document.createElement("i").tagName),l=r.tagsCaseSensitive?t:t.toUpperCase(),a=this.matchesTag):/^#[a-z0-9\-_]+$/i.test(t)?(l=t.slice(1),a=this.matchesId):(l=t,a=this.matches):(l=null,a=this.matchesRoot.bind(this)),s[e].push({selector:t,eventData:o,handler:n,matcher:a,matcherParam:l}),this},r.prototype.off=function(e,t,r){var n,o,i,s,a;if("function"==typeof t&&(r=t,t=null),i=this.listenerMap,!e){for(a in i)i.hasOwnProperty(a)&&this.off(a,t,r);return this}if(s=i[e],!s||!s.length)return this;for(n=s.length-1;n>=0;n--)o=s[n],t&&t!==o.selector||r&&r!==o.handler||s.splice(n,1);return s.length||(delete i[e],this.rootElement&&this.rootElement.removeEventListener(e,this.handle,this.captureForType(e))),this},r.prototype.handle=function(e){var t,r,n,o,i,s,a,l="ftLabsDelegateIgnore";if(e[l]!==!0)for(a=e.target,a.nodeType===Node.TEXT_NODE&&(a=a.parentNode),n=this.rootElement,s=this.listenerMap[e.type],r=s.length;a&&r;){for(t=0;r>t&&(o=s[t],o);t++)if(o.matcher.call(a,o.matcherParam,a)&&(i=this.fire(e,a,o)),i===!1)return e[l]=!0,void 0;if(a===n)break;r=s.length,a=a.parentElement}},r.prototype.fire=function(e,t,r){var n,o;return null!==r.eventData?(o=e.data,e.data=r.eventData,n=r.handler.call(t,e,t),e.data=o):n=r.handler.call(t,e,t),n},r.prototype.matches=function(e){if(e){var t=e.prototype;return t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector}}(HTMLElement),r.prototype.matchesTag=function(e,t){return e===t.tagName},r.prototype.matchesRoot=function(e,t){return this.rootElement===t},r.prototype.matchesId=function(e,t){return e===t.id},r.prototype.destroy=function(){this.off(),this.root()}},{}]},{},[1])(1)});

@@ -97,3 +97,3 @@ /*jshint browser:true, node:true*/

Delegate.prototype.captureForType = function(eventType) {
return eventType === 'error';
return ['error', 'blur', 'focus'].indexOf(eventType) !== -1;
};

@@ -100,0 +100,0 @@

{
"name": "dom-delegate",
"version": "0.3.2",
"version": "0.4.0",
"author": "FT Labs <enquiries@labs.ft.com> (http://labs.ft.com/)",

@@ -33,6 +33,8 @@ "description": "Create and manage a DOM event delegator.",

"grunt-browserify": "1.0.2",
"grunt-contrib-uglify": "~0.1.2"
"grunt-contrib-uglify": "~0.1.2",
"istanbul": "*",
"buster-istanbul": "*"
},
"license": "MIT",
"homepage": "https://github.com/ftlabs/dom-delegate"
"homepage": "https://github.com/ftlabs/ftdomdelegate"
}

@@ -47,7 +47,7 @@ # ftdomdelegate [![Build Status](https://travis-ci.org/ftlabs/ftdomdelegate.png?branch=master)](https://travis-ci.org/ftlabs/ftdomdelegate)

function handleButtonClicks(event) {
// do some things
// Do some things
}
function handleTouchMove(event) {
// do some other things
// Do some other things
}

@@ -97,3 +97,3 @@

...then point your browser to http://localhost:8282/. To generate code coverage reports, for which [buster-coverage](https://github.com/ebi/buster-coverage) is required:
...then point your browser to http://localhost:8282/.

@@ -111,3 +111,3 @@ ```

The report in `build/logs/jscoverage/` can be processed using `genhtml`, which is installed with `lcov`.
Code coverage is generated automatically with [istanbul](https://github.com/gotwarlost/istanbul). The report outputs to `lcov-report/index.html`.

@@ -166,2 +166,2 @@ ## API ##

The developers of Delegate are [Matthew Andrews](https://twitter.com/andrewsmatt) and [Matthew Caruana Galizia](http://twitter.com/mcaruanagalizia). Test engineering by [Sam Giles](https://twitter.com/SamuelGiles_). The API is influenced by [jQuery Live](http://api.jquery.com/live/). All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request. Enjoy.
The developers of ftdomdelegate are [Matthew Andrews](https://twitter.com/andrewsmatt) and [Matthew Caruana Galizia](http://twitter.com/mcaruanagalizia). Test engineering by [Sam Giles](https://twitter.com/SamuelGiles_). The API is influenced by [jQuery Live](http://api.jquery.com/live/). All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request. Enjoy.

Sorry, the diff of this file is not supported yet

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