mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	LibWebView: Do not embed text as data in the Inspector HTML
We were previously embedding the original text to handle the special case where the text is empty. We generate an extra span to hold the string "#text" as a placeholder, so that we don't generate a 0px-wide, unclickable (and therefore uneditable) node. Instead, we can just detect when this is the case in the Inspector JS. This further reduces the generated HTML for the Inspector on https://github.com/SerenityOS/serenity from 1.9MB to 1.8MB (about 94KB, or 4.7%).
This commit is contained in:
		
							parent
							
								
									f07f5a2622
								
							
						
					
					
						commit
						fd558a012b
					
				
					 2 changed files with 6 additions and 2 deletions
				
			
		|  | @ -485,7 +485,7 @@ String InspectorClient::generate_dom_tree(JsonObject const& dom_tree) | |||
|             deprecated_text = escape_html_entities(deprecated_text); | ||||
| 
 | ||||
|             auto text = MUST(Web::Infra::strip_and_collapse_whitespace(deprecated_text)); | ||||
|             builder.appendff("<span data-node-type=\"text\" data-text=\"{}\" class=\"hoverable editable\" {}>", text, data_attributes.string_view()); | ||||
|             builder.appendff("<span data-node-type=\"text\" class=\"hoverable editable\" {}>", data_attributes.string_view()); | ||||
| 
 | ||||
|             if (text.is_empty()) | ||||
|                 builder.appendff("<span class=\"internal\">{}</span>", name); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy Flynn
						Timothy Flynn