Skip to content

Commit

Permalink
@andyearnshaw updated document event handlers to use el.ownerDocument.
Browse files Browse the repository at this point in the history
…closes #3230
  • Loading branch information
andyearnshaw authored and gkatsev committed Apr 5, 2016
1 parent fa27cc7 commit b254fb7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CHANGELOG
* @forbesjo added chrome for PR tests ([view](https://github.com/videojs/video.js/pull/3235))
* @MCGallaspy added vttjs to the self-hosting guide ([view](https://github.com/videojs/video.js/pull/3229))
* @chrisauclair added ARIA region and label to player element ([view](https://github.com/videojs/video.js/pull/3227))
* @andyearnshaw updated document event handlers to use el.ownerDocument ([view](https://github.com/videojs/video.js/pull/3230))

--------------------

Expand Down
3 changes: 1 addition & 2 deletions src/js/control-bar/volume-menu-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Popup from '../popup/popup.js';
import PopupButton from '../popup/popup-button.js';
import MuteToggle from './mute-toggle.js';
import VolumeBar from './volume-control/volume-bar.js';
import document from 'global/document';

/**
* Button for volume popup
Expand Down Expand Up @@ -132,7 +131,7 @@ class VolumeMenuButton extends PopupButton {

handleMouseDown(event) {
this.on(['mousemove', 'touchmove'], Fn.bind(this.volumeBar, this.volumeBar.handleMouseMove));
this.on(document, ['mouseup', 'touchend'], this.handleMouseUp);
this.on(this.el_.ownerDocument, ['mouseup', 'touchend'], this.handleMouseUp);
}

handleMouseUp(event) {
Expand Down
6 changes: 2 additions & 4 deletions src/js/modal-dialog.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/**
* @file modal-dialog.js
*/
import document from 'global/document';

import * as Dom from './utils/dom';
import * as Fn from './utils/fn';
import log from './utils/log';
Expand Down Expand Up @@ -175,7 +173,7 @@ class ModalDialog extends Component {
}

if (this.closeable()) {
this.on(document, 'keydown', Fn.bind(this, this.handleKeyPress));
this.on(this.el_.ownerDocument, 'keydown', Fn.bind(this, this.handleKeyPress));
}

player.controls(false);
Expand Down Expand Up @@ -221,7 +219,7 @@ class ModalDialog extends Component {
}

if (this.closeable()) {
this.off(document, 'keydown', Fn.bind(this, this.handleKeyPress));
this.off(this.el_.ownerDocument, 'keydown', Fn.bind(this, this.handleKeyPress));
}

player.controls(true);
Expand Down
25 changes: 14 additions & 11 deletions src/js/slider/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import Component from '../component.js';
import * as Dom from '../utils/dom.js';
import document from 'global/document';
import assign from 'object.assign';

/**
Expand Down Expand Up @@ -68,16 +67,18 @@ class Slider extends Component {
* @method handleMouseDown
*/
handleMouseDown(event) {
let doc = this.bar.el_.ownerDocument;

event.preventDefault();
Dom.blockTextSelection();

this.addClass('vjs-sliding');
this.trigger('slideractive');

this.on(document, 'mousemove', this.handleMouseMove);
this.on(document, 'mouseup', this.handleMouseUp);
this.on(document, 'touchmove', this.handleMouseMove);
this.on(document, 'touchend', this.handleMouseUp);
this.on(doc, 'mousemove', this.handleMouseMove);
this.on(doc, 'mouseup', this.handleMouseUp);
this.on(doc, 'touchmove', this.handleMouseMove);
this.on(doc, 'touchend', this.handleMouseUp);

this.handleMouseMove(event);
}
Expand All @@ -95,15 +96,17 @@ class Slider extends Component {
* @method handleMouseUp
*/
handleMouseUp() {
let doc = this.bar.el_.ownerDocument;

Dom.unblockTextSelection();

this.removeClass('vjs-sliding');
this.trigger('sliderinactive');

this.off(document, 'mousemove', this.handleMouseMove);
this.off(document, 'mouseup', this.handleMouseUp);
this.off(document, 'touchmove', this.handleMouseMove);
this.off(document, 'touchend', this.handleMouseUp);
this.off(doc, 'mousemove', this.handleMouseMove);
this.off(doc, 'mouseup', this.handleMouseUp);
this.off(doc, 'touchmove', this.handleMouseMove);
this.off(doc, 'touchend', this.handleMouseUp);

this.update();
}
Expand Down Expand Up @@ -166,7 +169,7 @@ class Slider extends Component {
* @method handleFocus
*/
handleFocus() {
this.on(document, 'keydown', this.handleKeyPress);
this.on(this.bar.el_.ownerDocument, 'keydown', this.handleKeyPress);
}

/**
Expand All @@ -191,7 +194,7 @@ class Slider extends Component {
* @method handleBlur
*/
handleBlur() {
this.off(document, 'keydown', this.handleKeyPress);
this.off(this.bar.el_.ownerDocument, 'keydown', this.handleKeyPress);
}

/**
Expand Down

0 comments on commit b254fb7

Please sign in to comment.