Comparing version 0.10.1 to 0.10.2
{ | ||
"name": "dombili", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "dombili is a light, zero-dependency wrapper around modern browser APIs.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,8 +28,2 @@ ## About `dombili` | ||
## Byte-Sized What?! | ||
[Byte-Sized JavaScript][vidcast]. | ||
It is a compilation of short monthly screencasts about **JavaScript** and related technologies. | ||
## Alpha-Stage Software Warning | ||
@@ -36,0 +30,0 @@ |
@@ -16,2 +16,5 @@ /* |\__.__/| | ||
import { $ } from './query'; | ||
/** | ||
@@ -34,2 +37,8 @@ * Wraps the element `el` into the wrapping element `wrapper`. | ||
const wrap = ( el, wrapper ) => { | ||
if ( typeof el === 'string' ) { | ||
wrap( $( el ), wrapper ); | ||
return; | ||
} | ||
if ( !el ) { return; } | ||
@@ -59,2 +68,8 @@ if ( !wrapper ) { return; } | ||
const unwrap = ( el ) => { | ||
if ( typeof el === 'string' ) { | ||
unwrap( $( el ) ); | ||
return; | ||
} | ||
if ( !el ) { return; } | ||
@@ -61,0 +76,0 @@ |
@@ -32,3 +32,3 @@ /* |\__.__/| | ||
* @param {Element} el The DOM element to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the nodes. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -72,3 +72,3 @@ * | ||
* @param {Element} el The DOM element to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the nodes. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -117,3 +117,3 @@ * | ||
* @param {Element} el The DOM element to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the nodes. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -151,3 +151,3 @@ * | ||
* @param {Element} el The DOM element to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the nodes. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -185,3 +185,3 @@ * | ||
* @param {Element} el The DOM element to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the nodes. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -217,3 +217,3 @@ * | ||
* @param {Element} el The DOM element to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the nodes. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -256,3 +256,3 @@ * | ||
* @param {Element} el The **DOM** `Element` to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the nodes. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -295,3 +295,3 @@ * | ||
* @param {Element} el The **DOM** `Element` to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the node. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -322,3 +322,3 @@ * | ||
* @param {Element} el The **DOM** `Element` to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the node. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -349,3 +349,3 @@ * | ||
* @param {Element} el The **DOM** `Element` to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the node. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -376,3 +376,3 @@ * | ||
* @param {Element} el The **DOM** `Element` to find the siblings of. | ||
* @param {any} [filter=returnTrue] A predicate to filter the node. | ||
* @param {function(*)} [filter=returnTrue] A predicate to filter the nodes. | ||
* If not given, defaults to a function that returns true. | ||
@@ -379,0 +379,0 @@ * |
@@ -29,2 +29,3 @@ /* |\__.__/| | ||
if ( !document.querySelectorAll ) { return null; } | ||
if ( typeof selector !== 'string' ) { return selector; } | ||
@@ -47,2 +48,3 @@ return document.querySelectorAll( `${selector}` ); | ||
if ( !document.querySelector ) { return null; } | ||
if ( typeof selector !== 'string' ) { return selector; } | ||
@@ -102,2 +104,6 @@ return document.querySelector( `${selector}` ); | ||
const matches = ( el, selector ) => { | ||
if ( typeof el === 'string' ) { | ||
return matches( $( el ), selector ); | ||
} | ||
if ( !el ) { return false; } | ||
@@ -124,2 +130,6 @@ if ( !el.matches ) { return false; } | ||
const parent = ( el ) => { | ||
if ( typeof el === 'string' ) { | ||
return parent( $( el ) ); | ||
} | ||
if ( !el ) { return null; } | ||
@@ -148,2 +158,6 @@ if ( !el.parentNode ) { return null; } | ||
const closest = ( el, selector ) => { | ||
if ( typeof el === 'string' ) { | ||
return closest( $( el ) ); | ||
} | ||
if ( !el ) { return null; } | ||
@@ -150,0 +164,0 @@ if ( !selector ) { return el.parentNode ? el.parentNode : null; } |
84809
31
1737
238