.html() adds a wrapper
See original GitHub issueFirst, 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:
- Created 6 years ago
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
try
cheerio.load('<div id="cheerio">test</div>', {xmlMode: true});
@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.