Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95158066
closest.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Dec 13, 08:02
Size
599 B
Mime Type
text/x-java
Expires
Sun, Dec 15, 08:02 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22916113
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
closest.js
View Options
import matches from './matches';
/**
* Returns the closest parent element that matches a given selector.
*
* @param node the reference element
* @param selector the selector to match
* @param stopAt stop traversing when this element is found
*/
export default function closest(node, selector, stopAt) {
if (node.closest && !stopAt) node.closest(selector);
var nextNode = node;
do {
if (matches(nextNode, selector)) return nextNode;
nextNode = nextNode.parentElement;
} while (nextNode && nextNode !== stopAt && nextNode.nodeType === document.ELEMENT_NODE);
return null;
}
Event Timeline
Log In to Comment