source: trip-planner-front/node_modules/stylus/lib/functions/selector-exists.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 555 bytes
Line 
1var utils = require('../utils');
2
3/**
4 * Returns true if the given selector exists.
5 *
6 * @param {String} sel
7 * @return {Boolean}
8 * @api public
9 */
10
11function selectorExists(sel) {
12 utils.assertString(sel, 'selector');
13
14 if (!this.__selectorsMap__) {
15 var Normalizer = require('../visitor/normalizer')
16 , visitor = new Normalizer(this.root.clone());
17 visitor.visit(visitor.root);
18
19 this.__selectorsMap__ = visitor.map;
20 }
21
22 return sel.string in this.__selectorsMap__;
23}
24selectorExists.params = ['sel'];
25module.exports = selectorExists;
Note: See TracBrowser for help on using the repository browser.