lets you call a css selector with a guard
166154
public function matchCondition( $args, $env ){
		$lastSelector = end($this->selectors);

		if( !$lastSelector->evaldCondition ){
			return false;
		}
		if( $lastSelector->condition && !$lastSelector->condition->compile( $env->copyEvalEnv( $env->frames ) ) ){
			return false;
		}
		return true;
	}
956927
def all_selectors(Class, fn):
        """"""
        selectors = []
        cssparser = cssutils.CSSParser(validate=False)
        css = cssparser.parseFile(fn)
        for rule in [r for r in css.cssRules if type(r)==cssutils.css.CSSStyleRule]:
            selectors += [sel.selectorText for sel in rule.selectorList]
        selectors = sorted(list(set(selectors)))
        return selectors
467766
function (selector) {
        var match = this.match;

        function compileNameFilter(name) {
          if (name) {
            name = name.toLowerCase();

            return function (item) {
              return name === '*' || item.type === name;
            };
          }
        }

        function compileIdFilter(id) {
          if (id) {
            return function (item) {
              return item._name === id;
            };
          }
        }

        function compileClassesFilter(classes) {
          if (classes) {
            classes = classes.split('.');

            return function (item) {
              var i = classes.length;

              while (i--) {
                if (!item.classes.contains(classes[i])) {
                  return false;
                }
              }

              return true;
            };
          }
        }

        function compileAttrFilter(name, cmp, check) {
          if (name) {
            return function (item) {
              var value = item[name] ? item[name]() : '';

              return !cmp ? !!check :
                cmp === "=" ? value === check :
                  cmp === "*=" ? value.indexOf(check) >= 0 :
                    cmp === "~=" ? (" " + value + " ").indexOf(" " + check + " ") >= 0 :
                      cmp === "!=" ? value != check :
                        cmp === "^=" ? value.indexOf(check) === 0 :
                          cmp === "$=" ? value.substr(value.length - check.length) === check :
                            false;
            };
          }
        }

        function compilePsuedoFilter(name) {
          var notSelectors;

          if (name) {
            name = /(?:not\((.+)\))|(.+)/i.exec(name);

            if (!name[1]) {
              name = name[2];

              return function (item, index, length) {
                return name === 'first' ? index === 0 :
                  name === 'last' ? index === length - 1 :
                    name === 'even' ? index % 2 === 0 :
                      name === 'odd' ? index % 2 === 1 :
                        item[name] ? item[name]() :
                          false;
              };
            }

            // Compile not expression
            notSelectors = parseChunks(name[1], []);

            return function (item) {
              return !match(item, notSelectors);
            };
          }
        }

        function compile(selector, filters, direct) {
          var parts;

          function add(filter) {
            if (filter) {
              filters.push(filter);
            }
          }

          // Parse expression into parts
          parts = expression.exec(selector.replace(whiteSpace, ''));

          add(compileNameFilter(parts[1]));
          add(compileIdFilter(parts[2]));
          add(compileClassesFilter(parts[3]));
          add(compileAttrFilter(parts[4], parts[5], parts[6]));
          add(compilePsuedoFilter(parts[7]));

          // Mark the filter with pseudo for performance
          filters.pseudo = !!parts[7];
          filters.direct = direct;

          return filters;
        }

        // Parser logic based on Sizzle by John Resig
        function parseChunks(selector, selectors) {
          var parts = [], extra, matches, i;

          do {
            chunker.exec("");
            matches = chunker.exec(selector);

            if (matches) {
              selector = matches[3];
              parts.push(matches[1]);

              if (matches[2]) {
                extra = matches[3];
                break;
              }
            }
          } while (matches);

          if (extra) {
            parseChunks(extra, selectors);
          }

          selector = [];
          for (i = 0; i < parts.length; i++) {
            if (parts[i] != '>') {
              selector.push(compile(parts[i], [], parts[i - 1] === '>'));
            }
          }

          selectors.push(selector);

          return selectors;
        }

        this._selectors = parseChunks(selector, []);
      }
