How to use the global/document.getElementById function in global

To help you get started, we’ve selected a few global examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Matt-Esch / virtual-dom / test / sort.js View on Github external
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);
github videojs / videojs-contrib-media-sources / test / videojs-contrib-media-sources.js View on Github external
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;
  },
github mediaelement / mediaelement / src / js / player.js View on Github external
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;
		}
github JuliaGizmos / Escher.jl / behavior-api.html View on Github external
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: {
github shashi / Patchwork.jl / runtime / build.js View on Github external
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: {
github JuliaGizmos / Escher.jl / signal-api.html View on Github external
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: {
github JuliaGizmos / Escher.jl / slideshow-api.html View on Github external
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: {
github kigiri / learn / src / lib / dom-linker.js View on Github external
linker.elem = fn => fn
    ? elem(fn)
    : elem() || document.getElementById(props.id)
github choojs / nanocomponent / index.js View on Github external
get: function () {
      var el = document.getElementById(self._id)
      if (el) return el.dataset.nanocomponent === self._ncID ? el : undefined
    }
  })
github hypermodules / hyperamp / renderer / player / elements / playlist / track-view.js View on Github external
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
  }