diff --git a/component.json b/component.json index e508f2c..51c75a6 100644 --- a/component.json +++ b/component.json @@ -1,11 +1,10 @@ { "name": "siblings", "description": "Get the siblings of an element", - "repo": "discore/siblings", - "version": "0.0.2", + "repo": "actano/siblings", + "version": "0.0.3", "dependencies": { - "component/matches-selector": "*", - "discore/children": "*" + "component/matches-selector": "*" }, "main": "index.js", "scripts": [ diff --git a/index.js b/index.js index 98f1a46..ba041dc 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,4 @@ var matches = require('matches-selector') -var getChildren = require('children') module.exports = Siblings @@ -10,6 +9,15 @@ function Siblings(el, selector) { }) } +function getChildren(el, selector) { + if (selector) { + return el.querySelectorAll(selector); + } else { + return el.children; + } + +} + Siblings.next = traverse('next') Siblings.prev = traverse('previous') @@ -40,4 +48,4 @@ function traverse(dir) { return limit === 1 ? siblings.shift() : siblings } -} \ No newline at end of file +}