We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4cb7107 commit 91e26d1Copy full SHA for 91e26d1
scraper/README.md
@@ -140,9 +140,11 @@ let html = "<html><body>hello<p class=\"hello\">REMOVE ME</p></body></html>";
140
let selector = Selector::parse(".hello").unwrap();
141
let mut document = Html::parse_document(html);
142
let node_ids: Vec<_> = document.select(&selector).map(|x| x.id()).collect();
143
+let tree = HtmlTreeSink::new(document);
144
for id in node_ids {
- document.remove_from_parent(&id);
145
+ tree.remove_from_parent(&id);
146
}
147
+let document = tree.finish();
148
assert_eq!(document.html(), "<html><head></head><body>hello</body></html>");
149
```
150
0 commit comments