Merge pull request #693 from friday/fix/instanceof-undefined
v3: Add instanceof wrapper to avoid TypeErrors
This commit is contained in:
commit
34d28a69ad
@ -373,10 +373,10 @@
|
|||||||
return input !== null && input instanceof Event;
|
return input !== null && input instanceof Event;
|
||||||
},
|
},
|
||||||
cue: function(input) {
|
cue: function(input) {
|
||||||
return input !== null && (input instanceof window.TextTrackCue || input instanceof window.VTTCue);
|
this.instanceOf(input, window.TextTrackCue) || this.instanceOf(input, window.VTTCue);
|
||||||
},
|
},
|
||||||
track: function(input) {
|
track: function(input) {
|
||||||
return input !== null && (input instanceof window.TextTrack || typeof input.kind === 'string');
|
return input !== null && (this.instanceOf(input, window.TextTrack) || typeof input.kind === 'string');
|
||||||
},
|
},
|
||||||
undefined: function(input) {
|
undefined: function(input) {
|
||||||
return input !== null && typeof input === 'undefined';
|
return input !== null && typeof input === 'undefined';
|
||||||
@ -389,6 +389,9 @@
|
|||||||
(this.object(input) && Object.keys(input).length === 0)
|
(this.object(input) && Object.keys(input).length === 0)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
instanceOf: function(input, constructor) {
|
||||||
|
return Boolean(input && constructor && input instanceof constructor);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Credits: http://paypal.github.io/accessible-html5-video-player/
|
// Credits: http://paypal.github.io/accessible-html5-video-player/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user