860870
function CSSStyleDeclaration(element) {
			var
			style = this,
			currentStyle = element.currentStyle,
			fontSize = getComputedStylePixel(element, 'fontSize'),
			unCamelCase = function (match) {
				return '-' + match.toLowerCase();
			},
			property;

			for (property in currentStyle) {
				Array.prototype.push.call(style, property === 'styleFloat' ? 'float' : property.replace(/[A-Z]/, unCamelCase));

				if (property === 'width') {
					style[property] = element.offsetWidth + 'px';
				} else if (property === 'height') {
					style[property] = element.offsetHeight + 'px';
				} else if (property === 'styleFloat') {
					style.float = currentStyle[property];
				} else if (/margin.|padding.|border.+W/.test(property) && style[property] !== 'auto') {
					style[property] = Math.round(getComputedStylePixel(element, property, fontSize)) + 'px';
				} else if (/^outline/.test(property)) {
					// errors on checking outline
					try {
						style[property] = currentStyle[property];
					} catch (error) {
						style.outlineColor = currentStyle.color;
						style.outlineStyle = style.outlineStyle || 'none';
						style.outlineWidth = style.outlineWidth || '0px';
						style.outline = [style.outlineColor, style.outlineWidth, style.outlineStyle].join(' ');
					}
				} else {
					style[property] = currentStyle[property];
				}
			}

			setShortStyleProperty(style, 'margin');
			setShortStyleProperty(style, 'padding');
			setShortStyleProperty(style, 'border');

			style.fontSize = Math.round(fontSize) + 'px';
		}
805163
function matches(dom, selector) {
  return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector)
}
1274322
def closest(self, tag):
        """"""

        return CSSMatch(self.selectors, tag, self.namespaces, self.flags).closest()
1029260
function plugin(cb) {
	return function(css) {
		if (lodash.isFunction(cb)) {
			var token = cb(css.source.input.file);

			if (!lodash.isNull(token)) {
				css.eachRule(function(rule) {
					if (!areSelectorsValid(rule.selectors, token)) {
						throw rule.error('Wrong selector');
					}
				});
			}
		}
	}
}
167825
function setSelector(image, options, dynamicBlock, retina) {
	dynamicBlock = dynamicBlock || false;
	retina = retina || false;
	var basename = image.isSVG ? path.basename(image.name, '.svg') : path.basename(image.name, '.png');
	if (retina) {
		// If retina, then '@2x','@3x','_2x','_3x' will be removed.
		basename = _.replace(basename, /[@_](\d)x$/, '');
	}
	var selector = (dynamicBlock ? dynamicBlock : image.dir) + options.cssSeparator + basename;
	if (options.pseudoClass) {
		if (image.name.toLowerCase().indexOf('hover') > -1 || image.name.toLowerCase().indexOf('active') > -1) {
			selector = _.replace(selector, 'Hover', ':hover');
			selector = _.replace(selector, 'Active', ':active');
			selector = _.replace(selector, '_hover', ':hover');
			selector = _.replace(selector, '_active', ':active');
		}
	}
	return selector;
}
1068578
function _setupAdvanceOnHandler(selector) {
  return (event) => {
    if (this.isOpen()) {
      const targetIsEl = this.el && event.target === this.el;
      const targetIsSelector = !isUndefined(selector) && event.target.matches(selector);

      if (targetIsSelector || targetIsEl) {
        this.tour.next();
      }
    }
  };
}
736503
function(selector) {
            selector = selector || '';
            selector = Selector._replaceShorthand(Y.Lang.trim(selector)); 
            var token = Selector._getToken(),     // one token per simple selector (left selector holds combinator)
                query = selector, // original query for debug report
                tokens = [],    // array of tokens
                found = false,  // whether or not any matches were found this pass
                match,         // the regex match
                test,
                i, parser;

            /*
                Search for selector patterns, store, and strip them from the selector string
                until no patterns match (invalid selector) or we run out of chars.

                Multiple attributes and pseudos are allowed, in any order.
                for example:
                    'form:first-child[type=button]:not(button)[lang|=en]'
            */
            outer:
            do {
                found = false; // reset after full pass
                for (i = 0; (parser = Selector._parsers[i++]);) {
                    if ( (match = parser.re.exec(selector)) ) { // note assignment
                        if (parser.name !== COMBINATOR ) {
                            token.selector = selector;
                        }
                        selector = selector.replace(match[0], ''); // strip current match from selector
                        if (!selector.length) {
                            token.last = true;
                        }

                        if (Selector._attrFilters[match[1]]) { // convert class to className, etc.
                            match[1] = Selector._attrFilters[match[1]];
                        }

                        test = parser.fn(match, token);
                        if (test === false) { // selector not supported
                            found = false;
                            break outer;
                        } else if (test) {
                            token.tests.push(test);
                        }

                        if (!selector.length || parser.name === COMBINATOR) {
                            tokens.push(token);
                            token = Selector._getToken(token);
                            if (parser.name === COMBINATOR) {
                                token.combinator = Y.Selector.combinators[match[1]];
                            }
                        }
                        found = true;
                    }
                }
            } while (found && selector.length);

            if (!found || selector.length) { // not fully parsed
                tokens = [];
            }
            return tokens;
        }
