New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

within-element

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

within-element - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

2

component.json

@@ -5,3 +5,3 @@ {

"description": "check if an element is within the element",
"version": "0.0.1",
"version": "0.1.0",
"keywords": [

@@ -8,0 +8,0 @@ "dom",

0.1.0 / 2014-06-17
==================
* test: add some selectable text to the page
* index: add Range object support
0.0.1 / 2014-06-14

@@ -3,0 +9,0 @@ ==================

@@ -5,3 +5,3 @@

*
* @param {DOMElement} child - the element to check if it with within `parent`
* @param {DOMElement|Range} child - the DOM element or Range to check if it's within `parent`
* @param {DOMElement} parent - the parent node that `child` could be inside of

@@ -13,2 +13,10 @@ * @return {Boolean} True if `child` is within `parent`. False otherwise.

module.exports = function within (child, parent) {
// don't throw if `child` is null
if (!child) return false;
// Range support
if (child.commonAncestorContainer) child = child.commonAncestorContainer;
else if (child.endContainer) child = child.endContainer;
// traverse up the `parentNode` properties until `parent` is found
var node = child;

@@ -18,3 +26,4 @@ while (node = node.parentNode) {

}
return false;
};
{
"name": "within-element",
"description": "check if an element is within the element",
"version": "0.0.1",
"version": "0.1.0",
"keywords": [

@@ -6,0 +6,0 @@ "browser",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc