Comparing version 1.1.0 to 1.2.0
@@ -6,5 +6,8 @@ import inViewport from './src/dimension/in-viewport'; | ||
import activeElement from './src/element/active-element'; | ||
import create from './src/element/create'; | ||
import {addClass, hasClass, removeClass} from './src/element/class'; | ||
import data from './src/element/data'; | ||
import focus from './src/element/focus'; | ||
import parents from './src/element/parents'; | ||
@@ -29,2 +32,3 @@ import delegate from './src/event/delegate'; | ||
// Element | ||
activeElement, | ||
create, | ||
@@ -35,2 +39,4 @@ addClass, | ||
data, | ||
focus, | ||
parents, | ||
@@ -37,0 +43,0 @@ // Event |
{ | ||
"name": "domestique", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A modular DOM helper library.", | ||
@@ -40,5 +40,13 @@ "repository": "https://github.com/jsor/domestique.git", | ||
"ignores": [ | ||
"test/**", | ||
"karma*" | ||
"karma.conf.js" | ||
], | ||
"globals": [ | ||
"after", | ||
"afterEach", | ||
"assert", | ||
"before", | ||
"beforeEach", | ||
"describe", | ||
"it" | ||
], | ||
"envs": [ | ||
@@ -45,0 +53,0 @@ "node", |
@@ -48,2 +48,3 @@ Domestique | ||
// Element | ||
activeElement, | ||
create, | ||
@@ -54,2 +55,4 @@ addClass, | ||
data, | ||
focus, | ||
parents, | ||
@@ -79,2 +82,3 @@ // Event | ||
* [Element](#element) | ||
* [activeElement()](#activeelement) | ||
* [create()](#create) | ||
@@ -85,2 +89,4 @@ * [addClass()](#addclass) | ||
* [data()](#data) | ||
* [focus()](#focus) | ||
* [parents()](#parents) | ||
* [Event](#event) | ||
@@ -165,2 +171,16 @@ * [ready()](#ready) | ||
#### activeElement() | ||
``` | ||
activeElement(): Element | ||
``` | ||
Returns the element that currently has focus. | ||
##### Example | ||
```javascript | ||
const element = activeElement(); | ||
``` | ||
#### create() | ||
@@ -260,2 +280,42 @@ | ||
#### focus() | ||
``` | ||
focus(element: Element[, options: object]): void | ||
``` | ||
Shifts focus to an element. | ||
##### Example | ||
```javascript | ||
focus(element); | ||
``` | ||
Browsers scroll the focused element into view. `focus()` provides an option | ||
`restoreScrollPosition` to restore scroll positions of all scroll containers of | ||
the focused element to the state before the element got focus. | ||
##### Example | ||
```javascript | ||
focus(element, { | ||
restoreScrollPosition: true | ||
}); | ||
``` | ||
#### parents() | ||
``` | ||
parents(element: Element): Array | ||
``` | ||
Returns an array of the element's parent elements. | ||
##### Example | ||
```javascript | ||
const parentElements = parents(element); | ||
``` | ||
### Event | ||
@@ -262,0 +322,0 @@ |
@@ -16,3 +16,3 @@ export default function dispatch(target, type, eventInit = {}) { | ||
} catch (err) { | ||
event = document.createEvent('Event'); | ||
event = document.createEvent('CustomEvent'); | ||
event.initCustomEvent( | ||
@@ -19,0 +19,0 @@ type, |
@@ -5,3 +5,3 @@ import optionsArgument from './options-argument'; | ||
if (!target || typeof target.removeEventListener !== 'function') { | ||
return () => {}; | ||
return; | ||
} | ||
@@ -8,0 +8,0 @@ |
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
24752
25
411
516