ftdomdelegate
Advanced tools
Comparing version 4.0.6 to 5.0.0-0
{ | ||
"description": "FT's dom delegate library is a component for creating and binding to events on all target elements matching the given selector. ", | ||
"keywords": ["events", "DOM", "listener" ], | ||
"origamiType": "module", | ||
"origamiCategory": "utilities", | ||
"origamiVersion": 1, | ||
"origamiType": "library", | ||
"origamiVersion": "2.0", | ||
"support": "https://github.com/Financial-Times/ftdomdelegate/issues", | ||
@@ -8,0 +5,0 @@ "supportStatus": "maintained", |
{ | ||
"browser": "browser.js", | ||
"files": [ | ||
"svg/", | ||
"dist/", | ||
"browser.js", | ||
"src/", | ||
"!src/**/*.js", | ||
"main.scss", | ||
"img", | ||
"*.json", | ||
"*.js", | ||
"!main.js", | ||
"scss", | ||
"!bower.json", | ||
"!.bower.json" | ||
], | ||
"eslintIgnore": [ | ||
"browser.js", | ||
"dist/" | ||
], | ||
"keywords": [ | ||
"origami", | ||
"component", | ||
"ft" | ||
], | ||
"name": "ftdomdelegate", | ||
"version": "4.0.6", | ||
"description": "Create and manage a DOM event delegator.", | ||
"dependencies": {}, | ||
"component": "ftdomdelegate", | ||
"license": "MIT", | ||
"scripts": {}, | ||
"devDependencies": { | ||
"eslint-config-origami-component": "^2.0.1", | ||
"origami-ci-tools": "^2.0.2" | ||
} | ||
"name": "ftdomdelegate", | ||
"description": "FT's dom delegate library is a library for creating and binding to events on all target elements matching the given selector.", | ||
"browser": "main.js", | ||
"author": "FT Labs <enquiries@labs.ft.com> (http://labs.ft.com/)", | ||
"contributors": [ | ||
"Matthew Caruana Galizia", | ||
"Sam Giles", | ||
"Matt Andrews" | ||
], | ||
"keywords": [ | ||
"delegate", | ||
"dom", | ||
"events", | ||
"listener" | ||
], | ||
"license": "MIT", | ||
"devDependencies": { | ||
"eslint": "^7.23.0", | ||
"eslint-config-origami-component": "^2.1.1", | ||
"remark": "^13.0.0", | ||
"remark-lint": "^8.0.0", | ||
"remark-preset-lint-origami-component": "^2.0.0-beta.1" | ||
}, | ||
"version": "5.0.0-0" | ||
} |
@@ -0,5 +1,3 @@ | ||
# ftdomdelegate | ||
ftdomdelegate [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](#licence) | ||
================= | ||
FT's dom delegate library is a component for binding to events on all target elements matching the given selector, irrespective of whether anything exists in the DOM at registration time or not. This allows developers to implement the [event delegation pattern](http://www.sitepoint.com/javascript-event-delegation-is-easier-than-you-think/). | ||
@@ -60,9 +58,9 @@ | ||
### .on(eventType[, selector], handler[, useCapture]) ### | ||
### .on(eventType[, selector], handler[, useCapture]) | ||
#### `eventType (string)` #### | ||
#### `eventType (string)` | ||
The event to listen for e.g. `mousedown`, `mouseup`, `mouseout`, `error`, `click`, etc. | ||
#### `selector (string)` #### | ||
#### `selector (string)` | ||
@@ -73,19 +71,19 @@ Any kind of valid CSS selector supported by [`matchesSelector`](http://caniuse.com/matchesselector). Some selectors, like `#id` or `tag` will use optimized functions internally that check for straight matches between the ID or tag name of elements. | ||
#### `handler (function)` #### | ||
#### `handler (function)` | ||
Function that will handle the specified event on elements matching the given selector. The function will receive two arguments: the native event object and the target element, in that order. | ||
#### `useCapture (boolean)` #### | ||
#### `useCapture (boolean)` | ||
Whether or not to listen during the capturing (pass in `true`) or bubbling phase (pass in `false`). If no value passed in, it will fallback to a 'sensible default', which is `true` for `error`, `blur` and `focus` events and `false` for all other types. | ||
### .off([eventType][, selector][, handler][, useCapture]) ### | ||
### .off([eventType][, selector][, handler][, useCapture]) | ||
Calling `off` with no arguments will remove all registered listeners, effectively resetting the instance. | ||
#### `eventType (string)` #### | ||
#### `eventType (string)` | ||
Remove handlers for events matching this type considering the other parameters. | ||
#### `selector (string)` #### | ||
#### `selector (string)` | ||
@@ -96,21 +94,21 @@ Only remove listeners registered with the given selector, among the other arguments. | ||
#### `handler (function)` #### | ||
#### `handler (function)` | ||
Only remove listeners registered with the given handler function, among the other arguments. If not provided, remove all handlers. | ||
#### `useCapture (boolean)` #### | ||
#### `useCapture (boolean)` | ||
Only remove listeners with `useCapture` set to the value passed in. If not provided, remove listeners added with `useCapture` set to `true` and `false`. | ||
### .root([element]) ### | ||
### .root([element]) | ||
#### `element (Node)` #### | ||
#### `element (Node)` | ||
Set the delegate's root node. If no element passed in the root node will be deleted and the event listeners will be removed. | ||
### .destroy() ### | ||
### .destroy() | ||
Short hand for off() and root(), ie both with no parameters. Used to reset the delegate object. | ||
## Credits and collaboration ## | ||
## Credits and collaboration | ||
@@ -127,2 +125,1 @@ FT DOM Delegate was developed by [FT Labs](http://labs.ft.com/), part of the Financial Times. It's now maintained by the [Origami Team](https://origami.ft.com/). The developers of ftdomdelegate were [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/). | ||
╳ deprecated | 1 | 1.0 | N/A | | ||
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
49487
21
1075
1
5
2
122
1