mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:02:45 +00:00 
			
		
		
		
	LibWeb: Add HTMLElement::is_content_editable()
This commit is contained in:
		
							parent
							
								
									934aa6af6a
								
							
						
					
					
						commit
						e3c75d7b6f
					
				
					 5 changed files with 18 additions and 1 deletions
				
			
		|  | @ -0,0 +1 @@ | ||||||
|  |   true | ||||||
|  | @ -0,0 +1,7 @@ | ||||||
|  | <script src="../include.js"></script> | ||||||
|  | <div contenteditable="true" id="contenteditable"></div> | ||||||
|  | <script> | ||||||
|  |     test(() => { | ||||||
|  |         println(document.getElementById("contenteditable").isContentEditable); | ||||||
|  |     }); | ||||||
|  | </script> | ||||||
|  | @ -98,6 +98,14 @@ bool HTMLElement::is_focusable() const | ||||||
|     return m_content_editable_state == ContentEditableState::True; |     return m_content_editable_state == ContentEditableState::True; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // https://html.spec.whatwg.org/multipage/interaction.html#dom-iscontenteditable
 | ||||||
|  | bool HTMLElement::is_content_editable() const | ||||||
|  | { | ||||||
|  |     // The isContentEditable IDL attribute, on getting, must return true if the element is either an editing host or
 | ||||||
|  |     // editable, and false otherwise.
 | ||||||
|  |     return is_editable(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| StringView HTMLElement::content_editable() const | StringView HTMLElement::content_editable() const | ||||||
| { | { | ||||||
|     switch (m_content_editable_state) { |     switch (m_content_editable_state) { | ||||||
|  |  | ||||||
|  | @ -35,6 +35,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     virtual bool is_editable() const final; |     virtual bool is_editable() const final; | ||||||
|     virtual bool is_focusable() const override; |     virtual bool is_focusable() const override; | ||||||
|  |     bool is_content_editable() const; | ||||||
|     StringView content_editable() const; |     StringView content_editable() const; | ||||||
|     WebIDL::ExceptionOr<void> set_content_editable(StringView); |     WebIDL::ExceptionOr<void> set_content_editable(StringView); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -53,7 +53,7 @@ HTMLElement includes HTMLOrSVGElement; | ||||||
| interface mixin ElementContentEditable { | interface mixin ElementContentEditable { | ||||||
|     [CEReactions] attribute DOMString contentEditable; |     [CEReactions] attribute DOMString contentEditable; | ||||||
|     // FIXME: [CEReactions] attribute DOMString enterKeyHint; |     // FIXME: [CEReactions] attribute DOMString enterKeyHint; | ||||||
|     // FIXME: readonly attribute boolean isContentEditable; |     readonly attribute boolean isContentEditable; | ||||||
|     // FIXME: [CEReactions] attribute DOMString inputMode; |     // FIXME: [CEReactions] attribute DOMString inputMode; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Aliaksandr Kalenik
						Aliaksandr Kalenik