Does IE8 support 'this' properly on events now ?

Discussion in 'Javascript' started by Aaron Gray, Jul 20, 2008.

  1. Aaron Gray

    Aaron Gray Guest

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

    It certainly confuses things if it does !

    Aaron
     
    Aaron Gray, Jul 20, 2008
    #1
    1. Advertising

  2. 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>
     
    Thomas 'PointedEars' Lahn, Jul 20, 2008
    #2
    1. Advertising

  3. Aaron Gray

    Aaron Gray Guest

    "Thomas 'PointedEars' Lahn" <> wrote in message
    news:...
    > 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
     
    Aaron Gray, Jul 21, 2008
    #3
  4. Aaron Gray

    RobG Guest

    On Jul 20, 11:10 am, "Aaron Gray" <> wrote:
    > 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?


    --
    Rob
     
    RobG, Jul 21, 2008
    #4
  5. Aaron Gray

    dhtml Guest

    On Jul 20, 7:51 pm, RobG <> wrote:
    > On Jul 20, 11:10 am, "Aaron Gray" <> wrote:
    >
    > > 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).
    >


    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
     
    dhtml, Jul 21, 2008
    #5
  6. dhtml wrote:
    > On Jul 20, 7:51 pm, RobG <> wrote:
    >> On Jul 20, 11:10 am, "Aaron Gray" <> wrote:
    >>> 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).

    >
    > 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
     
    Thomas 'PointedEars' Lahn, Jul 22, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cwdjrxyz
    Replies:
    0
    Views:
    345
    cwdjrxyz
    Apr 28, 2009
  2. Jim S
    Replies:
    14
    Views:
    1,186
    Jim S
    Jun 29, 2009
  3. LenaMsdn08
    Replies:
    3
    Views:
    944
    LenaMsdn08
    Oct 5, 2009
  4. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    380
    Chris
    Aug 30, 2005
  5. cecile

    ie8!=ie8

    cecile, May 24, 2010, in forum: Javascript
    Replies:
    2
    Views:
    193
    David Mark
    May 24, 2010
Loading...

Share This Page