Ticket #2529150 (closed defect)

Reporter


Nate Cavanaugh
Opened: 08/2/10
Last modified: 09/7/10
Status: closed
Type: defect
Resolution: fixed

Owner


Satyen Desai
Target Release: 3.2.0
Priority: P3 (normal)
Summary: Gesture events ignore listener context passed as the last parameter
Description:

When you add a listener using the gesture* events, the context is ignored when passed as the last parameter. Instead "this" always points to the node to which the event is bound.

All other types of event subscription allow something like:
Y.on('click', fn, document, Y);
or
Y.one(document).on('click', fn, Y);
And when the click event happens "this" will point to Y.

However in this case:
Y.on('gesturemovestart', fn, document, Y);

The execution context will always point to Y.

Type: defect Observed in Version: development master
Component: Event Severity: S3 (normal)
Assigned To: Satyen Desai Target Release: 3.2.0
Location: API Documentation Priority: P3 (normal)
Tags: Relates To:
Browsers: N/A
URL:
Test Information:

Change History

Adam Moore

YUI Contributor

Posted: 08/2/10
  • owner changed from Adam Moore to Satyen Desai
  • priority changed to P3 (normal)
  • status changed from new to assigned

Satyen Desai

YUI Developer

Posted: 08/2/10
  • location changed to API Documentation
  • milestone changed to 3.2.0
  • status changed from assigned to accepted

The gesture synthetic events support a configuration object as the 3rd parameter.


* @event gesturemovestart
* @for YUI
* @param type {string} "gesturemovestart"
* @param fn {function} The method the event invokes. It receives the event facade of the underlying DOM event (mousedown or touchstart.touches[0]) which contains position coordinates.
* @param cfg {Object} Optional. An object which specifies: ...

If no custom configuration is required, a null needs to be passed in, to maintain subsequent arguments (context etc.). However, my general recommendation is to use Y.bind.

I can clean up the docs to be explicit about this. Marking the ticket API documentation accordingly.

Let me know if you disagree.

Satyen Desai

YUI Developer

Posted: 08/6/10
  • resolution changed to fixed
  • status changed from accepted to checkedin

Added API docs for context, additional args. Fixes #2529150
View Commit:

Satyen Desai

YUI Developer

Posted: 08/6/10

Added API docs for context, additional args. Fixes #2529150
View Commit:

George

YUI Developer

Posted: 09/7/10
  • status changed from checkedin to closed