Closed GoogleCodeExporter closed 9 years ago
Original comment by bradneub...@gmail.com
on 22 Jun 2010 at 11:13
A simple test case reproducing the issue.
Original comment by cdeon...@gmail.com
on 24 Jun 2010 at 7:17
Attachments:
The diff between Dracolisk and Gelatinous Cube that appears to be causing the
problem:
} else {
window.addEventListener = function (type, f, useCapture) {
if (type.toLowerCase() == "svgload") {
svgweb.addOnLoad(f);
}
};
Original comment by cdeon...@gmail.com
on 24 Jun 2010 at 7:36
How is this causing the issue? Note that the latest SVG Web release requires
you to subscribe to the SVGLoad event rather than intercepting window.onload.
Original comment by bradneub...@gmail.com
on 25 Jun 2010 at 6:32
I should have mentioned that removing the above code allows the alert to
display on IE. I'm examining it further.
Original comment by cdeon...@gmail.com
on 26 Jun 2010 at 2:06
The problem is that we are patching a barely functional window.addEventListener
into IE and jquery is fooled into using it for the scroll event, which is
silently ignored.
jquery has this code in jQuery.event.add:
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
The question is whether we try to do a better job at implementing
window.addEventListener for IE which is not too hard to do (by just passing on
to attachEvent), or do we decide that this may do more harm that good, say if
another library or page developer infers too much from the existence of
window.addEventListener and does something that does not work?
Original comment by grick23@gmail.com
on 26 Jun 2010 at 2:14
The following code is from jquery. While this is for document instead of
window, the example demonstrates the point I was making in the previous
comment. This code assumes that if addEventListener is implemented, then
removeEventListener is also implemented. In this code, if removeEventListener
is not implemented, an exception would probably be thrown here and the library
would never initialize. So, we should consider that someone could do the same
kind of thing for the load event on the window.
// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
};
Original comment by grick23@gmail.com
on 26 Jun 2010 at 2:31
Good point Rick. Since SVG Web is an emulation library I want to keep things
patched in as much as possible; we should probably go the distance and just
implement addEventListener to pass through to attachEvent for exactly the
reason you just pointed out.
Original comment by bradneub...@gmail.com
on 27 Jun 2010 at 12:34
I've created this patch which simply modifies the window.addEventListener to
pass through to attachEvent in the case that it's IE. I'm not an expert in
Javascript or the present codeline, so would someone be able to review it for
correctness? I have verified that the fix allows the alert to display for the
test case I created.
Original comment by cdeon...@gmail.com
on 28 Jun 2010 at 12:47
Attachments:
Original comment by bradneub...@gmail.com
on 28 Jun 2010 at 4:12
Fixed in r1200.
Original comment by grick23@gmail.com
on 2 Jul 2010 at 2:54
Original issue reported on code.google.com by
FlorinaM...@gmail.com
on 22 Jun 2010 at 10:16