1222116
function(selector, params) {
      var t = this;
      UI.pauseTour();
      $(selector).css({display:'none'}).centerBox().css({top:40}).modal('show');
      setTimeout(function(){
        // $(selector).centerBox().css({top:40}).modal('show');
      }, 0);

      // Set the cursor when the dialog fades in
      setTimeout(function(){
        $(selector + ' input').first().focus();
      }, 500);
    }
1215134
function selectorBlockHandler(element) {
    if (element.type === 'Selector') {
        const name = []
        let discard = false
        element.children.forEach(e => {
            switch (e.type) {
                case "ClassSelector":
                    name.push("." + e.name);
                    break;
                    //not support for now
                case "Combinator":
                    name.push(e.name);
                    discard = true
                    return null
                case "TypeSelector":
                    name.push(e.name);
                    break;
                case "IdSelector":
                    //not support for now
                    name.push("#" + e.name);
                    discard = true
                    return null
                case "WhiteSpace":
                    name.push(" ");
                    break
                default: {
                    // console.warn('unknown selector type:', e)
                    discard = true
                    return null
                }
            }
        })
        if (!discard)
            return name.join("")
        else return null
    }
}
1116889
function matchSelector(element, selector) {
        if (!element || element.nodeType !== 1) {
            return false
        }

        var parent,
            match,
            matchesSelector = element.webkitMatchesSelector || element.matchesSelector;

        if (matchesSelector) {
            match = matchesSelector.call(element, selector)
        } else {
            parent = element.parentNode;
            match = !! parent.querySelector(selector);
        }

        return match;
    }
288655
function (selector, incremental) {
        if (!selector) {
            if (incremental) {
                // Everything was removed
                refreshCSS();
            } else {
                // Nothing was be removed
                return;
            }
        } else {
            // Simply put back the original style
            aria.templates.CSSMgr.__textLoaded[selector.location].text = selector.original;
            refreshCSS();
        }
    }
917678
def cssText(self) -> str:
        """"""
        _style = self.style.cssText
        if _style:
            return '{0} {{{1}}}'.format(self.selectorText, _style)
        return ''
327799
function loadCss (css, name) {
  if (css) {
    cssLoader.insertStyleElement(document, document.head, css, name, false)
  }
}
274849
function (selector, incremental) {
        if (!selector) {
            // This is a baseline
            if (incremental) {
                // Everything should be removed
                refreshCSS(true);
            } else {
                // Nothing should be removed
                return;
            }
        } else {
            var textLoaded = aria.templates.CSSMgr.__textLoaded[selector.location];
            // remember the original text
            selector.original = textLoaded.text;
            if (incremental) {
                // Keep only the selector
                refreshCSS(true, selector.descriptor);
            } else {
                // Remove the selector
                textLoaded.text = textLoaded.text.replace(selector.descriptor, "");
                refreshCSS();
            }
        }
    }