Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

whitespace nodes #39

Closed
jos3000 opened this issue Feb 8, 2012 · 4 comments
Closed

whitespace nodes #39

jos3000 opened this issue Feb 8, 2012 · 4 comments

Comments

@jos3000
Copy link

jos3000 commented Feb 8, 2012

The latest version is removing all my nodes only containing whitespace. It's introducing subtle rendering bugs where spaces are missing e.g.

<div><span class="firstname">Jos</span> <span class="lastname">Shepherd</span></div>

is getting output as:

<div><span class="firstname">Jos</span><span class="lastname">Shepherd</span></div>

Is the whitespace stripping by design or is it a bug?

@siddMahen
Copy link

The whitespace stripping is by design. A non stripped parsing option is in the works.

@jos3000
Copy link
Author

jos3000 commented Feb 8, 2012

cool beans. I've found the setting and I'm patching it manually until it becomes an option

@siddMahen
Copy link

Now you can do:

var $ = cheerio.load(html, { ignoreWhitespace: false });

to disable whitespace stripping. You can also enter any other options that node-htmlparser2 accepts.

@SlavaB
Copy link

SlavaB commented Mar 19, 2012

{ ignoreWhitespace: false } doesn't work again?
I've now downloaded current version of Cheerio and see the option doesn't work again. Whitespaces are ignored always.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants