You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
507 B
23 lines
507 B
var utils = require('../utils'); |
|
|
|
/** |
|
* Returns true if the given selector exists. |
|
* |
|
* @param {String} sel |
|
* @return {Boolean} |
|
* @api public |
|
*/ |
|
|
|
module.exports = function selectorExists(sel) { |
|
utils.assertString(sel, 'selector'); |
|
|
|
if (!this.__selectorsMap__) { |
|
var Normalizer = require('../visitor/normalizer') |
|
, visitor = new Normalizer(this.root.clone()); |
|
visitor.visit(visitor.root); |
|
|
|
this.__selectorsMap__ = visitor.map; |
|
} |
|
|
|
return sel.string in this.__selectorsMap__; |
|
};
|
|
|