Does IE8 support 'this' properly on events now ?

A

Aaron Gray

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

It certainly confuses things if it does !

Aaron
 
T

Thomas 'PointedEars' Lahn

Aaron said:
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
 
A

Aaron Gray

Thomas 'PointedEars' Lahn said:
Support by beta versions or lack thereof is never a big issue.


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
 
R

RobG

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<event> property 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?
 
D

dhtml

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<event> property 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
 
T

Thomas 'PointedEars' Lahn

dhtml said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top