1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Raw representation of a DOM Element. See [node](../index.html) module for distinction from
//! wrapped representation.

use downcast_rs::DowncastSync;

use std::rc::Rc;
use std::sync::{Arc, Weak};

use crate::sandbox::Sandbox;

mod document;
mod element;

pub use document::Document;
pub use element::document::DocumentElement;
pub use element::body::BodyElement;
pub use element::AnyRawElement;

/// The common structure of all DOM nodes
pub struct Node {
    children: Vec<Arc<Node>>,
    parent: Option<Weak<Node>>,
    right_sibling: Option<Weak<Node>>,
    left_sibling: Option<Weak<Node>>,
}

/// A text node
pub struct TextNode {}

/// An input event
pub struct InputEvent {}

/// A button element
pub struct ButtonElement {}

/// A textarea element
pub struct TextAreaElement {}

/// A base trait for all raw node types
pub trait AnyRawNode: DowncastSync {}
impl_downcast!(sync AnyRawNode);