mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:52:45 +00:00 
			
		
		
		
	LibWeb: Use the element factory in clone_node
It was directly creating a new Element object instead of creating the appropriate element. For example, document.body.cloneNode(true) would return an Element instead of an HTMLBodyElement.
This commit is contained in:
		
							parent
							
								
									5430bc8963
								
							
						
					
					
						commit
						e4ae1cdd1f
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -15,6 +15,7 @@ | |||
| #include <LibWeb/DOM/Comment.h> | ||||
| #include <LibWeb/DOM/DocumentType.h> | ||||
| #include <LibWeb/DOM/Element.h> | ||||
| #include <LibWeb/DOM/ElementFactory.h> | ||||
| #include <LibWeb/DOM/Event.h> | ||||
| #include <LibWeb/DOM/EventDispatcher.h> | ||||
| #include <LibWeb/DOM/EventListener.h> | ||||
|  | @ -412,8 +413,7 @@ NonnullRefPtr<Node> Node::clone_node(Document* document, bool clone_children) co | |||
|     RefPtr<Node> copy; | ||||
|     if (is<Element>(this)) { | ||||
|         auto& element = *verify_cast<Element>(this); | ||||
|         auto qualified_name = QualifiedName(element.local_name(), element.prefix(), element.namespace_()); | ||||
|         auto element_copy = adopt_ref(*new Element(*document, move(qualified_name))); | ||||
|         auto element_copy = DOM::create_element(*document, element.local_name(), element.namespace_() /* FIXME: node’s namespace prefix, and node’s is value, with the synchronous custom elements flag unset */); | ||||
|         element.for_each_attribute([&](auto& name, auto& value) { | ||||
|             element_copy->set_attribute(name, value); | ||||
|         }); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Luke
						Luke