> 2. Fire a simple event named beforescriptexecute that bubbles and is cancelable at the script element. > If the event is canceled, then abort these steps. > (snip) > 6. Fire a simple event named afterscriptexecute that bubbles (but is not cancelable) at the script element. http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#the-script-element
Do other browsers support this?
(In reply to comment #1) > Do other browsers support this? Yes, it's Firefox 4+(Gecko 2+). https://bugzilla.mozilla.org/show_bug.cgi?id=587931 https://developer.mozilla.org/en/DOM/element.onbeforescriptexecute https://developer.mozilla.org/en/DOM/element.onafterscriptexecute By the way, Opera's User JavaScript has BeforeScript/AfterScript event. http://www.opera.com/docs/userjs/specs/#BeforeScript http://www.opera.com/docs/userjs/specs/#AfterScript But, I'm not sure whether current Firefox's implementation follow HTML spec. related: http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-February/034629.html http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-May/035713.html
I can confirm this bug with Chrome v23.0.1271.97 on 64-bit Debian Unstable. Both Iceweasel v10.0.11 and Opera v12.12 support "beforescriptexecute" whereas Chrome v23.0.1271.97 does not.
Just ran into this bug in Chrome 25.0.1364.97 [537.22 (@143379)]. Please add support to match firefox support and comply with the spec.
Ran into this bug myself. Not having this functionality is very frustrating, specially when making userscripts.
Now that beforeload, which used to be the only workaround, is no longer supported (https://code.google.com/p/chromium/issues/detail?id=333318), this bug appears more urgent than ever. :(
This is now covered by LayoutTests/http/tests/w3c/html/semantics/scripting-1/the-script-element/script-before-after-events.html
<rdar://problem/22588270>
Advertisers have started to bypass adblockers by using special inline scripts. Recent approaches for analyzing and blocking these scripts (e.g. https://openuserjs.org/scripts/schwarztee/AdDefend_Klatsche/source) won't work in webkit unless these events are implemented!
Come on guys, Firefox already implemented this, you didn't. Therefore WebKit browsers fail certain HTML5 tests, like this one: http://www.w3c-test.org/html/semantics/scripting-1/the-script-element/script-before-after-events.html Firefox passes all these tests. I thought WebKit is all about supporting standards like HTML5?
This is very important functionality. The developers of AdBlock Plus (one of the most installed addons) need this to implement a new feature: https://issues.adblockplus.org/ticket/3207 But they can't because Chromium developers refuse to implement a feature that is officially part of the W3C HTML5 standard.
A polyfill : https://github.com/dosaygo/open-0/tree/master/script-events
This is no longer in the spec, so if you actually want to implement it, you should probably get it re-added to the spec first.
Mass move bugs into the DOM component.
We're not going to implement this non-standard event, which has been removed from the spec.