Process normal CSS rule
344384
function(rule) {
    var strCss = '';
    strCss += rule.selectors.join(',\n') + ' {';
    rule.declarations.forEach(function(rules) {
      strCss += commentOrDeclaration(rules);
    });
    strCss += '\n}\n\n';
    return strCss;
  }
353473
function styleRuleValueFrom(selector, documentStyleRules) {
  for (var j = 0; j < documentStyleRules.length; j++) {
    if (documentStyleRules[j].selectorText && documentStyleRules[j].selectorText.toLowerCase() === selector) {
      return documentStyleRules[j].style;
    }
  }
}
825887
def elCss(self, css_path, dom=None):
        """"""
        if dom is None:
            dom = self.browser
        return expect(dom.is_element_present_by_css, args=[css_path])
1100646
protected function _process($css)
    {
        $css = str_replace("\r\n", "\n", $css);
        
        // preserve empty comment after '>'
        // http://www.webdevout.net/css-hacks#in_css-selectors
        $css = preg_replace('@>/\\*\\s*\\*/@', '>/*keep*/', $css);
        
        // preserve empty comment between property and value
        // http://css-discuss.incutio.com/?page=BoxModelHack
        $css = preg_replace('@/\\*\\s*\\*/\\s*:@', '/*keep*/:', $css);
        $css = preg_replace('@:\\s*/\\*\\s*\\*/@', ':/*keep*/', $css);
        
        // apply callback to all valid comments (and strip out surrounding ws
        $css = preg_replace_callback('@\\s*/\\*([\\s\\S]*?)\\*/\\s*@'
            ,array($this, '_commentCB'), $css);

        // remove ws around { } and last semicolon in declaration block
        $css = preg_replace('/\\s*{\\s*/', '{', $css);
        $css = preg_replace('/;?\\s*}\\s*/', '}', $css);
        
        // remove ws surrounding semicolons
        $css = preg_replace('/\\s*;\\s*/', ';', $css);
        
        // remove ws around urls
        $css = preg_replace('/
                url\\(      # url(
                \\s*
                ([^\\)]+?)  # 1 = the URL (really just a bunch of non right parenthesis)
                \\s*
                \\)         # )
            /x', 'url($1)', $css);
        
        // remove ws between rules and colons
        $css = preg_replace('/
                \\s*
                ([{;])              # 1 = beginning of block or rule separator 
                \\s*
                ([\\*_]?[\\w\\-]+)  # 2 = property (and maybe IE filter)
                \\s*
                :
                \\s*
                (\\b|[#\'"])        # 3 = first character of a value
            /x', '$1$2:$3', $css);
        
        // remove ws in selectors
        $css = preg_replace_callback('/
                (?:              # non-capture
                    \\s*
                    [^~>+,\\s]+  # selector part
                    \\s*
                    [,>+~]       # combinators
                )+
                \\s*
                [^~>+,\\s]+      # selector part
                {                # open declaration block
            /x'
            ,array($this, '_selectorsCB'), $css);
        
        // minimize hex colors
        $css = preg_replace('/([^=])#([a-f\\d])\\2([a-f\\d])\\3([a-f\\d])\\4([\\s;\\}])/i'
            , '$1#$2$3$4$5', $css);
        
        // remove spaces between font families
        $css = preg_replace_callback('/font-family:([^;}]+)([;}])/'
            ,array($this, '_fontFamilyCB'), $css);
        
        $css = preg_replace('/@import\\s+url/', '@import url', $css);
        
        // replace any ws involving newlines with a single newline
        $css = preg_replace('/[ \\t]*\\n+\\s*/', "\n", $css);
        
        // separate common descendent selectors w/ newlines (to limit line lengths)
        $css = preg_replace('/([\\w#\\.\\*]+)\\s+([\\w#\\.\\*]+){/', "$1\n$2{", $css);
        
        // Use newline after 1st numeric value (to limit line lengths).
        $css = preg_replace('/
            ((?:padding|margin|border|outline):\\d+(?:px|em)?) # 1 = prop : 1st numeric value
            \\s+
            /x'
            ,"$1\n", $css);
        
        // prevent triggering IE6 bug: http://www.crankygeek.com/ie6pebug/
        $css = preg_replace('/:first-l(etter|ine)\\{/', ':first-l$1 {', $css);
            
        return trim($css);
    }
769088
function rule(analyzer) {
	analyzer.setMetric('notMinified');

	/**
	 * A simple CSS minification detector
	 */
	function isMinified(css) {
		// analyze the first 1024 characters
		css = css.trim().substring(0, 1024);

		// there should be no newline in minified file
		return /\n/.test(css) === false;
	}

	analyzer.on('css', function(css) {
		analyzer.setMetric('notMinified', isMinified(css) ? 0 : 1);
	});
}
769256
function getCSSRules(doc) {
    var styles = doc.getElementsByTagName('style'),
        allRules = { },
        rules;

    // very crude parsing of style contents
    for (var i = 0, len = styles.length; i < len; i++) {
      var styleContents = styles[0].textContent;

      // remove comments
      styleContents = styleContents.replace(/\/\*[\s\S]*?\*\//g, '');

      rules = styleContents.match(/[^{]*\{[\s\S]*?\}/g);
      rules = rules.map(function(rule) { return rule.trim() });

      rules.forEach(function(rule) {
        var match = rule.match(/([\s\S]*?)\s*\{([^}]*)\}/),
            rule = match[1],
            declaration = match[2].trim(),
            propertyValuePairs = declaration.replace(/;$/, '').split(/\s*;\s*/);

        if (!allRules[rule]) {
          allRules[rule] = { };
        }

        for (var i = 0, len = propertyValuePairs.length; i < len; i++) {
          var pair = propertyValuePairs[i].split(/\s*:\s*/),
              property = pair[0],
              value = pair[1];

          allRules[rule][property] = value;
        }
      });
    }

    return allRules;
  }
1304121
function (context) {
		var file = context.file;

		try {
			file.data = cleanCSS.process(file.data);
		} catch (err) {
			context.error('CSS syntax error: "%s"',
				file.pathname);
		}
	}
632835
function getCSSText(className) {
			if (typeof document.styleSheets != "object") return "";
			if (document.styleSheets.length <= 0) return "";
			var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules;
			for (var x = 0; x < classes.length; x++) {
				if (classes[x].selectorText == "." + className || classes[x].selectorText == "#" + className) {
					return ((classes[x].cssText) ? (classes[x].cssText) : (classes[x].style.cssText));
				}
			}
			return "";
		}
1196069
def css(self, css_path, dom=None):
        """"""
        if dom is None:
            dom = self.browser
        return expect(dom.find_by_css, args=[css_path])
729776
function normalize(value) {
  // Run this function for each item if value is array.
  if (value instanceof Array) {
    var output = [];
    for (var i = value.length; i--;) output[i] = normalize(value[i]);
    return output;
  }

  var number = strip(value);
  var unit = value.slice(number.length);

  // Truncate CSS number.
  number = parseFloat(number).toString();
  var extra = number.indexOf('0.');
  if (extra === 0) return number.slice(1) + unit;
  if (extra === 1 && number[0] === '-') return '-' + number.slice(2) + unit;

  // Return truncated number with unit.
  return number + unit;
}
180536
function(content) {
			var root = new CSSSection(null, content);
			var rules = this.findAllRules(content);

			// rules are sorted in order they appear in CSS source
			// so we can optimize their nesting routine
			var insert = function(range, ctx) {
				while (ctx && ctx.range) {
					if (ctx.range.contains(range)) {
						return ctx.addChild(range);
					}

					ctx = ctx.parent;
				}

				// if we are here then given range is a top-level section
				return root.addChild(range);
			};

			var ctx = root;
			rules.forEach(function(r) {
				ctx = insert(r, ctx);
			});

			return root;
		}
1273041
function cssnext (tagName, css) {
  // A small hack: it passes :scope as :root to PostCSS.
  // This make it easy to use css variables inside tags.
  css = css.replace(/:scope/g, ':root')
  css = postcss([postcssCssnext]).process(css).css
  css = css.replace(/:root/g, ':scope')
  return css
}
158518
function scopeCssText (cssText, scope) {
  return transformCss(cssText, (rule) => {
    const transformed = {...rule}
    if (!rule.isScoped) {
      transformed.selector = scopeRule(rule, scope)
      transformed.isScoped = true
    }
    return transformed
  })
}
928221
function processPseudoClass (component, idName, pseudoData) {
  let pseudoId = component.node.getAttribute('data-pseudo-id')

  function getCssText (selector, rulesObj) {
    // TODO: must process vendors if needed.
    // !important is needed since the style rules is inline for most components.
    const rulesText = Object.keys(rulesObj).map(key => `${camelToKebab(key)}:${rulesObj[key]}!important;`).join('')
    return `${selector}{${rulesText}}`
  }

  if (!pseudoId) {
    pseudoId = getPseudoId()
    component.node.setAttribute('data-pseudo-id', pseudoId)
    const style = document.createElement('style')
    style.type = 'text/css'
    style.setAttribute('data-pseudo-id', pseudoId)
    document.getElementsByTagName('head')[0].appendChild(style)
    const cssText = Object.keys(pseudoData).map(pseudo => {
      const rules = pseudoData[pseudo]
      return getCssText(`[data-pseudo-id="${pseudoId}"]${pseudo}`, rules)
    }).join('')
    return style.appendChild(document.createTextNode(cssText))
  }

  const styleSheets = Array.prototype.slice.call(document.styleSheets || [])
    .filter(style => style.ownerNode.getAttribute('data-pseudo-id') === pseudoId)
  if (!styleSheets || styleSheets.length <= 0) {
    return
  }
  const styleSheet = styleSheet[0]
  const rules = styleSheet.cssRules || styleSheet.rules
  Object.keys(pseudoData).forEach(pseudo => {
    const data = pseudoData[pseudo]
    const selector = `[data-pseudo-id="${pseudoId}"]${pseudo}`
    const res = Array.prototype.slice.call(rules).reduce((res, rule, idx) => {
      (rule.selectorText === selector) && (res.idx = idx)
      return res
    }, { idx: -1 })
    const { idx } = res
    if (idx !== -1) {
      const pseudoRule = rules[idx]
      const match = pseudoRule.cssText.match(/^[^{]+\{([^}]+)\}/)
      if (match && match[1]) {
        const rulesData = match[1].split(';').reduce((res, str) => {
          const match = str.match(/(\S+)\s*:\s*(\S+)/)
          if (match && match[1] && match[2]) {
            res[match[1]] = match[2]
          }
          return res
        }, {})
        extend(rulesData, data)
        Object.keys(rulesData).forEach(rule => {
          if (!rulesData[rule]) { delete rulesData[rule] }
        })
        styleSheet.deleteRule(idx)
        styleSheet.insertRule(getCssText(selector, rulesData), rules.length - 1)
      }
    }
    else {
      styleSheet.insertRule(getCssText(selector, data), rules.length)
    }
  })
}
198332
function (context, env) {
        var css = [],      // The CSS output
            rules = [],    // node.Rule instances
           _rules = [],    //
            rulesets = [], // node.Ruleset instances
            paths = [],    // Current selectors
            selector,      // The fully rendered selector
            debugInfo,     // Line number debugging
            rule;

        if (! this.root) {
            this.joinSelectors(paths, context, this.selectors);
        }

        // Compile rules and rulesets
        for (var i = 0; i < this.rules.length; i++) {
            rule = this.rules[i];

            if (rule.rules || (rule instanceof tree.Media)) {
                rulesets.push(rule.toCSS(paths, env));
            } else if (rule instanceof tree.Directive) {
                var cssValue = rule.toCSS(paths, env);
                // Output only the first @charset definition as such - convert the others
                // to comments in case debug is enabled
                if (rule.name === "@charset") {
                    // Only output the debug info together with subsequent @charset definitions
                    // a comment (or @media statement) before the actual @charset directive would
                    // be considered illegal css as it has to be on the first line
                    if (env.charset) {
                        if (rule.debugInfo) {
                            rulesets.push(tree.debugInfo(env, rule));
                            rulesets.push(new tree.Comment("/* "+cssValue.replace(/\n/g, "")+" */\n").toCSS(env));
                        }
                        continue;
                    }
                    env.charset = true;
                }
                rulesets.push(cssValue);
            } else if (rule instanceof tree.Comment) {
                if (!rule.silent) {
                    if (this.root) {
                        rulesets.push(rule.toCSS(env));
                    } else {
                        rules.push(rule.toCSS(env));
                    }
                }
            } else {
                if (rule.toCSS && !rule.variable) {
                    rules.push(rule.toCSS(env));
                } else if (rule.value && !rule.variable) {
                    rules.push(rule.value.toString());
                }
            }
        } 

        rulesets = rulesets.join('');

        // If this is the root node, we don't render
        // a selector, or {}.
        // Otherwise, only output if this ruleset has rules.
        if (this.root) {
            css.push(rules.join(env.compress ? '' : '\n'));
        } else {
            if (rules.length > 0) {
                debugInfo = tree.debugInfo(env, this);
                selector = paths.map(function (p) {
                    return p.map(function (s) {
                        return s.toCSS(env);
                    }).join('').trim();
                }).join(env.compress ? ',' : ',\n');

                // Remove duplicates
                for (var i = rules.length - 1; i >= 0; i--) {
                    if (_rules.indexOf(rules[i]) === -1) {
                        _rules.unshift(rules[i]);
                    }
                }
                rules = _rules;

                css.push(debugInfo + selector + 
                        (env.compress ? '{' : ' {\n  ') +
                        rules.join(env.compress ? '' : '\n  ') +
                        (env.compress ? '}' : '\n}\n'));
            }
        }
        css.push(rulesets);

        return css.join('')  + (env.compress ? '\n' : '');
    }
518505
function css(el, styles) {
	if (isIE) {
		if (styles && styles.opacity !== UNDEFINED) {
			styles.filter = 'alpha(opacity=' + (styles.opacity * 100) + ')';
		}
	}
	extend(el.style, styles);
}
754563
function processFallbackRules(root) {
  // an output for each execution mode

  // Reuse existing output in memory -- fixes issues with build "forgetting" about CSS vars previously working in IE 11 when compiling more than one thing at a time.
  if (!output) {
    output = {
      [ExecutionMode.CSS_COLOR]: [],
    };
  }

  // define which modes need to be processed
  const execModes = [ExecutionMode.CSS_COLOR];

  walkFallbackAtRules(root, execModes, output);
  walkFallbackRules(root, execModes, output);

  writeFallbackCSS(output);
}