INNER CODE UNIT · Python

cleanHierarchyTree

gurkenlabs/litiengine · config/javadoc/generate_js.py:375

  function cleanHierarchyTree() {
    if (!document.body.classList.contains('tree-page') && !document.body.classList.contains('package-tree-page')) return;

    // 1. Unwrap java.lang.Object root nodes so all direct classes start directly at the top level
    const rootNodes = Array.from(document.querySelectorAll('section.hierarchy > ul > li.circle'));
    rootNodes.forEach(li => {
      const link = li.querySelector('a[href*="Object.html"]');
      const isObjLink = link && (link.textContent.trim() === 'Object' || link.href.includes('/Object.html'));
      const isObjText = li.textContent.includes('java.lang.Object') || (li.childNodes.length && li.childNodes[0].textContent.includes('java.lang.'));
      if (isObjLink || isObjText) {
        const childUl = li.querySelector('ul');
        if (childUl && li.parentNode) {
          const parentUl = li.parentNode;
          const children = Array.from(childUl.children);
          children.forEach(child => {
            parentUl.insertBefore(child, li);
          });
          parentUl.removeChild(li);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…