react / wstein / node_modules / jest-cli / node_modules / jsdom / lib / jsdom / selectors / index.js
80684 viewsvar nwmatcher = require("nwmatcher/src/nwmatcher-noqsa");12function addNwmatcher(document) {3if (!document._nwmatcher) {4document._nwmatcher = nwmatcher({ document: document });5document._nwmatcher.configure({ UNIQUE_ID: false });6}7return document._nwmatcher;8}910exports.applyQuerySelectorPrototype = function(dom) {11dom.Document.prototype.querySelector = function(selector) {12return addNwmatcher(this).first(selector, this);13};1415dom.Document.prototype.querySelectorAll = function(selector) {16return new dom.NodeList(addNwmatcher(this).select(selector, this));17};1819dom.DocumentFragment.prototype.querySelector = function(selector) {20return addNwmatcher(this.ownerDocument).first(selector, this);21};2223dom.DocumentFragment.prototype.querySelectorAll = function(selector) {24return new dom.NodeList(addNwmatcher(this.ownerDocument).select(selector, this));25};2627dom.Element.prototype.querySelector = function(selector) {28return addNwmatcher(this.ownerDocument).first(selector, this);29};3031dom.Element.prototype.querySelectorAll = function(selector) {32return new dom.NodeList(addNwmatcher(this.ownerDocument).select(selector, this));33};3435dom.Element.prototype.matchesSelector = function(selector) {36return addNwmatcher(this.ownerDocument).match(this, selector);37};38};394041