| html_closest | R Documentation |
For each node, the node itself if it matches css, otherwise its nearest
ancestor element that does, as the DOM's closest() and jQuery's
.closest(). Use it to go from a cell or a link to the row, card or
section that contains it. :scope is the node itself.
html_closest(x, css)
x |
A |
css |
A CSS selector: a single string. |
A zuhtml_nodeset as long as x: for each node, the matching
element, or a missing node where there is none (and for missing nodes).
Other navigation:
html_children(),
html_elements()
doc <- html_parse(paste0(
"<table><tr id=a><td>1<td><b>x</b></tr>",
"<tr id=b><td>2<td><b>y</b></tr></table>"
))
bold <- html_elements(doc, "b")
html_attr(html_closest(bold, "tr"), "id")
html_closest(bold, "ul")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.