Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

2.0 KB
Raw Blame
<!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>