YouTube Wrapper's event.target property points at document

RESOLVED INCOMPLETE

Status

RESOLVED INCOMPLETE
5 years ago
2 years ago

People

(Reporter: markp, Assigned: thecount)

Tracking

Details

(Reporter)

Description

5 years ago
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)

Updated

5 years ago
Assignee: nobody → scott
(Reporter)

Comment 1

5 years ago
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;
(Reporter)

Comment 2

5 years ago
The event.detail.target points at the DOM element the YouTube wrapper was instance on.
(Reporter)

Comment 3

5 years ago
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
Last Resolved: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.