mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 05:10:57 +00:00 
			
		
		
		
	 3bb5c6207f
			
		
	
	
		3bb5c6207f
		
	
	
	
	
		
			
			The new event target implementation requires us to downcast an EventTarget to a FormAssociatedElement to check if the current Element EventTarget has a form owner to setup a with scope for the form owner. This also makes all form associated elements inherit from FormAssociatedElement where it was previously missing. https://html.spec.whatwg.org/#form-associated-element
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			447 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			447 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/HTML/FormAssociatedElement.h>
 | |
| #include <LibWeb/HTML/HTMLFormElement.h>
 | |
| 
 | |
| namespace Web::HTML {
 | |
| 
 | |
| void FormAssociatedElement::set_form(HTMLFormElement* form)
 | |
| {
 | |
|     if (m_form)
 | |
|         m_form->remove_associated_element({}, *this);
 | |
|     m_form = form;
 | |
|     if (m_form)
 | |
|         m_form->add_associated_element({}, *this);
 | |
| }
 | |
| 
 | |
| }
 |