#519 enhancement
Daniel Varga

Enhancement: currentTarget support in IE

Reported by Daniel Varga | January 11th, 2009 @ 07:37 PM

I suggested a way to add currentTarget support in IE. Here is the modified observe function.


observe: function(element, eventName, handler) {
      element = $(element);
      var name = getDOMEventName(eventName);

      var wrapper = createWrapper(element, eventName, handler);
      if (!wrapper) return element;

      if (element.addEventListener) {
        element.addEventListener(name, wrapper, false);
      } else {
          // instead of:
          // element.attachEvent("on" + name, wrapper);
          element.attachEvent("on" + name, function(e){
              e.currentTarget = element;
              wrapper(e);
          });
      }

      return element;
    }

There might be some problems with this solution. I personally do not completely understand how prototype works therefore this solution might screw up the wrapper process. At least Diego Perini said so. ^_^

Regards

Comments and changes to this ticket

  • Tobie Langel

    Tobie Langel January 12th, 2009 @ 01:07 AM

    • Tag changed from currenttarget, enhancement, observe to event
    • State changed from “new” to “enhancement”
  • Yaffle

    Yaffle April 7th, 2009 @ 12:34 PM

    • Tag changed from event to event, needs_patch, needs_tests

    Why not to use "this" ie IE?

    
    
    element.attachEvent("on" + name, function(e){
      e.currentTarget = this;
      wrapper(e);
    });
    
    
  • Yaffle

    Yaffle April 7th, 2009 @ 05:55 PM

    Sorry, prototype currently caches element and calls event handler with this==event.currentTarget... Am I right?

  • Yaffle

    Yaffle April 7th, 2009 @ 06:10 PM

    
    
    Function.prototype.bindAsEventListener = function (context) {
      var __method = this, args = slice.call(arguments, 1);
      return function(event) {
        var a = update([event || window.event], args);
        a[0].currentTarget = this; // added
        return __method.apply(context, a);
      }
    };
    
    
  • Yaffle

    Yaffle April 7th, 2009 @ 06:11 PM

    
    
    Function.prototype.bindAsEventListener = function (context) {
      var __method = this, args = slice.call(arguments, 1);
      return function(event) {
        var a = update([event || window.event], args);
        a[0].currentTarget = a[0].currentTarget ||this; // added
        return __method.apply(context, a);
      }
    };
    
    
  • Yaffle

    Yaffle April 7th, 2009 @ 06:14 PM

    ... no modification allowed error ... =) So

    
    
    Function.prototype.bindAsEventListener = function (context) {
      var __method = this, args = slice.call(arguments, 1);
      return function(event) {
        var a = update([event || window.event], args);
    	if(!('currentTarget' in a[0])) // added
          a[0].currentTarget = this;   // added
        return __method.apply(context, a);
      }
    };
    
    
  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 02:26 AM

    • Tag changed from event, needs_patch, needs_tests to event, missing:tests, needs_patch

    [not-tagged:"needs_tests" tagged:"missing:tests" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 02:28 AM

    • Tag changed from event, missing:tests, needs_patch to event, missing:patch, missing:tests

    [not-tagged:"needs_patch" tagged:"missing:patch" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 03:36 AM

    • Tag changed from event, missing:patch, missing:tests to event, missing:patch, needs:tests

    [not-tagged:"missing:tests" tagged:"needs:tests" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 03:37 AM

    • Tag changed from event, missing:patch, needs:tests to event, needs:patch, needs:tests

    [not-tagged:"missing:patch" tagged:"needs:patch" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 03:42 AM

    • Tag changed from event, needs:patch, needs:tests to needs:patch, needs:tests, section:dom

    [not-tagged:"event" tagged:"section:dom" bulk edit command]

  • T.J. Crowder

    T.J. Crowder November 16th, 2009 @ 04:50 PM

    • Assigned user cleared.

    [responsible:none bulk edit command]

  • jayanthchandra176

    jayanthchandra176 January 12th, 2018 @ 03:30 PM

    Ashwin hasn't liked a T20 for over every year now and it remains to be regarded if the franchise gets prepared to commit on a whole new player, who's just just forget about a make to reckon with in the shortest format of the experience. The matter that can allow CSK to reckon and go for the to CHECK UP ON (RTM) is his local attach being the most successful international cricketer to emerge from Tamil Nadu.
    The top features of young all-rounder M S Washington Sundar, as a robust off-spinner through the IPL 2017 in addition has made Ashwin's keep returning chances in CSK convert bleak. , the burkha Indies' Dwayne Bravo is one international player, who can be expected to be bought through RTM charge cards. The other internationally players, who are in fray are Faf du Plessis and Brendon McCullum.
    IPL 2018 Schedule PDF Download

  • Ahmed Khan
  • Ahmed Khan

    Ahmed Khan February 1st, 2018 @ 05:25 PM

    Chennai Super Kings and Rajasthan Royals have been re-included in the 2018 league after serving two years of suspension from the competition due to the involvement of their players in the 2013 IPL betting scandal. The two franchises which had replaced them between 2015 and 2017 - Rising Pune Supergiant and Gujarat Lions are not returning in 2018.

    One particular clause of the retention policy, though very inconspicuous, has major consequences. This clause concerns the new dynamic pricing involved in salary purse cuts based on the number of players retained.

    Among the decisions taken was to allow Rajasthan Royals and Chennai Super Kings to retain players from their 2015 squads, who are not playing for any other franchise, and to set in place the five-player buy-back rule which includes option of doing so with three retentions and two matching cards, or two retentions and three matching cards.
    IPL 2018 Schedule

  • ec india
  • iploverview

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

Pages