mirror of
https://github.com/lexmount/moli.git
synced 2026-09-30 16:01:42 +00:00
50 lines
2.0 KiB
HTML
50 lines
2.0 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<body>
|
|
<div id="parent"><span id="alpha" class="track">A</span><span id="beta">B</span></div>
|
|
<script>
|
|
try {
|
|
window.liveCollectionsError = null;
|
|
|
|
const parent = document.getElementById("parent");
|
|
const alpha = document.getElementById("alpha");
|
|
const childNodes = parent.childNodes;
|
|
window.liveChildNodesSameInstance = childNodes === parent.childNodes;
|
|
parent.removeChild(alpha);
|
|
window.liveChildNodesLengthAfterRemove = childNodes.length;
|
|
window.liveChildNodesFirstAfterRemove = childNodes[0]?.id ?? null;
|
|
parent.insertBefore(alpha, parent.firstChild);
|
|
window.liveChildNodesLengthAfterRestore = childNodes.length;
|
|
window.liveChildNodesFirstAfterRestore = childNodes[0]?.id ?? null;
|
|
|
|
const children = parent.children;
|
|
const gamma = document.createElement("span");
|
|
gamma.id = "gamma";
|
|
parent.appendChild(gamma);
|
|
window.liveChildrenLengthAfterAppend = children.length;
|
|
window.liveChildrenLastId = children[children.length - 1]?.id ?? null;
|
|
|
|
const divs = document.getElementsByTagName("div");
|
|
const initialDivLength = divs.length;
|
|
const extraDiv = document.createElement("div");
|
|
extraDiv.id = "extra-div";
|
|
document.body.appendChild(extraDiv);
|
|
window.liveTagLengthAfterAppend = divs.length;
|
|
document.body.removeChild(extraDiv);
|
|
window.liveTagLengthAfterRemove = divs.length;
|
|
window.liveTagLengthInitial = initialDivLength;
|
|
|
|
const tracked = document.getElementsByClassName("track");
|
|
const initialTrackedLength = tracked.length;
|
|
gamma.className = "track";
|
|
window.liveClassLengthAfterAdd = tracked.length;
|
|
gamma.className = "";
|
|
window.liveClassLengthAfterRemove = tracked.length;
|
|
window.liveClassLengthInitial = initialTrackedLength;
|
|
} catch (error) {
|
|
window.liveCollectionsError = String(error);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|