* Creates the context node and automatically starts the discovery process. * * @param {Node} node * @param {?string} name
(node, name)
| 178 | * @param {?string} name |
| 179 | */ |
| 180 | constructor(node, name) { |
| 181 | /** |
| 182 | * @const |
| 183 | * @type {Node} |
| 184 | */ |
| 185 | this.node = node; |
| 186 | |
| 187 | /** |
| 188 | * @const |
| 189 | * @package |
| 190 | * @type {?string} |
| 191 | */ |
| 192 | this.name = name; |
| 193 | |
| 194 | /** |
| 195 | * Whether this node is a root. The Document DOM nodes are automatically |
| 196 | * considered as roots. But other nodes can become roots as well |
| 197 | * (e.g. shadow roots) via `setIsRoot()` API. |
| 198 | * |
| 199 | * @package |
| 200 | * @type {boolean} |
| 201 | */ |
| 202 | this.isRoot = node.nodeType == DOCUMENT_NODE; |
| 203 | |
| 204 | /** |
| 205 | * The root context node. Always available for a DOM node connected to a |
| 206 | * root node after the discovery phase. |
| 207 | * |
| 208 | * @package |
| 209 | * @type {?ContextNode<?>} |
| 210 | */ |
| 211 | this.root = this.isRoot ? this : null; |
| 212 | |
| 213 | /** |
| 214 | * Parent should be mostly meaningless to most API clients, because |
| 215 | * it's an async concept: a parent context node can can be instantiated at |
| 216 | * any time and it doesn't mean that this node has to change. This is |
| 217 | * why the API is declared as package-private. However, it needs to be |
| 218 | * unobfuscated to avoid cross-binary issues. |
| 219 | * |
| 220 | * @package |
| 221 | * @type {?ContextNode<?>} |
| 222 | */ |
| 223 | this.parent = null; |
| 224 | |
| 225 | /** |
| 226 | * See `parent` description. |
| 227 | * |
| 228 | * @package |
| 229 | * @type {?ContextNode<?>[]} |
| 230 | */ |
| 231 | this.children = null; |
| 232 | |
| 233 | /** |
| 234 | * @package |
| 235 | * @type {?Map<string, GroupDef>} |
| 236 | */ |
| 237 | this.groups = null; |
nothing calls this directly
no test coverage detected