mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:42:43 +00:00 
			
		
		
		
	 7edfeb7056
			
		
	
	
		7edfeb7056
		
	
	
	
	
		
			
			We currently fire the change event on <input> elements when they lose focus. The spec allows for us to also fire the event when changes are "committed", so long as such an action makes sense for the input type. This patch detects when the return key is entered in an <input> element and uses that as the commit action for text-related types. If no change has occurred since the last commit, no change event is fired.
		
			
				
	
	
		
			35 lines
		
	
	
	
		
			782 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
	
		
			782 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/Bindings/PlatformObject.h>
 | |
| 
 | |
| namespace Web::Internals {
 | |
| 
 | |
| class Internals final : public Bindings::PlatformObject {
 | |
|     WEB_PLATFORM_OBJECT(Internals, Bindings::PlatformObject);
 | |
|     JS_DECLARE_ALLOCATOR(Internals);
 | |
| 
 | |
| public:
 | |
|     virtual ~Internals() override;
 | |
| 
 | |
|     void signal_text_test_is_done();
 | |
| 
 | |
|     void gc();
 | |
|     JS::Object* hit_test(double x, double y);
 | |
| 
 | |
|     void send_text(HTML::HTMLElement&, String const&);
 | |
|     void commit_text();
 | |
| 
 | |
|     WebIDL::ExceptionOr<bool> dispatch_user_activated_event(DOM::EventTarget&, DOM::Event& event);
 | |
| 
 | |
| private:
 | |
|     explicit Internals(JS::Realm&);
 | |
|     virtual void initialize(JS::Realm&) override;
 | |
| };
 | |
| 
 | |
| }
 |