util.rs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. use crate::innerlude::*;
  2. pub struct DebugDom {
  3. counter: u64,
  4. }
  5. impl DebugDom {
  6. pub fn new() -> Self {
  7. Self { counter: 0 }
  8. }
  9. }
  10. impl<'a> RealDom<'a> for DebugDom {
  11. fn push_root(&mut self, root: RealDomNode) {}
  12. fn append_child(&mut self) {}
  13. fn replace_with(&mut self) {}
  14. fn remove(&mut self) {}
  15. fn remove_all_children(&mut self) {}
  16. fn create_text_node(&mut self, text: &str) -> RealDomNode {
  17. self.counter += 1;
  18. RealDomNode::new(self.counter)
  19. }
  20. fn create_element(&mut self, tag: &str) -> RealDomNode {
  21. self.counter += 1;
  22. RealDomNode::new(self.counter)
  23. }
  24. fn create_element_ns(&mut self, tag: &str, namespace: &str) -> RealDomNode {
  25. self.counter += 1;
  26. RealDomNode::new(self.counter)
  27. }
  28. fn create_placeholder(&mut self) -> RealDomNode {
  29. self.counter += 1;
  30. RealDomNode::new(self.counter)
  31. }
  32. fn new_event_listener(
  33. &mut self,
  34. event: &str,
  35. scope: ScopeIdx,
  36. element_id: usize,
  37. realnode: RealDomNode,
  38. ) {
  39. }
  40. fn remove_event_listener(&mut self, event: &str) {}
  41. fn set_text(&mut self, text: &str) {}
  42. fn set_attribute(&mut self, name: &str, value: &str, is_namespaced: bool) {}
  43. fn remove_attribute(&mut self, name: &str) {}
  44. fn raw_node_as_any_mut(&self) -> &mut dyn std::any::Any {
  45. todo!()
  46. }
  47. }