question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.html() adds a wrapper

See original GitHub issue

First, thank you for cheerio!

I have a bug this .html().

Code:

const ch = cheerio.load('<div id="cheerio">test</div>');
ch.html(); // => <html><head></head><body><div id="cheerio">test</div></body></html>

Why cheerio adds a html-body wrapper to my div?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
PierreRAFFAcommented, Dec 1, 2017

try cheerio.load('<div id="cheerio">test</div>', {xmlMode: true});

0reactions
popey456963commented, Jan 18, 2018

@1mike12 If I remember correctly, it’s mentioned that you can use htmlparser2 configuration options, which include xmlMode. Maybe making it a bit more explicit would be nice though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Best Way to Implement a "Wrapper" in CSS
Sometimes the first bit of HTML we write in a new document is an element that wraps everything else on the page. The...
Read more >
What is the correct way to do a CSS Wrapper? - Stack Overflow
1. Use max-width instead width · 2. Add Padding on the Sides · 3. Use a <div> Instead of a <section> · 4....
Read more >
HTML & CSS 'Wrapper' How to | Hook Agency
An HTML wrapper allows you to center content within a webpage. This simple strategy requires CSS (either in the header of the document...
Read more >
Styling Layout Wrappers In CSS - Ahmad Shadeed
How to style wrappers and containers in CSS. ... Without using additional elements, we can add a wrapper to the <body> element as...
Read more >
14: How to Create a Wrapper in HTML | Basics of CSS
How to create a wrapper in HTML | Learn HTML and CSS | HTML tutorial | Basics of CSS. In this lesson we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found