(
&self,
name: QualName,
attributes: Vec<Attribute>,
inlining_ignored: bool,
)
| 78 | } |
| 79 | |
| 80 | fn push_element( |
| 81 | &self, |
| 82 | name: QualName, |
| 83 | attributes: Vec<Attribute>, |
| 84 | inlining_ignored: bool, |
| 85 | ) -> NodeId { |
| 86 | // Extract ID and class values before moving attributes |
| 87 | let mut id_value = None; |
| 88 | let mut class_value = None; |
| 89 | for attr in &attributes { |
| 90 | if attr.name.local == local_name!("id") { |
| 91 | id_value = Some(attr.value.clone()); |
| 92 | } else if attr.name.local == local_name!("class") { |
| 93 | class_value = Some(attr.value.clone()); |
| 94 | } |
| 95 | } |
| 96 | let tag_name = name.local.clone(); |
| 97 | let node_id = self.push_node(NodeData::Element { |
| 98 | element: ElementData::new(name, attributes), |
| 99 | inlining_ignored, |
| 100 | }); |
| 101 | let mut document = self.document.borrow_mut(); |
| 102 | document.push_element_id(node_id); |
| 103 | // Index by tag name |
| 104 | document.index_by_tag(tag_name, node_id); |
| 105 | // Index by ID and class attributes |
| 106 | if let Some(id) = &id_value { |
| 107 | document.index_by_id(id, node_id); |
| 108 | } |
| 109 | if let Some(class) = &class_value { |
| 110 | document.index_by_classes(class, node_id); |
| 111 | } |
| 112 | node_id |
| 113 | } |
| 114 | |
| 115 | fn push_text(&self, text: StrTendril) -> NodeId { |
| 116 | self.push_node(NodeData::Text { text }) |
no test coverage detected