tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

root-container.js (1525B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * Dummy container node used for the root document element.
      9 */
     10 class RootContainer {
     11  constructor(markupView, node) {
     12    this.doc = markupView.doc;
     13    this.elt = this.doc.createElement("ul");
     14    // Root container has tree semantics for accessibility.
     15    this.elt.setAttribute("role", "tree");
     16    this.elt.setAttribute("tabindex", "0");
     17    this.elt.setAttribute("aria-dropeffect", "none");
     18    this.elt.container = this;
     19    this.children = this.elt;
     20    this.node = node;
     21    this.toString = () => "[root container]";
     22  }
     23 
     24  hasChildren = true;
     25  expanded = true;
     26  update() {}
     27  destroy() {}
     28 
     29  /**
     30   * If the node has children, return the list of containers for all these children.
     31   *
     32   * @return {Array} An array of child containers or null.
     33   */
     34  getChildContainers() {
     35    return [...this.children.children]
     36      .filter(node => node.container)
     37      .map(node => node.container);
     38  }
     39 
     40  /**
     41   * Set the expanded state of the container node.
     42   *
     43   * @param  {boolean} value
     44   */
     45  setExpanded() {}
     46 
     47  /**
     48   * Set an appropriate role of the container's children node.
     49   */
     50  setChildrenRole() {}
     51 
     52  /**
     53   * Set an appropriate DOM tree depth level for a node and its subtree.
     54   */
     55  updateLevel() {}
     56 
     57  isSlotted() {
     58    return false;
     59  }
     60 }
     61 
     62 module.exports = RootContainer;