- From: Kyle Simpson <getify@gmail.com>
- Date: Sat, 10 Sep 2011 10:11:36 -0500
> In regards to all the concern about double-firing of load detection logic, > IE9 added both `onload` event firing to their existing script element's > `onreadystatechange` firing. That's been around now for 6 months (not to > mention the year long platform-preview stage where content was tested in > IE9 relentlessly). > > AFAIK, there've been no major compat problems with that. Why? Because most > script loaders were already aware of a case (in Opera) where the load > handler might be fired twice, and so were already doing the filtering with > the "loaded" flag. LABjs has done exactly that for over 2 years now, as > have almost all other script loaders since. This is hardly something new. Furthermore, this problem only presents itself if a script loader listens for both the `onload` and the `onreadystatechange` events. Prior to IE9, Opera was the only one to fire both, and now IE9+ and Opera fire both, but in any case, script loaders that were concerned with working correctly cross-browser have had to, for several years now, either: * listen only for one event or the other, but not both (some do this) * listen for both events, and keep a flag to filter if the handler is double-fired (most do this) In either case, those are reasonable and long-established well-known work-arounds for the double-firing. Any script loader logic which isn't currently doing one of those two things is already *years* behind the times (and thus has been ostensibly broken in Opera/IE9 for years), regardless of the proposed (and now reverted) change of spec'ing `onreadystatechange` for script elements that other browsers might have picked up on. --Kyle
Received on Saturday, 10 September 2011 08:11:36 UTC