JSSoup icon indicating copy to clipboard operation
JSSoup copied to clipboard

White space is ignored in nesting tags

Open OHHAKO opened this issue 3 years ago • 3 comments

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.

스크린샷 2021-08-30 오후 4 46 26

  • and when i edit the code child with child.prettify() it shows perfectly.

스크린샷 2021-08-30 오후 4 44 52

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!

OHHAKO avatar Aug 30 '21 08:08 OHHAKO

Could you set "ignoreWhitespace" to true to see if it can fix the problem?

chishui avatar Oct 01 '21 04:10 chishui

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);

OHHAKO avatar Oct 04 '21 06:10 OHHAKO

Hi @OHHAKO did you found a fix?

DjakaTechnology avatar Apr 23 '23 15:04 DjakaTechnology