Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/find-node-ancestor-with-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var findNodeAncestorWithSelector = function(selector, node) {
// Keep going until we run out of parents to search
// or we found the node
var currentNode = node;
while(currentNode.parent && !matchingNode) {
while(currentNode && currentNode.parent && !matchingNode) {
Copy link
Owner

@MadLittleMods MadLittleMods May 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a test for this case so we don't regress in the future (see tests/)

// A trick to get the selector split up. Generate a scope list on a clone(clean parent)
var currentNodeScopeList = generateScopeList(currentNode.clone(), true);

Expand Down