Skip to content

Commit

Permalink
add within-document dep
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 13, 2012
1 parent 521c488 commit c266063
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
4 changes: 3 additions & 1 deletion component.json
Expand Up @@ -4,7 +4,9 @@
"description": "invoke a callback when a DOM element is removed",
"version": "0.0.1",
"keywords": ["dom", "event"],
"dependencies": {},
"dependencies": {
"component/within-document": "*"
},
"development": {},
"scripts": [
"index.js"
Expand Down
22 changes: 6 additions & 16 deletions index.js
@@ -1,4 +1,10 @@

/**
* Module dependencies.
*/

var withinDocument = require('within-document');

/**
* Expose `removed`.
*/
Expand Down Expand Up @@ -38,19 +44,3 @@ function interval(el, fn) {
fn(el);
}, exports.interval);
}

/**
* Check if `el` is within the document.
*
* @param {Element} el
* @return {Boolean}
* @api private
*/

function withinDocument(el) {
var node = el;
while (node = node.parentNode) {
if (node == document) return true;
}
return false;
}
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -4,7 +4,9 @@
"description": "invoke a callback when a DOM element is removed",
"version": "0.0.1",
"keywords": ["dom", "event"],
"dependencies": {},
"dependencies": {
"within-document": "*"
},
"development": {},
"component": {
"scripts": {
Expand Down

0 comments on commit c266063

Please sign in to comment.