()
| 545 | |
| 546 | // https://dom.spec.whatwg.org/#dom-node-textcontent |
| 547 | get textContent() { |
| 548 | switch (this.nodeType) { |
| 549 | case NODE_TYPE.DOCUMENT_FRAGMENT_NODE: |
| 550 | case NODE_TYPE.ELEMENT_NODE: { |
| 551 | let text = ""; |
| 552 | for (const child of domSymbolTree.treeIterator(this)) { |
| 553 | if (child.nodeType === NODE_TYPE.TEXT_NODE || child.nodeType === NODE_TYPE.CDATA_SECTION_NODE) { |
| 554 | text += child.nodeValue; |
| 555 | } |
| 556 | } |
| 557 | return text; |
| 558 | } |
| 559 | |
| 560 | case NODE_TYPE.ATTRIBUTE_NODE: { |
| 561 | return this._value; |
| 562 | } |
| 563 | |
| 564 | case NODE_TYPE.TEXT_NODE: |
| 565 | case NODE_TYPE.CDATA_SECTION_NODE: // CDATASection is a subclass of Text |
| 566 | case NODE_TYPE.PROCESSING_INSTRUCTION_NODE: |
| 567 | case NODE_TYPE.COMMENT_NODE: { |
| 568 | return this._data; |
| 569 | } |
| 570 | |
| 571 | default: { |
| 572 | return null; |
| 573 | } |
| 574 | } |
| 575 | } |
| 576 | set textContent(value) { |
| 577 | if (value === null) { |
| 578 | value = ""; |
nothing calls this directly
no test coverage detected