JSSoup
JSSoup copied to clipboard
White space is ignored in nesting tags
What?
- I used JSSoup in this way.
const data.contentMain = '<p> blah blah <a>blah></a> </p> <p> blah blah </p> ..... ';
const splitContentMain: string[] = [];
const soup = new JSSoup(`<div>${data.contentMain}</div>`);
const div = soup.nextElement;
for (const child of div.contents) {
splitContentMain.push(`${child}`);
}
- and saw this situation. Surely include the white space in front of 'a' tag. but didn't show up.
- and when i edit the code
child
withchild.prettify()
it shows perfectly.
For sure i'm glad to solve my problem. but want to make sure it's working properly. i think prettify() is just how to show code. not for print. Thank you!
Could you set "ignoreWhitespace" to true to see if it can fix the problem?
Thanks for comment.
- I set the true witn JSSoup as option like below code.
- it includes the 'line-breaking'. but still avoid the 'white space'.
- it's still have problem.
const soup = new JSSoup(data, true);
Hi @OHHAKO did you found a fix?