By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,599 Members | 1,872 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,599 IT Pros & Developers. It's quick & easy.

Does IE8 support 'this' properly on events now ?

P: n/a
Here's a big issue, does IE8 support 'this' properly on events now ?

It certainly confuses things if it does !

Aaron

Jul 20 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Aaron Gray wrote:
Here's a big issue, does IE8 support 'this' properly on events now ?
Support by beta versions or lack thereof is never a big issue.
It certainly confuses things if it does !
IE 8 is certainly irrelevant at this point. If you are interested in it
without having to update, there is IETester.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jul 20 '08 #2

P: n/a
"Thomas 'PointedEars' Lahn" <Po*********@web.dewrote in message
news:48**************@PointedEars.de...
Aaron Gray wrote:
>Here's a big issue, does IE8 support 'this' properly on events now ?

Support by beta versions or lack thereof is never a big issue.
>It certainly confuses things if it does !

IE 8 is certainly irrelevant at this point. If you are interested in it
without having to update, there is IETester.
Thanks (not sure of the quality of the app though).

Aaron

Jul 20 '08 #3

P: n/a
On Jul 20, 11:10*am, "Aaron Gray" <ang.use...@gmail.comwrote:
Here's a big issue, does IE8 support 'this' properly on events now ?
The inference here is that IE's setting of the value of a listener's
this keyword (presumably added using attachEvent) is not proper (or
wrong), however, there is limited circumstantial evidence to support
that assertion.

IE's behaviour in this regard is inconsistent with its behaviour for
listeners assigned to an element's on<eventproperty directly,
however its behaviour is consistent with in-line listeners as
implemented by all browsers (as far as I know).

You might call that inconvenient, but it isn't improper in the sense
of being wrong.

It certainly confuses things if it does !
Only if the change breaks code designed to work with IE's current
implementation. I don't think it will, though it might result in
handlers being attached inefficiently (i.e. they might end up using
call or apply where it isn't necessary).

The logical way for IE to support the W3C event model is to implement
addEventListener according to the W3C DOM 3 specification and leave
attachEvent as it is (though I think the chance of that happening is
very small).

Provided normalising "addEvent"-type functions test for
addEventListener first, I don't see any issues at all, do you?
--
Rob
Jul 21 '08 #4

P: n/a
On Jul 20, 7:51*pm, RobG <rg...@iinet.net.auwrote:
On Jul 20, 11:10*am, "Aaron Gray" <ang.use...@gmail.comwrote:
Here's a big issue, does IE8 support 'this' properly on events now ?

The inference here is that IE's setting of the value of a listener's
this keyword (presumably added using attachEvent) is not proper (or
wrong), however, there is limited circumstantial evidence to support
that assertion.

IE's behaviour in this regard is inconsistent with its behaviour for
listeners assigned to an element's on<eventproperty directly,
however its behaviour is consistent with in-line listeners as
implemented by all browsers (as far as I know).
the thisArg in a legacy event is the object the event was attached to
in all browsers:

document.body.onclick = function() { alert(this.tagName); };

alert "BODY"

This isn't true for attribute on body in Firefox, due to a bug.
<body onclick="alert(this === windopw)">

FF: alert "true", same as window.onclick in FF

The logical way for IE to support the W3C event model is to implement
addEventListener according to the W3C DOM 3 specification and leave
attachEvent as it is (though I think the chance of that happening is
very small).
I agree with that. Having a half-assed hybrid MSIE/DOM Event-full-of-
bugs would be a serious goat-blower.

Garrett
--
Rob
Jul 21 '08 #5

P: n/a
dhtml wrote:
On Jul 20, 7:51 pm, RobG <rg...@iinet.net.auwrote:
>On Jul 20, 11:10 am, "Aaron Gray" <ang.use...@gmail.comwrote:
>>Here's a big issue, does IE8 support 'this' properly on events now ?
The inference here is that IE's setting of the value of a listener's
this keyword (presumably added using attachEvent) is not proper (or
wrong), however, there is limited circumstantial evidence to support
that assertion.

IE's behaviour in this regard is inconsistent with its behaviour for
listeners assigned to an element's on<eventproperty directly,
however its behaviour is consistent with in-line listeners as
implemented by all browsers (as far as I know).

the thisArg in a legacy event is the object the event was attached to
in all browsers:
.... that you *know* -- an important difference. That is not to say I know
a browser which works differently, however as it is general your statement
is not acceptable this way.
document.body.onclick = function() { alert(this.tagName); };

alert "BODY"

This isn't true for attribute on body in Firefox, due to a bug.
Whether it is a bug remains to be seen, as there is no public specification
supporting your assertion. I would only call it a peculiarity at this point.
<body onclick="alert(this === windopw)">

FF: alert "true", same as window.onclick in FF
Without the typo.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Jul 22 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.