If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

YouTube Wrapper's event.target property points at document

RESOLVED INCOMPLETE

Status

Webmaker
popcorn.js
RESOLVED INCOMPLETE
4 years ago
6 months ago

People

(Reporter: Mark Panaghiston, Assigned: thecount)

Tracking

Details

(Reporter)

Description

4 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

4 years ago
Assignee: nobody → scott
(Reporter)

Comment 1

4 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

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

Comment 3

4 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: 6 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.