Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var SAMPLE_END = 1000;
var SAMPLE_COUNT = 100;
var SAMPLE_INTERVAL = 10;
var nodesFromArray = require('./lib/nodes-from-array.js');
var assertChildNodesFromArray = require('./lib/assert-childNodes-from-array.js');
var diff = require('../vtree/diff');
var render = require('../create-element.js');
var patch = require('../patch.js');
var assert = require('assert');
var document = require('global/document');
var testlingOutput = document.getElementById('__testling_output');
if (testlingOutput) {
testlingOutput.parentNode.removeChild(testlingOutput);
}
runTest();
// validateOnly();
// benchmarkOnly();
function runTest() {
forEachPermutation(PERMUTATION_START, PERMUTATION_END, testArrays);
forEachSample(SAMPLE_START, SAMPLE_END, SAMPLE_COUNT, SAMPLE_INTERVAL, testArrays);
}
function testArrays(arrays) {
runSort(arrays);
runBench(arrays);
beforeEach() {
this.fixture = document.getElementById('qunit-fixture');
this.video = document.createElement('video');
this.fixture.appendChild(this.video);
this.player = videojs(this.video);
// Mock the environment's timers because certain things - particularly
// player readiness - are asynchronous in video.js 5.
this.clock = sinon.useFakeTimers();
this.oldMediaSource = window.MediaSource || window.WebKitMediaSource;
},
constructor (node, o) {
const
t = this,
element = typeof node === 'string' ? document.getElementById(node) : node
;
// enforce object, even without "new" (via John Resig)
if (!(t instanceof MediaElementPlayer)) {
return new MediaElementPlayer(element, o);
}
// these will be reset after the MediaElement.success fires
// t.media will be the fake node to emulate all HTML5 events, methods, etc
// t.node will be the node to be restored
t.node = t.media = element;
if (!t.node) {
return;
}
Node: function (id, jlNode, el, renderOpts) {
if (typeof(el) === "undefined") {
el = document.getElementById(id)
}
this.id = id
this.renderOptions = renderOpts
if (jlNode) {
// Note: makes this.root
var vnode = P.makeVNode(jlNode)
P.log("makeVNode: ", jlNode, "=>", vnode)
this.mount(vnode, el, renderOpts)
}
P.nodes[id] = this
},
NAMESPACES: {
Node: function (id, jlNode, el) {
if (typeof(el) === "undefined") {
el = document.getElementById(id)
}
this.id = id
if (jlNode) {
// Note: makes this.root
var vnode = P.makeVNode(jlNode)
P.log("makeVNode: ", jlNode, "=>", vnode)
this.mount(vnode, el)
}
P.nodes[id] = this
},
NAMESPACES: {
Node: function (id, jlNode, el, renderOpts) {
if (typeof(el) === "undefined") {
el = document.getElementById(id)
}
this.id = id
this.renderOptions = renderOpts
if (jlNode) {
// Note: makes this.root
var vnode = P.makeVNode(jlNode)
P.log("makeVNode: ", jlNode, "=>", vnode)
this.mount(vnode, el, renderOpts)
}
P.nodes[id] = this
},
NAMESPACES: {
Node: function (id, jlNode, el, renderOpts) {
if (typeof(el) === "undefined") {
el = document.getElementById(id)
}
this.id = id
this.renderOptions = renderOpts
if (jlNode) {
// Note: makes this.root
var vnode = P.makeVNode(jlNode)
P.log("makeVNode: ", jlNode, "=>", vnode)
this.mount(vnode, el, renderOpts)
}
P.nodes[id] = this
},
NAMESPACES: {
linker.elem = fn => fn
? elem(fn)
: elem() || document.getElementById(props.id)
get: function () {
var el = document.getElementById(self._id)
if (el) return el.dataset.nanocomponent === self._ncID ? el : undefined
}
})
mutateSelectedIndex (newIndex) {
var oldIndex = this.selectedIndex
var oldEl = document.getElementById(`track-${oldIndex}`)
var newEl = document.getElementById(`track-${newIndex}`)
if (oldEl) oldEl.classList.toggle(styles.selected, false)
if (newEl) newEl.classList.toggle(styles.selected, true)
if (this.selectedIndex != null) {
const selected = document.querySelector(styles.selected.selector)
if (selected != null) selected.scrollIntoViewIfNeeded(false)
}
this.selectedIndex = newIndex
}