mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	LibWeb: Fire "load" and "error" events for rel=preload link loads
This commit is contained in:
		
							parent
							
								
									3cea86632d
								
							
						
					
					
						commit
						b97004ea4a
					
				
					 5 changed files with 34 additions and 5 deletions
				
			
		|  | @ -0,0 +1,20 @@ | |||
| <script src="include.js"></script> | ||||
| <script> | ||||
|     let goodLink = document.createElement("link"); | ||||
|     goodLink.setAttribute("rel", "preload"); | ||||
|     goodLink.setAttribute("href", "valid.css"); | ||||
|     goodLink.setAttribute("as", "style"); | ||||
|     goodLink.addEventListener("load", function() { | ||||
|         println("Got load event"); | ||||
|     }); | ||||
|     document.head.appendChild(goodLink); | ||||
| 
 | ||||
|     let badLink = document.createElement("link"); | ||||
|     badLink.setAttribute("rel", "preload"); | ||||
|     badLink.setAttribute("href", "this-file-does-not-exist-and-so-is-invalid.css"); | ||||
|     badLink.setAttribute("as", "style"); | ||||
|     badLink.addEventListener("error", function() { | ||||
|         println("Got error event"); | ||||
|     }); | ||||
|     document.head.appendChild(badLink); | ||||
| </script> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling