1use std::{cell::RefCell, rc::Rc};
2
3use super::dom;
4
5pub struct EventHandler {
6}
7
8impl dom::EventHandler for EventHandler {
9 type ElementNode=ElementNode;
10 type Event=Event;
11 fn new(_fire_event: Rc<RefCell<Box<dyn FnMut(u64, String, Event)>>>)->Self {
12 Self {}
13 }
14 fn create_event_listener(&self, _e: &Self::ElementNode, _name: String) {
15 }
16}
17
18pub struct Node {
19}
20
21
22impl dom::GenericNode for Node {
23 type ElementNode = ElementNode;
24 type TextNode = TextNode;
25 fn into_text_node(self)->Self::TextNode {
26 TextNode { text: "hello".to_string()}
27 }
28 fn into_element_node(self)->Self::ElementNode {
29 ElementNode { tag: "hello", generic_node: Node { }}
30 }
31}
32
33pub struct Event {}
34impl dom::Event for Event {
35 fn prevent_default(&self) {}
36}
37
38
39
40impl dom::ElementNode for ElementNode {
41 type TextNode=TextNode;
42 type Document=Document;
43 type GenericNode=Node;
44 type EventHandler=EventHandler;
45 type Event=Event;
46 fn new(tag: &'static str)->Self {
47 Self { tag, generic_node: Node { }}
48 }
49 fn create_dnode_event_listener(&self, _f : Rc<RefCell<dyn FnMut(u64, &'static str)>>, _uid:u64,
50 _name:&'static str) {
51 }
52 fn set_text_content(&self, _s:&str) {
53 }
54 fn replace_text_child(&self, _new: &TextNode, _old: &TextNode) {
55 }
56 fn append_child(&self, _child: &ElementNode) {
57
58 }
59 fn insert_child_before(&self, _child: &Node, _next_sibling: Option<&Node>) {
60
61 }
62 fn append_child_after(&self, _child: &ElementNode, _prev_sibling: &ElementNode) {
63
64 }
65 fn remove_child(&self, child: &Self) {
66 }
67 fn prepend_child(&self, _child: &ElementNode) {
68
69 }
70 fn append_text_child(&self, _child: &TextNode) {
71
72 }
73 fn set_attribute(&self, _name: &str, _value: &str) {
74
75 }
76 fn get_attribute(&self, _name: &str)->String {
77 "no_attribute".to_string()
78 }
79
80 fn remove(&self) {
81 }
82 fn deep_clone(&self)->Self {
83 ElementNode { tag: self.tag, generic_node: Node { } }
84 }
85 fn get_child_nodes(&self)->Vec<Self::GenericNode> {
86 Vec::new()
87 }
88 fn get_child_node(&self, _i:u32)->Option<Self::GenericNode> {
89 Some(Node {})
90 }
91 fn into_generic_node(&self)->&Self::GenericNode {
92 &self.generic_node
93 }
94 fn focus(&self) {
95 }
96
97}
98
99
100pub struct ElementNode {
101 pub generic_node: Node,
102 pub tag: &'static str
103}
104
105pub struct Document {
106}
107impl dom::Document for Document {
108 type TextNode=TextNode;
109 type ElementNode=ElementNode;
110 fn create_text_node(&self, text: &str)->TextNode {
111 TextNode { text: text.to_string() }
112 }
113 fn new()->Self {
114 Document {}
115 }
116 fn create_element(&self, tag: &'static str)->Self::ElementNode {
117 ElementNode {generic_node: Node { }, tag}
118 }
119 fn log_1(s: &str) {
120 println!("{}", s);
121 }
122 fn log_2(s: &str, s2: &str) {
123 println!("{} {}", s, s2);
124 }
125}
126
127pub struct TextNode {
128 pub text: String
129}
130impl dom::TextNode for TextNode {
131 fn new(text: &str)->Self {
132 Self { text: text.to_string() }
133 }
134}