@oozcitak/dom
Advanced tools
Comparing version 1.13.0 to 1.14.0
@@ -50,3 +50,5 @@ "use strict"; | ||
signal._abortedFlag = true; | ||
signal._abortAlgorithms.forEach(algorithm => algorithm.call(signal)); | ||
for (const algorithm of signal._abortAlgorithms) { | ||
algorithm.call(signal); | ||
} | ||
signal._abortAlgorithms.clear(); | ||
@@ -53,0 +55,0 @@ EventAlgorithm_1.event_fireAnEvent("abort", signal); |
@@ -62,3 +62,3 @@ "use strict"; | ||
*/ | ||
dom_1.dom.rangeList.forEach(range => { | ||
for (const range of dom_1.dom.rangeList) { | ||
if (range._start[0] === node && range._start[1] > offset && range._start[1] <= offset + count) { | ||
@@ -76,3 +76,3 @@ range._start[1] += offset; | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -79,0 +79,0 @@ * 12. If node is a Text node and its parent is not null, run the child |
@@ -93,3 +93,5 @@ "use strict"; | ||
if (util_1.Guard.isElementNode(inclusiveDescendant)) { | ||
inclusiveDescendant._attributeList._asArray().forEach(attr => attr._nodeDocument = document); | ||
for (const attr of inclusiveDescendant._attributeList._asArray()) { | ||
attr._nodeDocument = document; | ||
} | ||
} | ||
@@ -96,0 +98,0 @@ /** |
@@ -57,3 +57,5 @@ "use strict"; | ||
// run custom steps | ||
element._attributeChangeSteps.forEach(a => a.call(element, element, localName, oldValue, value, namespace)); | ||
for (const step of element._attributeChangeSteps) { | ||
step.call(element, element, localName, oldValue, value, namespace); | ||
} | ||
} | ||
@@ -60,0 +62,0 @@ exports.dom_runAttributeChangeSteps = dom_runAttributeChangeSteps; |
@@ -161,3 +161,5 @@ "use strict"; | ||
let touchTargets = []; | ||
event._touchTargetList.forEach(touchTarget => touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, target))); | ||
for (const touchTarget of event._touchTargetList) { | ||
touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, target)); | ||
} | ||
event_appendToAnEventPath(event, target, targetOverride, relatedTarget, touchTargets, false); | ||
@@ -207,3 +209,5 @@ const isActivationEvent = (util_1.Guard.isMouseEvent(event) && event._type === "click"); | ||
touchTargets = []; | ||
event._touchTargetList.forEach(touchTarget => touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, parent))); | ||
for (const touchTarget of event._touchTargetList) { | ||
touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, parent)); | ||
} | ||
/** | ||
@@ -210,0 +214,0 @@ * 5.9.6. If parent is a Window object, or parent is a node and target's |
@@ -87,3 +87,5 @@ "use strict"; | ||
// check if the listener is defined | ||
eventTarget._eventListenerList.forEach(e => e.removed = true); | ||
for (const e of eventTarget._eventListenerList) { | ||
e.removed = true; | ||
} | ||
// empty list | ||
@@ -90,0 +92,0 @@ eventTarget._eventListenerList = []; |
@@ -90,3 +90,3 @@ "use strict"; | ||
let eleCount = 0; | ||
node._children.forEach(childNode => { | ||
for (const childNode of node._children) { | ||
if (childNode._nodeType === interfaces_1.NodeType.Element) | ||
@@ -96,3 +96,3 @@ eleCount++; | ||
throw new DOMException_1.HierarchyRequestError(`Cannot insert text a node as a child of a document node. Node is ${childNode.nodeName}.`); | ||
}); | ||
} | ||
if (eleCount > 1) { | ||
@@ -102,6 +102,6 @@ throw new DOMException_1.HierarchyRequestError(`A document node can only have one document element node. Document fragment to be inserted has ${eleCount} element nodes.`); | ||
else if (eleCount === 1) { | ||
parent._children.forEach(ele => { | ||
for (const ele of parent._children) { | ||
if (ele._nodeType === interfaces_1.NodeType.Element) | ||
throw new DOMException_1.HierarchyRequestError(`The document node already has a document element node.`); | ||
}); | ||
} | ||
if (child) { | ||
@@ -120,6 +120,6 @@ if (childNodeType === interfaces_1.NodeType.DocumentType) | ||
else if (nodeNodeType === interfaces_1.NodeType.Element) { | ||
parent._children.forEach(ele => { | ||
for (const ele of parent._children) { | ||
if (ele._nodeType === interfaces_1.NodeType.Element) | ||
throw new DOMException_1.HierarchyRequestError(`Document already has a document element node. Node is ${node.nodeName}.`); | ||
}); | ||
} | ||
if (child) { | ||
@@ -137,6 +137,6 @@ if (childNodeType === interfaces_1.NodeType.DocumentType) | ||
else if (nodeNodeType === interfaces_1.NodeType.DocumentType) { | ||
parent._children.forEach(ele => { | ||
for (const ele of parent._children) { | ||
if (ele._nodeType === interfaces_1.NodeType.DocumentType) | ||
throw new DOMException_1.HierarchyRequestError(`Document already has a document type node. Node is ${node.nodeName}.`); | ||
}); | ||
} | ||
if (child) { | ||
@@ -222,3 +222,3 @@ let elementChild = child._previousSibling; | ||
const index = TreeAlgorithm_1.tree_index(child); | ||
dom_1.dom.rangeList.forEach(range => { | ||
for (const range of dom_1.dom.rangeList) { | ||
if (range._start[0] === parent && range._start[1] > index) { | ||
@@ -230,3 +230,3 @@ range._start[1] += count; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -624,3 +624,3 @@ } | ||
let eleCount = 0; | ||
node._children.forEach(childNode => { | ||
for (const childNode of node._children) { | ||
if (childNode._nodeType === interfaces_1.NodeType.Element) | ||
@@ -630,3 +630,3 @@ eleCount++; | ||
throw new DOMException_1.HierarchyRequestError(`Cannot insert text a node as a child of a document node. Node is ${childNode.nodeName}.`); | ||
}); | ||
} | ||
if (eleCount > 1) { | ||
@@ -636,6 +636,6 @@ throw new DOMException_1.HierarchyRequestError(`A document node can only have one document element node. Document fragment to be inserted has ${eleCount} element nodes.`); | ||
else if (eleCount === 1) { | ||
parent._children.forEach(ele => { | ||
for (const ele of parent._children) { | ||
if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) | ||
throw new DOMException_1.HierarchyRequestError(`The document node already has a document element node.`); | ||
}); | ||
} | ||
let doctypeChild = child._nextSibling; | ||
@@ -650,6 +650,6 @@ while (doctypeChild) { | ||
else if (node._nodeType === interfaces_1.NodeType.Element) { | ||
parent._children.forEach(ele => { | ||
for (const ele of parent._children) { | ||
if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) | ||
throw new DOMException_1.HierarchyRequestError(`Document already has a document element node. Node is ${node.nodeName}.`); | ||
}); | ||
} | ||
let doctypeChild = child._nextSibling; | ||
@@ -663,6 +663,6 @@ while (doctypeChild) { | ||
else if (node._nodeType === interfaces_1.NodeType.DocumentType) { | ||
parent._children.forEach(ele => { | ||
for (const ele of parent._children) { | ||
if (ele._nodeType === interfaces_1.NodeType.DocumentType && ele !== child) | ||
throw new DOMException_1.HierarchyRequestError(`Document already has a document type node. Node is ${node.nodeName}.`); | ||
}); | ||
} | ||
let elementChild = child._previousSibling; | ||
@@ -766,3 +766,5 @@ while (elementChild) { | ||
*/ | ||
removedNodes.forEach(childNode => mutation_remove(childNode, parent, true)); | ||
for (const childNode of removedNodes) { | ||
mutation_remove(childNode, parent, true); | ||
} | ||
/** | ||
@@ -823,3 +825,3 @@ * 7. If node is not null, then insert node into parent before null with the | ||
*/ | ||
dom_1.dom.rangeList.forEach(range => { | ||
for (const range of dom_1.dom.rangeList) { | ||
if (TreeAlgorithm_1.tree_isDescendantOf(node, range._start[0], true)) { | ||
@@ -837,3 +839,3 @@ range._start = [parent, index]; | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -845,3 +847,3 @@ * 4. For each live range whose start node is parent and start offset is | ||
*/ | ||
dom_1.dom.rangeList.forEach(range => { | ||
for (const range of dom_1.dom.rangeList) { | ||
if (range._start[0] === parent && range._start[1] > index) { | ||
@@ -853,3 +855,3 @@ range._start[1] -= 1; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -862,7 +864,7 @@ /** | ||
if (dom_1.dom.features.steps) { | ||
NodeIteratorAlgorithm_1.nodeIterator_iteratorList().forEach(iterator => { | ||
for (const iterator of NodeIteratorAlgorithm_1.nodeIterator_iteratorList()) { | ||
if (iterator._root._nodeDocument === node._nodeDocument) { | ||
DOMAlgorithm_1.dom_runNodeIteratorPreRemovingSteps(iterator, node); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -981,3 +983,3 @@ /** | ||
while (inclusiveAncestor !== null) { | ||
inclusiveAncestor._registeredObserverList.forEach(registered => { | ||
for (const registered of inclusiveAncestor._registeredObserverList) { | ||
if (registered.options.subtree) { | ||
@@ -990,3 +992,3 @@ node._registeredObserverList.push({ | ||
} | ||
}); | ||
} | ||
inclusiveAncestor = TreeAlgorithm_1.tree_getNextAncestorNode(parent, inclusiveAncestor, true); | ||
@@ -993,0 +995,0 @@ } |
@@ -80,3 +80,5 @@ "use strict"; | ||
if (dom_1.dom.features.slots) { | ||
signalSet.forEach(slot => EventAlgorithm_1.event_fireAnEvent("slotchange", slot, undefined, { bubbles: true })); | ||
for (const slot of signalSet) { | ||
EventAlgorithm_1.event_fireAnEvent("slotchange", slot, undefined, { bubbles: true }); | ||
} | ||
} | ||
@@ -157,3 +159,3 @@ } | ||
*/ | ||
interestedObservers.forEach((mappedOldValue, observer) => { | ||
for (const [observer, mappedOldValue] of interestedObservers) { | ||
/** | ||
@@ -171,3 +173,3 @@ * 4.1. Let record be a new MutationRecord object with its type set to | ||
queue.push(record); | ||
}); | ||
} | ||
/** | ||
@@ -174,0 +176,0 @@ * 5. Queue a mutation observer microtask. |
@@ -145,6 +145,6 @@ "use strict"; | ||
if (cloneChildrenFlag) { | ||
node._children.forEach(child => { | ||
for (const child of node._children) { | ||
const childCopy = node_clone(child, document, true); | ||
MutationAlgorithm_1.mutation_append(childCopy, copy); | ||
}); | ||
} | ||
} | ||
@@ -151,0 +151,0 @@ /** |
@@ -37,3 +37,5 @@ "use strict"; | ||
const ns = node; | ||
nodes.forEach(item => ns.appendChild(item)); | ||
for (const item of nodes) { | ||
ns.appendChild(item); | ||
} | ||
} | ||
@@ -40,0 +42,0 @@ /** |
@@ -255,3 +255,3 @@ "use strict"; | ||
const containedChildren = []; | ||
commonAncestor._children.forEach(child => { | ||
for (const child of commonAncestor._children) { | ||
if (range_isContained(child, range)) { | ||
@@ -263,3 +263,3 @@ if (util_1.Guard.isDocumentTypeNode(child)) { | ||
} | ||
}); | ||
} | ||
let newNode; | ||
@@ -341,3 +341,5 @@ let newOffset; | ||
*/ | ||
containedChildren.forEach(child => MutationAlgorithm_1.mutation_append(child, fragment)); | ||
for (const child of containedChildren) { | ||
MutationAlgorithm_1.mutation_append(child, fragment); | ||
} | ||
if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { | ||
@@ -475,3 +477,3 @@ /** | ||
const containedChildren = []; | ||
commonAncestor._children.forEach(child => { | ||
for (const child of commonAncestor._children) { | ||
if (range_isContained(child, range)) { | ||
@@ -483,3 +485,3 @@ if (util_1.Guard.isDocumentTypeNode(child)) { | ||
} | ||
}); | ||
} | ||
if (util_1.Guard.isCharacterDataNode(firstPartiallyContainedChild)) { | ||
@@ -524,6 +526,6 @@ /** | ||
*/ | ||
containedChildren.forEach(child => { | ||
for (const child of containedChildren) { | ||
const clone = NodeAlgorithm_1.node_clone(child); | ||
MutationAlgorithm_1.mutation_append(clone, fragment); | ||
}); | ||
} | ||
if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { | ||
@@ -530,0 +532,0 @@ /** |
@@ -101,3 +101,3 @@ "use strict"; | ||
const host = root._host; | ||
host._children.forEach(slotable => { | ||
for (const slotable of host._children) { | ||
if (util_1.Guard.isSlotable(slotable)) { | ||
@@ -113,3 +113,3 @@ /** | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -142,7 +142,7 @@ * 5. Return result. | ||
if (util_2.isEmpty(slotables)) { | ||
slot._children.forEach(slotable => { | ||
for (const slotable of slot._children) { | ||
if (util_1.Guard.isSlotable(slotable)) { | ||
slotables.push(slotable); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -152,3 +152,3 @@ /** | ||
*/ | ||
slotables.forEach(node => { | ||
for (const node of slotables) { | ||
/** | ||
@@ -171,3 +171,3 @@ * 5.1. If node is a slot whose root is a shadow root, then: | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -208,3 +208,5 @@ * 6. Return result. | ||
slot._assignedNodes = slotables; | ||
slotables.forEach(slotable => slotable._assignedSlot = slot); | ||
for (const slotable of slotables) { | ||
slotable._assignedSlot = slot; | ||
} | ||
} | ||
@@ -211,0 +213,0 @@ exports.shadowTree_assignSlotables = shadowTree_assignSlotables; |
@@ -173,3 +173,3 @@ "use strict"; | ||
*/ | ||
dom_1.dom.rangeList.forEach(range => { | ||
for (const range of dom_1.dom.rangeList) { | ||
if (range._start[0] === node && range._start[1] > offset) { | ||
@@ -190,3 +190,3 @@ range._start[0] = newNode; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -193,0 +193,0 @@ /** |
@@ -95,3 +95,3 @@ "use strict"; | ||
*/ | ||
tokens.forEach(token => { | ||
for (const token of tokens) { | ||
if (token === '') { | ||
@@ -106,3 +106,3 @@ throw new DOMException_1.SyntaxError("Cannot add an empty token."); | ||
} | ||
}); | ||
} | ||
algorithm_1.tokenList_updateSteps(this); | ||
@@ -121,3 +121,3 @@ } | ||
*/ | ||
tokens.forEach(token => { | ||
for (const token of tokens) { | ||
if (token === '') { | ||
@@ -132,3 +132,3 @@ throw new DOMException_1.SyntaxError("Cannot remove an empty token."); | ||
} | ||
}); | ||
} | ||
algorithm_1.tokenList_updateSteps(this); | ||
@@ -135,0 +135,0 @@ } |
@@ -74,3 +74,3 @@ "use strict"; | ||
const coptions = options; | ||
target._registeredObserverList.forEach(registered => { | ||
for (const registered of target._registeredObserverList) { | ||
if (registered.observer === this) { | ||
@@ -83,5 +83,5 @@ isRegistered = true; | ||
*/ | ||
this._nodeList.forEach(node => { | ||
infra_1.list.remove((node)._registeredObserverList, (ob) => util_1.Guard.isTransientRegisteredObserver(ob) && ob.source === registered); | ||
}); | ||
for (const node of this._nodeList) { | ||
infra_1.list.remove(node._registeredObserverList, (ob) => util_1.Guard.isTransientRegisteredObserver(ob) && ob.source === registered); | ||
} | ||
/** | ||
@@ -92,3 +92,3 @@ * 7.2. Set registered’s options to options. | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -112,5 +112,5 @@ * 8. Otherwise: | ||
*/ | ||
this._nodeList.forEach(node => { | ||
for (const node of this._nodeList) { | ||
infra_1.list.remove((node)._registeredObserverList, (ob) => ob.observer === this); | ||
}); | ||
} | ||
/** | ||
@@ -117,0 +117,0 @@ * 2. Empty the context object’s record queue. |
@@ -340,3 +340,3 @@ "use strict"; | ||
const index = algorithm_1.tree_index(cn); | ||
_1.dom.rangeList.forEach(range => { | ||
for (const range of _1.dom.rangeList) { | ||
if (range._start[0] === cn) { | ||
@@ -358,3 +358,3 @@ range._start[0] = node; | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -361,0 +361,0 @@ * 6.5. Add currentNode’s length to length. |
@@ -111,8 +111,3 @@ "use strict"; | ||
[Symbol.iterator]() { | ||
const it = this._root._children[Symbol.iterator](); | ||
return { | ||
next() { | ||
return it.next(); | ||
} | ||
}; | ||
return this._root._children[Symbol.iterator](); | ||
} | ||
@@ -125,3 +120,5 @@ /** @inheritdoc */ | ||
let index = 0; | ||
this._root._children.forEach(node => callback.call(thisArg, node, index++, this)); | ||
for (const node of this._root._children) { | ||
callback.call(thisArg, node, index++, this); | ||
} | ||
} | ||
@@ -128,0 +125,0 @@ /** |
@@ -109,3 +109,5 @@ "use strict"; | ||
let index = 0; | ||
this._items.forEach(node => callback.call(thisArg, node, index++, this)); | ||
for (const node of this._items) { | ||
callback.call(thisArg, node, index++, this); | ||
} | ||
} | ||
@@ -112,0 +114,0 @@ /** |
@@ -56,6 +56,6 @@ "use strict"; | ||
let count = 0; | ||
util_1.Cast.asNode(this)._children.forEach(childNode => { | ||
for (const childNode of util_1.Cast.asNode(this)._children) { | ||
if (util_1.Guard.isElementNode(childNode)) | ||
count++; | ||
}); | ||
} | ||
return count; | ||
@@ -62,0 +62,0 @@ } |
@@ -309,3 +309,3 @@ "use strict"; | ||
*/ | ||
nodesToRemove.forEach(node => { | ||
for (const node of nodesToRemove) { | ||
/* istanbul ignore else */ | ||
@@ -315,3 +315,3 @@ if (node._parent) { | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -318,0 +318,0 @@ * 9. If original end node is a Text, ProcessingInstruction, or Comment |
@@ -196,3 +196,3 @@ "use strict"; | ||
*/ | ||
for (const childNode of node.childNodes) { | ||
for (const childNode of node._children || node.childNodes) { | ||
markup += this._serializeNode(childNode, requireWellFormed); | ||
@@ -243,3 +243,3 @@ } | ||
let serializedDocument = ""; | ||
for (const childNode of node.childNodes) { | ||
for (const childNode of node._children || node.childNodes) { | ||
serializedDocument += this._serializeNode(childNode, requireWellFormed); | ||
@@ -326,3 +326,3 @@ } | ||
let markup = ""; | ||
for (const childNode of node.childNodes) { | ||
for (const childNode of node._children || node.childNodes) { | ||
markup += this._serializeNode(childNode, requireWellFormed); | ||
@@ -470,6 +470,3 @@ } | ||
*/ | ||
for (let i = 0; i < node.attributes.length; i++) { | ||
const attr = node.attributes.item(i); | ||
if (!attr) | ||
continue; | ||
for (const attr of node.attributes) { | ||
/** | ||
@@ -476,0 +473,0 @@ * 3.1. If the require well-formed flag is set (its value is true), and the |
@@ -416,3 +416,3 @@ "use strict"; | ||
else { | ||
for (const childNode of node.childNodes) { | ||
for (const childNode of node._children || node.childNodes) { | ||
markup += this._serializeNode(childNode, inheritedNS, map, prefixIndex, requireWellFormed); | ||
@@ -467,3 +467,3 @@ } | ||
let serializedDocument = ""; | ||
for (const childNode of node.childNodes) { | ||
for (const childNode of node._children || node.childNodes) { | ||
serializedDocument += this._serializeNode(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); | ||
@@ -552,3 +552,3 @@ } | ||
let markup = ""; | ||
for (const childNode of node.childNodes) { | ||
for (const childNode of node._children || node.childNodes) { | ||
markup += this._serializeNode(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); | ||
@@ -701,6 +701,3 @@ } | ||
*/ | ||
for (let i = 0; i < node.attributes.length; i++) { | ||
const attr = node.attributes.item(i); | ||
if (!attr) | ||
continue; | ||
for (const attr of node.attributes) { | ||
// Optimize common case | ||
@@ -707,0 +704,0 @@ if (!requireWellFormed && attr.namespaceURI === null) { |
{ | ||
"name": "@oozcitak/dom", | ||
"version": "1.13.0", | ||
"version": "1.14.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "dom", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22233
1124826