pub enum OuterHtmlStrategy {
Current,
Recursive,
}Expand description
Selector for NodeHandle::outer_html_with_strategy.
The default OuterHtmlStrategy::Current preserves the historical call
path used by NodeHandle::outer_html: a Chromium element-level
outer_html() call (which evaluates this.outerHTML via JS) followed
by a direct XMLSerializer fallback when the primary call returns an
empty payload.
OuterHtmlStrategy::Recursive uses the dedicated Chromium DevTools
Protocol command DOM.getOuterHTML (a single round-trip, browser-side
serialisation that already includes shadow-DOM roots) with a Rust-side
fallback that calls DOM.describeNode with depth = -1 and walks the
resulting CDP Node tree to produce HTML locally.
Both strategies are generic — neither relies on Wix, SPA, or vendor
attributes, classes, or heuristics. Recursive simply selects a different
CDP backend that already handles deeply nested subtrees, large SPAs, and
shadow-DOM trees correctly in a single browser-side pass.
§Example
use stygian_browser::page::OuterHtmlStrategy;
assert_eq!(OuterHtmlStrategy::default(), OuterHtmlStrategy::Current);
assert_eq!(OuterHtmlStrategy::Current.as_str(), "Current");
assert_eq!(OuterHtmlStrategy::Recursive.as_str(), "Recursive");Variants§
Current
Legacy behaviour: element-level JS eval + XMLSerializer fallback.
Recursive
CDP DOM.getOuterHTML (single round-trip) + Rust-side
DOM.describeNode walk fallback.
Implementations§
Trait Implementations§
Source§impl Clone for OuterHtmlStrategy
impl Clone for OuterHtmlStrategy
Source§fn clone(&self) -> OuterHtmlStrategy
fn clone(&self) -> OuterHtmlStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more