On Mar 16, 12:52 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
Peter Michaux wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Peter Michaux wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Peter Michaux wrote:
I recently explored some "jerk" problems and cross-browser loading.
<URL:http://peter.michaux.ca/article/7217>
One of these "jerk problems" that you miss is that some people keep
advocating to use only the proprietary, inherently unreliable
`window.onload' property
I feature tested for addEventListener and attachEvent on the global
object.
That is only as error-prone.
Why?
Because the Global Object is a native object, not a DOM host object. It
does not need to implement the EventTarget interface of W3C DOM Level 2+
Events or another API.
I'm not so hung up about standardized DOM objects vs non-standard
objects. I use XMLHttpRequest objects based on feature tests. If I
feature test that the global object has addEventListener then it is a
reasonably safe bet the global object will support the onload event.
You should forego attachEvent()
And do what for IE?
Either window.onload or (better) the `onload' attribute of the `body' element.
Well if I was doing that for IE then I would probably just do that for
all browsers.
I've seen in your libray code (
http://pointedears.de/scripts/dhtml.js)
that you don't use attachEvent but the reason sited in the comments
did not seem compelling. In the following page which you site
http://www.quirksmode.org/blog/archi...nt_consid.html
PPK seems quite excited about the fact that the "this" keyword doesn't
work the same in the event handlers for IE and W3C. This may have been
an issue when PPK wrote the article but it is no longer considered an
insurmountable challenge for an event library to correct.
[snip]
Peter