- From: woody-li <notifications@github.com>
- Date: Tue, 29 Jul 2025 02:04:59 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 29 July 2025 09:05:03 UTC
woody-li left a comment (whatwg/dom#1395)
@rniwa Yeah, it is.
This proposal is meant to resolve how to get text content across shadowRoot.
Both `innerText` and `textContent` cannot get text across shadow DOM.
For example:
```HTML
<div id="box">
// some other elements.
<my-element>
#shadow-fragment
<span>Some test content</span>
</my-element>
</div>
```
In some cases, I want to get the real text content of the box element.
I have to query every element, check whether it's a custom element, and collect its inner elements again and again.
Then, use all elements to map a list of text content.
----
This proposal is meant to create a new API like `getTextContent`, using it to get the real text content.
And I think it should contain an options object argument.
One option for deciding whether to get text across shadowRoot.
One option is to get `innerText` or `textContent`.
----
This is my first proposal here.
Please let me know if there's any problem.
Thanks.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1395#issuecomment-3131411148
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/issues/1395/3131411148@github.com>
Received on Tuesday, 29 July 2025 09:05:03 UTC