mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:52:45 +00:00 
			
		
		
		
	LibWeb: Implement getting and setting element.innerHTML
Getting the innerHTML property will recurse through the subtree inside the element and serialize it into a string as it goes. Setting it will parse the set value as an HTML fragment. It will then remove all current children of the element and replace them with all the children inside the parsed fragment. Setting element.innerHTML will currently force a complete rebuild of the document's layout tree. This is pretty neat! :^)
This commit is contained in:
		
							parent
							
								
									632cc53e2c
								
							
						
					
					
						commit
						68b04d5c78
					
				
					 11 changed files with 192 additions and 5 deletions
				
			
		
							
								
								
									
										17
									
								
								Base/home/anon/www/innerHTML.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Base/home/anon/www/innerHTML.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| <!DOCTYPE> | ||||
| <html> | ||||
| <head> | ||||
| </head> | ||||
| <body> | ||||
| <div id=clicky style="background-color: red; color: white; border: 1px solid black;">Click me</div> | ||||
| <div id="foo">This has <b>some HTML</b> inside it!</div> | ||||
| <script type="text/javascript"> | ||||
| function hax() { | ||||
|     var foo = document.getElementById("foo"); | ||||
|     console.log("trying"); | ||||
|     foo.innerHTML = 'But now the HTML has changed!'; | ||||
| } | ||||
| document.getElementById("clicky").addEventListener("mousedown", hax); | ||||
| </script> | ||||
| </body> | ||||
| </html> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling