taoqf / node-html-parser

A very fast HTML parser, generating a simplified DOM, with basic element query support.
MIT License
1.12k stars 112 forks source link

add textContent for easier manipulation dom manipulation #95

Closed binary-person closed 3 years ago

binary-person commented 3 years ago

it would be easier if there was a getter/setter instead of going hack mode: finding all the TextNodes, concatenating them into a string, then deleting the entire childNodes and replacing it with a new TextNode.

element.set_content won't work as expected as the code tries to parse it as html, which is a problem if the thing being replaced is a text block (for a script tag, for example)

taoqf commented 3 years ago

https://www.npmjs.com/package/node-html-parser#htmlelementtextcontent

binary-person commented 3 years ago

it works. thank you for taking the time to implement it