jsdom
Advanced tools
Comparing version 18.0.0 to 18.0.1
@@ -32,3 +32,3 @@ "use strict"; | ||
// Relavant specs | ||
// Relevant specs | ||
// http://www.w3.org/TR/DOM-Level-2-Style (2000) | ||
@@ -35,0 +35,0 @@ // http://www.w3.org/TR/cssom-view/ (2008) |
@@ -90,15 +90,15 @@ "use strict"; | ||
if (_start.offset > offset && _start.offset <= offset + count) { | ||
if (_start.node === this && _start.offset > offset && _start.offset <= offset + count) { | ||
range._setLiveRangeStart(this, offset); | ||
} | ||
if (_end.offset > offset && _end.offset <= offset + count) { | ||
if (_end.node === this && _end.offset > offset && _end.offset <= offset + count) { | ||
range._setLiveRangeEnd(this, offset); | ||
} | ||
if (_start.offset > offset + count) { | ||
if (_start.node === this && _start.offset > offset + count) { | ||
range._setLiveRangeStart(this, _start.offset + data.length - count); | ||
} | ||
if (_end.offset > offset + count) { | ||
if (_end.node === this && _end.offset > offset + count) { | ||
range._setLiveRangeEnd(this, _end.offset + data.length - count); | ||
@@ -105,0 +105,0 @@ } |
@@ -462,2 +462,3 @@ "use strict"; | ||
this._value = ""; | ||
return; | ||
} | ||
@@ -464,0 +465,0 @@ |
@@ -14,3 +14,3 @@ "use strict"; | ||
const { nodeRoot, nodeLength } = require("../helpers/node"); | ||
const { nodeRoot, nodeLength, isInclusiveAncestor } = require("../helpers/node"); | ||
const { domSymbolTree } = require("../helpers/internal-constants"); | ||
@@ -25,9 +25,2 @@ const { documentBaseURLSerialized } = require("../helpers/document-base-url"); | ||
function isObsoleteNodeType(node) { | ||
return node.nodeType === NODE_TYPE.ENTITY_NODE || | ||
node.nodeType === NODE_TYPE.ENTITY_REFERENCE_NODE || | ||
node.nodeType === NODE_TYPE.NOTATION_NODE || | ||
node.nodeType === NODE_TYPE.CDATA_SECTION_NODE; | ||
} | ||
function nodeEquals(a, b) { | ||
@@ -331,4 +324,3 @@ if (a.nodeType !== b.nodeType) { | ||
let currentNode = domSymbolTree.nextSibling(node); | ||
while (currentNode && currentNode.nodeType !== NODE_TYPE.TEXT_NODE) { | ||
const currentNodeParent = domSymbolTree.parent(currentNode); | ||
while (currentNode && currentNode.nodeType === NODE_TYPE.TEXT_NODE) { | ||
const currentNodeIndex = domSymbolTree.index(currentNode); | ||
@@ -345,7 +337,12 @@ | ||
} | ||
if (_start.node === currentNodeParent && _start.offset === currentNodeIndex) { | ||
} | ||
for (const range of parentNode._referencedRanges) { | ||
const { _start, _end } = range; | ||
if (_start.node === parentNode && _start.offset === currentNodeIndex) { | ||
range._setLiveRangeStart(node, length); | ||
} | ||
if (_end.node === currentNodeParent && _end.offset === currentNodeIndex) { | ||
range._setLiveRangeStart(node, length); | ||
if (_end.node === parentNode && _end.offset === currentNodeIndex) { | ||
range._setLiveRangeEnd(node, length); | ||
} | ||
@@ -378,6 +375,2 @@ } | ||
if (isObsoleteNodeType(node2) || isObsoleteNodeType(node1)) { | ||
throw new Error("Obsolete node type"); | ||
} | ||
let attr1 = null; | ||
@@ -468,8 +461,3 @@ let attr2 = null; | ||
contains(other) { | ||
if (other === null) { | ||
return false; | ||
} else if (this === other) { | ||
return true; | ||
} | ||
return Boolean(this.compareDocumentPosition(other) & NODE_DOCUMENT_POSITION.DOCUMENT_POSITION_CONTAINED_BY); | ||
return isInclusiveAncestor(this, other); | ||
} | ||
@@ -820,2 +808,4 @@ | ||
let isConnected; | ||
for (const node of nodesImpl) { | ||
@@ -857,4 +847,8 @@ if (!childImpl) { | ||
for (const inclusiveDescendant of shadowIncludingInclusiveDescendantsIterator(node)) { | ||
if (inclusiveDescendant.isConnected) { | ||
if (isConnected === undefined) { | ||
isConnected = nodeImpl.isConnected; | ||
} | ||
if (isConnected) { | ||
for (const inclusiveDescendant of shadowIncludingInclusiveDescendantsIterator(node)) { | ||
if (inclusiveDescendant._ceState === "custom") { | ||
@@ -861,0 +855,0 @@ enqueueCECallbackReaction(inclusiveDescendant, "connectedCallback", []); |
@@ -453,3 +453,7 @@ "use strict"; | ||
_setLiveRangeStart(node, offset) { | ||
if (this._start && this._start.node !== node) { | ||
if ( | ||
this._start && | ||
this._start.node !== node && | ||
this._start.node !== this._end.node | ||
) { | ||
this._start.node._referencedRanges.delete(this); | ||
@@ -469,3 +473,7 @@ } | ||
_setLiveRangeEnd(node, offset) { | ||
if (this._end && this._end.node !== node) { | ||
if ( | ||
this._end && | ||
this._end.node !== node && | ||
this._end.node !== this._start.node | ||
) { | ||
this._end.node._referencedRanges.delete(this); | ||
@@ -472,0 +480,0 @@ } |
{ | ||
"name": "jsdom", | ||
"version": "18.0.0", | ||
"version": "18.0.1", | ||
"description": "A JavaScript implementation of many web standards", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
75592
2830424