dasmurphy / base2

Automatically exported from code.google.com/p/base2
0 stars 1 forks source link

window.addeventlistener does not work in IE #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I originally posted this as a comment on dean edwards site
(http://dean.edwards.name/weblog/2007/03/yet-another/#comment105638) but
was unable to follow up in a timely fashion.

What steps will reproduce the problem?

<pre>
base2.DOM.bind(document);
window.addEventListener("load", init, false);

function init(e) {
  alert("hello");
}
</pre>

What is the expected output? What do you see instead?

In firefox, the alert appears. In IE, it does not. IE gives the error
message; "Object doesn't support this property or method"

I did find out that the following works in both browsers.
<pre>
base2.DOM.bind(document);
document.addEventListener("DOMContentLoaded", init, false);

function init(e) {
  alert("hello");
}
</pre>

I'm going to assume using DOMContentLoaded is far superior than using
window.addEventListener.

Original issue reported on code.google.com by dullobj...@gmail.com on 11 Sep 2007 at 3:31

GoogleCodeExporter commented 9 years ago
document.addEventListener("DOMContentLoaded", init, false);

Is the preferred method. The window object is not a DOM object and has not been
standardised anywhere. Therefore I am reluctant to add support with this 
library.

This is a duplicate of Issue 27.

Original comment by dean.edw...@gmail.com on 11 Sep 2007 at 7:17