Struct ::exo::dom::Dom

Overview

The root node / dom element

This struct contains the children of the single root html element of an exolynk layout.

Methods

fn new() -> Dom

Creates a new Dom struct.

Example

let dom = exo::dom::Dom::new();
dom.children = [exo::dom::NewLine::new(), exo::dom::RawHtml::new()];

Tries to find and returns the node with the given id.

Example

let dom = exo::dom::Dom::new();
let nl = exo::dom::NewLine::new();
nl.id = "test";
dom.children = [exo::dom::NewLine::new(), exo::dom::RawHtml::new(), nl];
assert_eq!(dom.get_node_by_id("test"), Some(nl));
fn set_node_by_id(self, id: String, node) -> Tuple

Tries to find and replace the node with the given id.

Example

let dom = exo::dom::Dom::new();
let nl = exo::dom::NewLine::new();
nl.id = "test";
dom.children = [exo::dom::NewLine::new(), exo::dom::RawHtml::new(), nl];
dom.set_node_by_id("test", exo::dom::NewLine::new());
assert_eq!(dom.get_node_by_id("test"), None);

Protocols

protocol get style
let output = value.style

Allows a get operation to work.

protocol set style
value.style = input

Allows a set operation to work.

protocol partial_eq
if value == b { }

Allows for partial equality operations to work.

protocol string_debug
println("{:?}", value)

Allows the value to be debug printed.

protocol string_display
println("{}", value)

Allows the value to be display printed.

protocol get children
let output = value.children

Get the children.

Example

let node = exo::dom::Dom::new();
node.children = [exo::dom::NewLine::new(), exo::dom::RawHtml::new()];
assert_eq!(node.children, [exo::dom::NewLine::new(), exo::dom::RawHtml::new()]);
protocol set children
value.children = input

Set the children.

Example

let node = exo::dom::Dom::new();
node.children = [exo::dom::NewLine::new(), exo::dom::RawHtml::new()];
assert_eq!(node.children, [exo::dom::NewLine::new(), exo::dom::RawHtml::new()]);