Skip to content

Commit

Permalink
Remove whitespaces and editor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danilvalov committed Nov 25, 2019
1 parent 9c97b90 commit 83d10fb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 50 deletions.
30 changes: 0 additions & 30 deletions .editorconfig

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.idea
node_modules
example/bundle.js
10 changes: 5 additions & 5 deletions src/getBoundsForNode.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* Given a node, get everything needed to calculate its boundaries
* @param {HTMLElement} node
* @param {HTMLElement} node
* @return {Object}
*/
export default node => {
const rect = node.getBoundingClientRect();

return {
top: rect.top + document.body.scrollTop,
left: rect.left + document.body.scrollLeft,
top: rect.top+document.body.scrollTop,
left: rect.left+document.body.scrollLeft,
offsetWidth: node.offsetWidth,
offsetHeight: node.offsetHeight
};
};
};
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export {
SelectableGroup,
createSelectable,
isNodeIn,
nodeInRoot
};
nodeInRoot,
};
24 changes: 12 additions & 12 deletions src/isNodeIn.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const isNodeIn = (node, predicate) => {
if (typeof predicate !== 'function') {
throw new Error('isNodeIn second parameter must be a function');
}
if (typeof predicate !== 'function') {
throw new Error('isNodeIn second parameter must be a function');
}

let currentNode = node;
while (currentNode) {
if (predicate(currentNode)) {
return true;
}
currentNode = currentNode.parentNode;
}

let currentNode = node;
while (currentNode) {
if (predicate(currentNode)) {
return true;
}
currentNode = currentNode.parentNode;
}

return false;
return false;
};

export default isNodeIn;

0 comments on commit 83d10fb

Please sign in to comment.