Sha256: aac8585897d1769dc6766573eeb2b3d51c6550105d739824e8d53cffbd8c926c

Contents?: true

Size: 1.17 KB

Versions: 20

Compression:

Stored size: 1.17 KB

Contents

"use strict";

const nwsapi = require("nwsapi");

const idlUtils = require("../generated/utils");

function initNwsapi(node) {
  const { _globalObject, _ownerDocument } = node;

  return nwsapi({
    document: _ownerDocument,
    DOMException: _globalObject.DOMException
  });
}

exports.matchesDontThrow = (elImpl, selector) => {
  const document = elImpl._ownerDocument;

  if (!document._nwsapiDontThrow) {
    document._nwsapiDontThrow = initNwsapi(elImpl);
    document._nwsapiDontThrow.configure({
      LOGERRORS: false,
      VERBOSITY: false,
      IDS_DUPES: true,
      MIXEDCASE: true
    });
  }

  return document._nwsapiDontThrow.match(selector, idlUtils.wrapperForImpl(elImpl));
};

// nwsapi gets `document.documentElement` at creation-time, so we have to initialize lazily, since in the initial
// stages of Document initialization, there is no documentElement present yet.
exports.addNwsapi = parentNode => {
  const document = parentNode._ownerDocument;

  if (!document._nwsapi) {
    document._nwsapi = initNwsapi(parentNode);
    document._nwsapi.configure({
      LOGERRORS: false,
      IDS_DUPES: true,
      MIXEDCASE: true
    });
  }

  return document._nwsapi;
};

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
appmap-0.72.2 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.72.1 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.72.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.71.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.70.2 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.70.1 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.70.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.69.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.68.2 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.68.1 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.68.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.67.1 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.67.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.66.2 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.66.1 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.66.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.65.1 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.65.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.64.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js
appmap-0.63.0 ./node_modules/jsdom/lib/jsdom/living/helpers/selectors.js