Skip to content

Conversation

@krichprollsch
Copy link
Member

@krichprollsch krichprollsch commented Dec 6, 2025

This PR splits textContent and innerText.

textContent must return the raw content of the data but it must ignore comments

innertText must return rendered text: it must ignore style, script content, replace br with \n, trim white spaces.
⚠️ trimming is not correct is this PR, more work is need to improve from here.

var it = self.childrenIterator();
while (it.next()) |child| {
// ignore comments and TODO processing instructions.
switch (child._type) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative:

if (child.is(CData.Comment) != null) {
   // ignore comments
   continue;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants