Closed Bug 946293 Opened 11 years ago Closed 7 years ago

YouTube Wrapper's event.target property points at document

Categories

(Webmaker Graveyard :: popcorn.js, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: markp, Assigned: thecount)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36

Steps to reproduce:

Created an event listener on the YouTube wrapper element and was using the event.target to look at the currentTime.

NB: The events generated by a video element have the event object with the target property pointing at the video element.


Actual results:

The event.target points at the root of the document


Expected results:

It should point at the YouTube wrapper element, thus enabling the following within the event:
event.target.currentTime
Assignee: nobody → scott
Not only does the event.target point to the document, the event handler's context (this) points to the document too.

For example, usually in a video element event handler you could do the following to access the element's properties:
  this.currentTime;
The event.detail.target points at the DOM element the YouTube wrapper was instance on.
After reviewing Custom Events this one is a little tricky... After all, usually the <video> element in the DOM is the event emitter and also the context of "this" and the event.target. While the YouTube wrapper is a JavaScript object that is dispatching a custom event on the DOM element used to embed the YouTube video.

The best that could be done would be:
* "this" points at the DOM element of the YouTube wrapper
* event.target points at the DOM element of the YouTube wrapper
* event.detail.target points at the YouTube Wrapper instance
We're deprecating the Webmaker Product on Bugzilla, so I'm marking this as resolved:incomplete

If this issue needs to be reopened, you can file it at https://github.com/mozilla/popcorn-js/issues/new
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.