filamentgroup / loadCSS

Load CSS asynchronously
MIT License
6.72k stars 534 forks source link

minify JavaScript onload #336

Closed mems closed 1 year ago

mems commented 2 years ago

DOM 0 event listeners provide scopes that bound to the element:

scope [...]

  1. If element is not null, then set scope to NewObjectEnvironment(element, true, scope).

https://html.spec.whatwg.org/multipage/webappapis.html#internal-raw-uncompiled-handler

That means you can use:

<img src="about:error" onerror="console.log(this,onerror,body,src)">

Will log:

  1. HTMLImageElement instance
  2. image DOM 0 event listener
  3. document.body
  4. image src property value