Closed TheCarpetMerchant closed 1 year ago
I'd like to have only the html of the node itself, without its children. So <div class="content"><p>text</p></div> would give me <div class="content"></div>.
<div class="content"><p>text</p></div>
<div class="content"></div>
You can do it like:
final el = doc.querySelector('div.content'); print(el?.clone(false).outerHtml);
Ah, didn't know about this clone function. Thank you !
I'd like to have only the html of the node itself, without its children. So
<div class="content"><p>text</p></div>
would give me<div class="content"></div>
.