mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:22:45 +00:00 
			
		
		
		
	LibWeb: Add NonDocumentTypeChildNode::next_element_in_pre_order()
This is handy for traversing only the elements in a document.
This commit is contained in:
		
							parent
							
								
									a37331e236
								
							
						
					
					
						commit
						7698feb8ce
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		|  | @ -53,8 +53,18 @@ public: | |||
|         return nullptr; | ||||
|     } | ||||
| 
 | ||||
|     Element* next_element_in_pre_order() | ||||
|     { | ||||
|         for (auto* node = static_cast<NodeType*>(this)->next_in_pre_order(); node; node = node->next_in_pre_order()) { | ||||
|             if (is<Element>(*node)) | ||||
|                 return downcast<Element>(node); | ||||
|         } | ||||
|         return nullptr; | ||||
|     } | ||||
| 
 | ||||
|     const Element* previous_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_sibling(); } | ||||
|     const Element* next_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_sibling(); } | ||||
|     const Element* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); } | ||||
| 
 | ||||
| protected: | ||||
|     NonDocumentTypeChildNode() { } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling