initialize CSS rules
771116
private function init()
    {
        $lineSpacing = $this->bibliographyOptions->getLineSpacing();
        $entrySpacing = $this->bibliographyOptions->getEntrySpacing();
        $hangingIndent = $this->bibliographyOptions->getHangingIndent();

        if ($lineSpacing || $entrySpacing || $hangingIndent) {
            $rule = $this->cssRules->getRule(".csl-entry");
            if (!empty($lineSpacing)) {
                $rule->addDirective("line-height", intval($lineSpacing) . "em");
            }

            if (!empty($entrySpacing)) {
                $rule->addDirective("margin-bottom", intval($entrySpacing) . "em");
            }

            if (!empty($hangingIndent)) {
                $rule->addDirective("padding-left", "2em");
                $rule->addDirective("text-indent", "-2em");
            }
        }

        if ("flush" === $this->bibliographyOptions->getSecondFieldAlign()) {
            $rule = $this->cssRules->getRule(".csl-left-margin");
            $rule->addDirective("display", "block");
            $rule->addDirective("float", "left");

            $rule = $this->cssRules->getRule(".csl-right-inline");
            $rule->addDirective("margin-left", "35px");
        }
    }
891999
protected function _initialize($options = array()) {
		if ($this->_initialized) {
			return;
		}

		$this->_initialized = true;
		if (!empty($options['_css'])) {
			foreach ((array)$options['_css'] as $css) {
				$this->Html->css($css, null, array('inline' => false));
			}
		}

		if (!empty($options['_cssText'])) {
			$out = $this->Html->tag('style', $options['_cssText']);
			$this->_View->append('css', $out);
		}

		if (!empty($options['_scriptBlock'])) {
			$scriptOpts = array('block' => $options['_scriptBlock']);
		} else {
			$scriptOpts = false;
		}

		if (!empty($options['_scripts'])) {
			foreach ((array)$options['_scripts'] as $script) {
				$this->Html->script($script, $scriptOpts);
			}
		}
	}
308176
function _makeCSSTarget(targets, rule) {
        if (rule.sourceURL) {
            var url = rule.sourceURL;
            url += ":" + rule.style.range.start;
            var name = rule.selectorList.text;
            var file = _fileFromURL(url);
            targets.push({"type": "css", "url": url, "name": name, "file": file});
        }
    }
252632
public function init()
    {
        parent::init();

        Html::addCssClass($this->options, ['info-box']);
        Html::addCssClass($this->iconOptions, 'info-box-icon');

        if ($this->background) {
            Html::addCssClass($this->options, 'bg-'.$this->background);
        }
    }
440208
function initResizer() {
        var $iframe = $('<iframe frameborder="0">'),
            $div = $('<div>');
        $iframe.add($div).css({
            opacity: 0,
            visiblility: 'hidden',
            position: 'absolute',
            width: '100%',
            height: '100%',
            top: 0,
            left: 0,
            border: 0
        });
        $iframe.prependTo($div.prependTo(element));
        fixElementPosition();
        $window = $($iframe[0].contentWindow);
        $window.on('resize', checkResize);
    }
1179155
def init():
    """"""
    global _default_foreground, _default_background, _default_style
    try:
        attrs = GetConsoleScreenBufferInfo().wAttributes
    except (ArgumentError, WindowsError):
        _default_foreground = GREY
        _default_background = BLACK
        _default_style = NORMAL
    else:
        _default_foreground = attrs & 7
        _default_background = (attrs >> 4) & 7
        _default_style = attrs & BRIGHT
478143
public function setupRules()
    {
        parent::setupRules();

        $this->rules->validator = new Validator(
            ['!format.block.code', '!format.monospace', '!operator.escape', '!operator', '!tag']
        );

        $this->rules->addMany([
            'format.header' => [
                new Rule(new RegexMatcher('/^\s{0,3}(#+.+?)\r?$/m')),
                new Rule(new RegexMatcher('/^([^\r\n]+?)^(?:-+|=+)\R?$/m'))
            ],
            'format.italics'   => new Rule(
                new RegexMatcher('/(?:^|[^*_])(?P<italics>(?P<i>[*_])(?>[^*_\r\n]|(?:(?P<b>[*_]{2})(?>[^*_\r\n]|(?&italics))*?\g{b}))+\g{i})/'), [
                    'italics' => Token::NAME
                ]
            ),
            'format.bold'  => new Rule(
                new RegexMatcher('/(?P<bold>(?P<b>\*\*|__)(?>[^*_\r\n]|(?:(?P<i>[*_]{2})(?>[^*_\r\n]|(?&bold))*?\g{i}))+\g{b})/', [
                    'bold' => Token::NAME
                ])
            ),
            'format.strike'    => new Rule(new RegexMatcher('/(~~.+?~~)/')),
            'format.monospace' => [
                new Rule(new RegexMatcher('/(?:[^`]|^)(`.*?`)/')),
                new Rule(new RegexMatcher('/(``.*?``)/')),
                new Rule(new RegexMatcher('/^((?:(?: {4,}|\t).*?(?>\R|$)+?)+)/m')),
            ],

            'operator.list.ordered'   => new Rule(new RegexMatcher('/^\s*(\d+[.)])/m')),
            'operator.list.unordered' => new Rule(new RegexMatcher('/^\s*([-+*])/m'), [
                'context' => ['none'],
                'priority' => 1
            ]),

            'string.quote'       => new Rule(new RegexMatcher('/((?:^>.*?\R)+)/m')),
            'format.block.code'  => [
                new Rule(
                    new DelegateRegexMatcher(
                        '/^```(.*?)\R(.*?)\R^```/ms',
                        function($match, TokenFactoryInterface $factory) {
                            $lang = KeyLighter::get()->getLanguage($match[1][0]);
                            yield $factory->create(Token::NAME, ['pos' => $match[0][1], 'length' => strlen($match[0][0])]);
                            yield $factory->create(
                                "language.{$lang->getIdentifier()}", [
                                    'pos'    => $match[2][1],
                                    'length' => strlen($match[2][0]),
                                    'inject' => $lang,
                                    'class'  => LanguageToken::class,
                                ]
                            );
                        }
                    ), [
                        'context'     => Validator::everywhere(),
                        'postProcess' => true,
                        'priority'    => 1000
                    ]
                ),
            ],

            'operator.escape' => new Rule(new RegexMatcher('/(\\\.)/')),

            'operator.horizontal' => new Rule(new RegexMatcher('/^\s{,3}(([-*_])( ?\2)+)\R/m'), [
                'priority' => 2
            ]),

            'symbol.link'  => new Rule(new RegexMatcher('/[^!](\[(?:[^\[\]]|!\[.*?\]\(.*?\))*\])/i')),
            'symbol.url'   => new Rule(new RegexMatcher('#(<(https?://|[^/])[-A-Za-z0-9+&@\#/%?=~_|!:,.;]+[-A-Za-z0-9+&@\#/%=~_|]>|https?://[-A-Za-z0-9+&@\#/%?=~_|!:,.;]+[-A-Za-z0-9+&@\#/%=~_|])#i'), [
                'priority' => 0,
            ]),
            'symbol.image' => new Rule(new RegexMatcher('/(!)(\[.*?\])\(.*?\)/i', [
                1 => 'operator.image',
                2 => '$.title',
            ])),
        ]);
    }
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;
		}
694555
protected function initOptions()
    {
        Html::addCssClass($this->options, ['widget' => 'alert']);

        if ($this->closeButton !== false) {
            $this->closeButton = array_merge([
                'data-dismiss' => 'alert',
                'class' => ['widget' => 'close'],
            ], $this->closeButton);

            Html::addCssClass($this->options, ['alert-dismissible']);
        }
        if (!isset($this->options['role'])) {
            $this->options['role'] = 'alert';
        }
    }
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);
	});
}
221443
function activatePostCSSPlugins(config) {
  const plugins = [];

  if (config.lintRules || config.lintRules !== "") {
    // TODO: Throw easy-to-understand error message
    // incorrect path? (ex. "lintRules": "aaa")
    // typo? (ex. "lintRules": "stylelint-config-suitcs")
    const lintRules = require(config.lintRules);

    if (lintRules.rules) {
      plugins.push(stylelint(lintRules));
    } else {
      throw new Error("Illegal lint rule: \"rules\" property is not found.");
    }
  }

  if (config.browsers && config.browsers !== "") {
    plugins.push(autoprefixer(config.browsers));
  }

  plugins.push(cssfmt);
  plugins.push(reporter);

  return plugins;
}
697678
function setInitalStyle() {
  document.body.style.margin = 0;
  document.body.style.borderTopWidth = '10px';
  document.body.style.borderTopStyle = 'solid';
}
1038749
function checkInit() {
        if (!container) {
            container = document.createElement("div");
            container.style.cssText = "position: fixed;" + "opacity: 0.9;" + "right: 0;" + "bottom: 0";
            document.body.appendChild(container);
        }
        initialized = true;
    }
489251
public function setupRules()
    {
        $identifier = '-?[_a-zA-Z]+[_a-zA-Z0-9-]*';
        $at = [
            'charset', 'import', 'namespace',
            'media', 'supports', 'document', 'page', 'font-face', 'keyframes', 'viewport', 'counter-style',
            'font-feature-values', 'swash', 'ornaments', 'annotation', 'stylistic', 'styleset', 'character-variant'
        ];
        
        $this->rules->addMany([
            'string' => CommonFeatures::strings(['single' => '\'', 'double' => '"'], [
                'context' => $this->everywhere()
            ]),

            'meta.declaration' => [
                new OpenRule(new SubStringMatcher('{'), [
                    'context' => ['!meta.declaration.media', '!comment'],
                    'factory' => new TokenFactory(MetaToken::class)
                ]),
                new CloseRule(new SubStringMatcher('}')),
            ],

            'meta.declaration.media' => [
                new Rule(new RegexMatcher('/@media(.*?\{)/'), [
                    'context' => Validator::everywhere(),
                    'factory' => new TokenFactory(MetaToken::class)
                ]),
            ],

            'meta.declaration.rule' => [
                new OpenRule(new RegexMatcher('/@media.*(\()/'), [
                    'context' => ['meta.declaration.media'],
                    'factory' => new TokenFactory(MetaToken::class)
                ]),
                new CloseRule(new SubStringMatcher(')')),
            ],

            'keyword.at-rule' => new Rule(new RegexMatcher('/(@(?:-[a-z]+-)?(?:'.implode('|', $at).'))/'), [
                'priority' => 2
            ]),

            'symbol.selector.id'    => new Rule(new RegexMatcher("/(#$identifier)/i")),
            'symbol.selector.tag'   => new Rule(new RegexMatcher('/(?>[\s}]|^)(?=(\w+)[^;]*\{)/ms')),
            'symbol.selector.class' => new Rule(new RegexMatcher("/(\\.$identifier)/i")),

            'symbol.selector.class.pseudo' => new Rule(new RegexMatcher("/(:{1,2}$identifier)/")),

            'number' => new Rule(new RegexMatcher("/([-+]?[0-9]*\\.?[0-9]+([\\w%]+)?)/"), [
                'context'  => ['meta.declaration', '!constant.color', '!comment', '!symbol', '!comment', '!string'],
                'priority' => 0
            ]),
            
            'symbol.property' => new Rule(new RegexMatcher("/($identifier:)/"), [
                'context' => ['meta.declaration', '!symbol', '!comment'],
                'priority' => 2
            ]),

            'call' => new Rule(new RegexMatcher("/($identifier)\\s*\\((?:(?P<string>[a-z].*?)|.*?)\\)/", [
                1 => Token::NAME,
                'string' => 'string.argument'
            ]), [
                'context' => ['meta.declaration', '!comment', '!string', '!keyword']
            ]),

            'constant.color' => [
                new Rule(new RegexMatcher("/(#[0-9a-f]{3,6})/i"), [
                    'priority' => 2,
                    'context'  => ['meta.declaration', '!comment']
                ]),
                new Rule(new WordMatcher([
                    'white', 'silver', 'gray', 'black', 'red', 'maroon', 'yellow', 'olive',
                    'lime', 'green', 'aqua', 'teal', 'blue', 'navy', 'fuchsia', 'purple'
                ]), [
                    'context'  => ['meta.declaration', '!comment', '!symbol', '!variable']
                ]),
            ],

            'operator' => new Rule(new WordMatcher(['>', '+', '*', '!important'], ['separated' => false]), [
                'context' => $this->everywhere()
            ]),

            'operator.punctuation' => new Rule(new SubStringMatcher(';'), [
                'context' => $this->everywhere()
            ]),

            'comment' => new Rule(new CommentMatcher([], [['/*', '*/']]), ['context' => $this->everywhere()])
        ]);
    }
771714
def update_css(self, css_in=None, clear_css=False):
        """"""
        if clear_css:
            self.matchers = {}

        # CSS is changing, so clear processing state
        self.clear_state()

        if css_in is None:
            return
        try:
            with open(css_in, 'rb') as f:  # is it a path/filename?
                css = f.read()
        except (IOError, TypeError):
            try:
                css = css_in.read()  # Perhaps a file obj?
            except AttributeError:
                css = css_in         # Treat it as a string

        # Namespaces defined in the CSS
        if clear_css:
            self.css_namespaces = {}

        rules, _ = tinycss2.parse_stylesheet_bytes(css, skip_whitespace=True)
        for rule in rules:
            # Check for any @namespace declarations
            if rule.type == 'at-rule':
                if rule.lower_at_keyword == 'namespace':
                    # The 1 supported format is:
                    #
                    # default (unsupported):  [<WhitespaceToken>,
                    #            <StringToken "http://www.w3.org/1999/xhtml">]
                    # prefixed: [<WhitespaceToken>,
                    #            <IdentToken html>,
                    #            <WhitespaceToken>,
                    #            <StringToken "http://www.w3.org/1999/xhtml">]
                    if len(rule.prelude) == 4 and \
                           [tok.type for tok in rule.prelude] == \
                           ['whitespace', 'ident', 'whitespace', 'string']:

                        # Prefixed namespace
                        ns_prefix = rule.prelude[1].value
                        ns_url = rule.prelude[3].value
                        self.css_namespaces[ns_prefix] = ns_url
                    else:
                        # etree.XPath does not support the default namespace
                        # and XPath is used to implement `sort-by:`
                        # http://www.goodmami.org/2015/11/04/
                        # ... python-xpath-and-default-namespaces.html
                        log(WARN, u'Unknown @namespace format at {}:{}'
                            .format(rule.source_line, rule.source_column)
                            .encode('utf-8'))

            elif rule.type == 'qualified-rule':

                selectors = parse(rule.prelude, namespaces=self.css_namespaces,
                                  extensions=extensions)
                decls = [d for d in
                         parse_declaration_list(rule.content,
                                                skip_whitespace=True)
                         if d.type == 'declaration']  # Could also be a comment
                for sel in selectors:
                    try:
                        csel = CompiledSelector(sel)
                    except cssselect2.SelectorError as error:
                        log(WARN, u'Invalid selector: {} {}'.format(
                            serialize(rule.prelude),
                            to_str(error.args)).encode('utf-8'))
                    else:
                        steps, extras = extract_selector_info(sel)
                        label = csel.pseudo_element
                        if len(extras) > 0:
                            if label is not None:
                                extras.insert(0, label)
                            label = '_'.join(extras)

                        for step in steps:
                            if step not in self.matchers:
                                self.matchers[step] = cssselect2.Matcher()
                            self.record_coverage_zero(rule,
                                                      sel.source_line_offset)
                            self.matchers[step].add_selector(
                                 csel,
                                 ((rule.source_line + sel.source_line_offset,
                                   serialize(rule.prelude).replace('\n', ' ')),
                                  decls, label))
            elif rule.type == 'comment':
                pass
            elif rule.type == 'error':
                log(ERROR, u'Parse Error {}: {}'.format(
                    rule.kind, rule.message).encode('utf-8'))
                # Phil does not know how to nicely exit with staus != 0
                raise ValueError(u'Parse Error {}: {}'.format(
                    rule.kind, rule.message).encode('utf-8'))
            else:
                raise ValueError(u'BUG: Unknown ruletype={}'.format(rule.type))

        steps = sorted(self.matchers.keys())
        if len(steps) > 1:
            if 'default' in steps:
                steps.remove('default')
                try:
                    steps.sort(key=int)
                    steps.insert(0, '0')
                    self.matchers['0'] = self.matchers.pop('default')
                except ValueError:
                    steps.insert(0, 'default')
            else:
                try:
                    steps.sort(key=int)
                except ValueError:
                    pass  # already sorted alpha

        self.clear_state()
        self.state['steps'] = steps
        log(DEBUG, 'Passes: {}'.format(to_str(steps)))
26160
public function init()
    {
        $this->assets = array(
            'js' => YII_DEBUG ? 'foundation/foundation.tooltips.js' : 'foundation.min.js'
        );

        Html::addCssClass($this->htmlOptions, Enum::TOOLTIP);
        Html::addCssClass($this->htmlOptions, $this->position);
        ArrayHelper::addValue('title', $this->tip, $this->htmlOptions);
        ArrayHelper::addValue('data-tooltip', 'data-tooltip', $this->htmlOptions);
        if ($this->tip === null || $this->text === null) {
            throw new InvalidConfigException('"tip" and "text" cannot be null.');
        }
        $this->registerClientScript();

        parent::init();
    }
646427
function init() {
      if ($el.hasClass('horizontal')){
        scrollDirection = 'horiz';
        scrollOffsetAttr = 'scrollLeft';
        sizeAttr = 'width';
        offsetAttr = 'left';
      }

      $el.prepend('<div class="tse-scrollbar"><div class="drag-handle"></div></div>');
      $scrollbarEl = $el.find('.tse-scrollbar');
      $dragHandleEl = $el.find('.drag-handle');

      if (options.wrapContent) {
        $contentEl.wrap('<div class="tse-scroll-content" />');
      }
      $scrollContentEl = $el.find('.tse-scroll-content');

      resizeScrollContent();

      if (options.autoHide) {
        $el.on('mouseenter', flashScrollbar);
      }

      $dragHandleEl.on('mousedown', startDrag);
      $scrollbarEl.on('mousedown', jumpScroll);
      $scrollContentEl.on('scroll', onScrolled);

      resizeScrollbar();

      $(window).on('resize', function() {
        recalculate();
      });

      if (!options.autoHide) {
        showScrollbar();
      }
    }