Bug 6598
Summary: | Should support IE Node methods attachEvent and detachEvents | ||
---|---|---|---|
Product: | WebKit | Reporter: | Anders Carlsson <andersca> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | Normal | CC: | aestes, ahmad.saleem792, annevk, ap, bdakin, ddkilzer, ian, rjiang, rniwa, zalan |
Priority: | P2 | Keywords: | InRadar |
Version: | 420+ | ||
Hardware: | Mac | ||
OS: | OS X 10.4 |
Anders Carlsson
Documentation at
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/attachevent.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/detachevent.asp
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Justin Haygood
A shared implementation with the W3C methods is possible.
attatchEvent("onload",functionRef) is 100% equivalent to addEventListener
("load",functionRef,false) for instance
Alexey Proskuryakov
Fixing this would fix bug 8534.
Alexey Proskuryakov
<http://www.quirksmode.org/blog/archives/2005/08/addevent_consid.html>: "addEventListener and attachEvent should not be considered equal".
This talks about the meaning of "this" keyword; looking at the documentation, the bubbling/canceling traits of similar IE and W3C events are also different.
Anders Carlsson
We don't need to implement attachEvent and detachEvent in order to support live.com or start.com since the Mozilla compat layer is used which provides implementations of those functions
Dave Hyatt
This is one of those areas I'm nervous about supporting.
Dave Hyatt
If we added support for this, there are sites that would take us down the IE event handling code path. I'd rather wait to see if this is a real-world problem before adding support for it.
Justin Haygood
Couldn't this take the same approach as the hidden document.all support?
Support it if its used, but not if its tested for directly:
site does window.attachEvent("load",function); // Works
site does if( window.attachEvent ) window.attachEvent("load",function); // Doesn't, since window.attachEvent is "hidden".
Darin Fisher (:fishd, Google)
here's a real website (popular in the alexa rankings) that depends on attachEvent:
http://house.vnet.cn
granted, it uses attachEvent to scroll some advertisements as you scroll the page!
Maciej Stachowiak
Well noted. Should we have a keyword to mark bugs that affect sites which are popular in the Alexa rankings?
Also, is there any way to quantify the risk of sites giving us the IE-compatibility event handling code path that Hyatt mentioned? I would hope most sites would use addEventListener in preference to attachEvent when both are available, but it's hard to be certain.
As a side note, I believe Opera supports the IE event handling methods.
Alexey Proskuryakov
(In reply to comment #9)
> Also, is there any way to quantify the risk of sites giving us the
> IE-compatibility event handling code path that Hyatt mentioned?
It seems that testing for attachEvent is a very common way to detect IE, so it clearly needs to be invisible if implemented. See, for example, <http://dev.rubyonrails.org/ticket/6800>.
David Kilzer (:ddkilzer)
The left navigation panel of the MSDN site requires attachEvent/detachEvent:
http://msdn2.microsoft.com/en-us/library/ms536694.aspx
Because Firefox implements these DOM methods, the left nav panel works when this page is loaded on it. See the JavaScript in this file as well:
http://msdn2.microsoft.com/App_scripts/ssmoz.js
Ian 'Hixie' Hickson
I don't understand the last comment -- Firefox doesn't support attachEvent(), and both Safari and Firefox are given attachEvent proxies in the aforementioned compat layer.
David Kilzer (:ddkilzer)
(In reply to comment #12)
> I don't understand the last comment -- Firefox doesn't support attachEvent(),
> and both Safari and Firefox are given attachEvent proxies in the aforementioned
> compat layer.
Perhaps the compat layer is not being activated with Safari 3, then. Sorry...didn't look very deeply into the JavaScript code.
David Kilzer (:ddkilzer)
(In reply to comment #13)
> (In reply to comment #12)
> > I don't understand the last comment -- Firefox doesn't support attachEvent(),
> > and both Safari and Firefox are given attachEvent proxies in the aforementioned
> > compat layer.
>
> Perhaps the compat layer is not being activated with Safari 3, then.
> Sorry...didn't look very deeply into the JavaScript code.
And this would be Bug 13546!
Rui Jiang
Another example of site using this:
https://personal.bank.ecitic.com:444/js/menu4.js
This is top 7th bank in China. Log in with IE from https://personal.bank.ecitic.com:444 (you need an account though)
Andy Estes
<rdar://problem/7867748>
Anne van Kesteren
(In reply to comment #9)
> As a side note, I believe Opera supports the IE event handling methods.
We are in the process of removing support for these.
Ahmad Saleem
Can this bug be closed since even IE11 dropped the support for "attachEvent" in 2013 (release date) and now IE11 is also getting marked as EOL / EOS tomorrow (based on my timezone).
https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa703974(v=vs.85)
Ryosuke Niwa
Yeah, this is "won't fix"