Initialize a new `Converter` with the given `css`.

@param {String} css
@api private
332363
function Converter(css) {
  var parse = require('css-parse');
  this.css = css;
  this.root = parse(css, { position: false });
  this.indents = 0;
}
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)))
713221
def init(extension="css")
      if (extension.eql?("css") || extension.eql?("scss"))
        Richcss::Generators::Template.start([extension])
      else
        puts "Only support css or scss extension, default is css"
      end
    end
941447
function($from, $to, properties) {
		var i, n, styles = {};
		if (properties) {
			for (i = 0, n = properties.length; i < n; i++) {
				styles[properties[i]] = $from.css(properties[i]);
			}
		} else {
			styles = $from.css();
		}
		$to.css(styles);
	}
990674
function css(property) {
        if (cssCache[property] === undefined) {
            var domProperty = property.
                replace(/(-[\s\S])/g, function(c) { return c.charAt(1).toUpperCase(); });
            var prefixedDom = style(domProperty);
            cssCache[property] = domToCss(prefixedDom);
        }
        return cssCache[property];
    }
209260
function parseCSS(data) {
		var out = {};
		var cssCategories = data.cats.CSS;
		Object.keys(data.data).forEach(function(name) {
			var section = data.data[name];
			if (name in cssSections) {
				cssSections[name].forEach(function(kw) {
					out[kw] = section.stats;
				});
			}
		});

		return out;
	}
913142
function parseSpaces(css) {
    var start = pos;

    // Read the string until we meet a non-space character:
    for (; pos < css.length; pos++) {
      if (css.charAt(pos) !== ' ') break;
    }

    // Add a substring containing only spaces to tokens:
    pushToken(TokenType.Space, css.substring(start, pos--), col);
    col += pos - start;
  }
589338
function loadCss() {
        var linkElm, contentCss = editor.settings.codesample_content_css;

        if (editor.inline && addedInlineCss) {
          return;
        }

        if (!editor.inline && addedCss) {
          return;
        }

        if (editor.inline) {
          addedInlineCss = true;
        } else {
          addedCss = true;
        }

        if (contentCss !== false) {
          linkElm = editor.dom.create('link', {
            rel: 'stylesheet',
            href: contentCss ? contentCss : pluginUrl + '/css/prism.css'
          });

          editor.getDoc().getElementsByTagName('head')[0].appendChild(linkElm);
        }
      }
863843
function parser(config) {
    chevrotain.Parser.call(this, cssTokens, config)

    var $ = this

    this.RULE("stylesheet", function() {
        // [ CHARSET_SYM STRING ';' ]?
        $.OPTION(function() {
            $.SUBRULE($.charsetHeader)
        })

        // [S|CDO|CDC]*
        $.SUBRULE($.cdcCdo)

        // [ import [ CDO S* | CDC S* ]* ]*
        $.MANY(function() {
            $.SUBRULE($.cssImport)
            $.SUBRULE2($.cdcCdo)
        })

        // [ [ ruleset | media | page ] [ CDO S* | CDC S* ]* ]*
        $.MANY2(function() {
            $.SUBRULE($.contents)
        })
    })

    this.RULE("charsetHeader", function() {
        $.CONSUME(CharsetSym)
        $.CONSUME(StringLiteral)
        $.CONSUME(SemiColon)
    })

    this.RULE("contents", function() {
        // prettier-ignore
        $.OR([
            {ALT: function() {$.SUBRULE($.ruleset)}},
            {ALT: function() {$.SUBRULE($.media)}},
            {ALT: function() {$.SUBRULE($.page)}}
        ])
        $.SUBRULE3($.cdcCdo)
    })

    // factor out repeating pattern for cdc/cdo
    this.RULE("cdcCdo", function() {
        $.MANY(function() {
            // prettier-ignore
            $.OR([
                {ALT: function() {$.CONSUME(Cdo)}},
                {ALT: function() {$.CONSUME(Cdc)}}
            ])
        })
    })

    // IMPORT_SYM S*
    // [STRING|URI] S* media_list? ';' S*
    this.RULE("cssImport", function() {
        $.CONSUME(ImportSym)
        // prettier-ignore
        $.OR([
            {ALT: function() {$.CONSUME(StringLiteral)}},
            {ALT: function() {$.CONSUME(Uri)}}
        ])

        $.OPTION(function() {
            $.SUBRULE($.media_list)
        })

        $.CONSUME(SemiColon)
    })

    // MEDIA_SYM S* media_list '{' S* ruleset* '}' S*
    this.RULE("media", function() {
        $.CONSUME(MediaSym)
        $.SUBRULE($.media_list)
        $.CONSUME(LCurly)
        $.SUBRULE($.ruleset)
        $.CONSUME(RCurly)
    })

    // medium [ COMMA S* medium]*
    this.RULE("media_list", function() {
        $.SUBRULE($.medium)
        $.MANY_SEP({
            SEP: Comma,
            DEF: function() {
                $.SUBRULE2($.medium)
            }
        })
    })

    // IDENT S*
    this.RULE("medium", function() {
        $.CONSUME(Ident)
    })

    // PAGE_SYM S* pseudo_page?
    // '{' S* declaration? [ ';' S* declaration? ]* '}' S*
    this.RULE("page", function() {
        $.CONSUME(PageSym)
        $.OPTION(function() {
            $.SUBRULE($.pseudo_page)
        })

        $.SUBRULE($.declarationsGroup)
    })

    // '{' S* declaration? [ ';' S* declaration? ]* '}' S*
    // factored out repeating grammar pattern
    this.RULE("declarationsGroup", function() {
        $.CONSUME(LCurly)
        $.OPTION(function() {
            $.SUBRULE($.declaration)
        })

        $.MANY(function() {
            $.CONSUME(SemiColon)
            $.OPTION2(function() {
                $.SUBRULE2($.declaration)
            })
        })
        $.CONSUME(RCurly)
    })

    // ':' IDENT S*
    this.RULE("pseudo_page", function() {
        $.CONSUME(Colon)
        $.CONSUME(Ident)
    })

    // '/' S* | ',' S*
    this.RULE("operator", function() {
        // prettier-ignore
        $.OR([
            {ALT: function() {$.CONSUME(Slash)}},
            {ALT: function() {$.CONSUME(Comma)}}
        ])
    })

    // '+' S* | '>' S*
    this.RULE("combinator", function() {
        // prettier-ignore
        $.OR([
            {ALT: function() {$.CONSUME(Plus)}},
            {ALT: function() {$.CONSUME(GreaterThan)}}
        ])
    })

    // '-' | '+'
    this.RULE("unary_operator", function() {
        // prettier-ignore
        $.OR([
            {ALT: function() {$.CONSUME(Minus)}},
            {ALT: function() {$.CONSUME(Plus)}}
        ])
    })

    // IDENT S*
    this.RULE("property", function() {
        $.CONSUME(Ident)
    })

    // selector [ ',' S* selector ]*
    // '{' S* declaration? [ ';' S* declaration? ]* '}' S*
    this.RULE("ruleset", function() {
        $.MANY_SEP({
            SEP: Comma,
            DEF: function() {
                $.SUBRULE($.selector)
            }
        })

        $.SUBRULE($.declarationsGroup)
    })

    // simple_selector [ combinator selector | S+ [ combinator? selector ]? ]?
    this.RULE("selector", function() {
        $.SUBRULE($.simple_selector)
        $.OPTION(function() {
            $.OPTION2(function() {
                $.SUBRULE($.combinator)
            })
            $.SUBRULE($.selector)
        })
    })

    // element_name [ HASH | class | attrib | pseudo ]*
    // | [ HASH | class | attrib | pseudo ]+
    this.RULE("simple_selector", function() {
        $.OR([
            {
                ALT: function() {
                    $.SUBRULE($.element_name)
                    $.MANY(function() {
                        $.SUBRULE($.simple_selector_suffix)
                    })
                }
            },
            {
                ALT: function() {
                    $.AT_LEAST_ONE(function() {
                        $.SUBRULE2($.simple_selector_suffix)
                    }, "selector suffix")
                }
            }
        ])
    })

    // helper grammar rule to avoid repetition
    // [ HASH | class | attrib | pseudo ]+
    this.RULE("simple_selector_suffix", function() {
        // prettier-ignore
        $.OR([
            {ALT: function() {$.CONSUME(Hash)}},
            {ALT: function() {$.SUBRULE($.class)}},
            {ALT: function() {$.SUBRULE($.attrib)}},
            {ALT: function() {$.SUBRULE($.pseudo)}}
        ])
    })

    // '.' IDENT
    this.RULE("class", function() {
        $.CONSUME(Dot)
        $.CONSUME(Ident)
    })

    // IDENT | '*'
    this.RULE("element_name", function() {
        // prettier-ignore
        $.OR([
            {ALT: function() {$.CONSUME(Ident)}},
            {ALT: function() {$.CONSUME(Star)}}
        ])
    })

    // '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S* [ IDENT | STRING ] S* ]? ']'
    this.RULE("attrib", function() {
        $.CONSUME(LSquare)
        $.CONSUME(Ident)

        this.OPTION(function() {
            // prettier-ignore
            $.OR([
                {ALT: function() {$.CONSUME(Equals)}},
                {ALT: function() {$.CONSUME(Includes)}},
                {ALT: function() {$.CONSUME(Dasmatch)}}
            ])

            // prettier-ignore
            $.OR2([
                {ALT: function() {$.CONSUME2(Ident)}},
                {ALT: function() {$.CONSUME(StringLiteral)}}
            ])
        })
        $.CONSUME(RSquare)
    })

    // ':' [ IDENT | FUNCTION S* [IDENT S*]? ')' ]
    this.RULE("pseudo", function() {
        $.CONSUME(Colon)

        // prettier-ignore
        $.OR([
            {ALT: function() {$.CONSUME(Ident)}},
            {
                ALT: function() {
                    $.CONSUME(Func)
                    $.OPTION(function() {
                        $.CONSUME2(Ident)
                    })
                    $.CONSUME(RParen)
                }
            }
        ])
    })

    // property ':' S* expr prio?
    this.RULE("declaration", function() {
        $.SUBRULE($.property)
        $.CONSUME(Colon)
        $.SUBRULE($.expr)

        $.OPTION(function() {
            $.SUBRULE($.prio)
        })
    })

    // IMPORTANT_SYM S*
    this.RULE("prio", function() {
        $.CONSUME(ImportantSym)
    })

    // term [ operator? term ]*
    this.RULE("expr", function() {
        $.SUBRULE($.term)
        $.MANY(function() {
            $.OPTION(function() {
                $.SUBRULE($.operator)
            })
            $.SUBRULE2($.term)
        })
    })

    // unary_operator?
    // [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* |
    // TIME S* | FREQ S* ]
    // | STRING S* | IDENT S* | URI S* | hexcolor | function
    this.RULE("term", function() {
        $.OPTION(function() {
            $.SUBRULE($.unary_operator)
        })

        // prettier-ignore
        $.OR([
            {ALT: function() {$.CONSUME(Num)}},
            {ALT: function() {$.CONSUME(Percentage)}},
            {ALT: function() {$.CONSUME(Length)}},
            {ALT: function() {$.CONSUME(Ems)}},
            {ALT: function() {$.CONSUME(Exs)}},
            {ALT: function() {$.CONSUME(Angle)}},
            {ALT: function() {$.CONSUME(Time)}},
            {ALT: function() {$.CONSUME(Freq)}},
            {ALT: function() {$.CONSUME(StringLiteral)}},
            {ALT: function() {$.CONSUME(Ident)}},
            {ALT: function() {$.CONSUME(Uri)}},
            {ALT: function() {$.SUBRULE($.hexcolor)}},
            {ALT: function() {$.SUBRULE($.cssFunction)}}
        ])
    })

    // FUNCTION S* expr ')' S*
    this.RULE("cssFunction", function() {
        $.CONSUME(Func)
        $.SUBRULE($.expr)
        $.CONSUME(RParen)
    })

    this.RULE("hexcolor", function() {
        $.CONSUME(Hash)
    })

    // very important to call this after all the rules have been setup.
    // otherwise the parser may not work correctly as it will lack information
    // derived from the self analysis.
    this.performSelfAnalysis()
}
694184
def initialize_css_style_conversion
      @defined_style_conversions = {
        # styles shared or common logic across all node types go here.
        # Special conversion lambdas such as :_border can be
        # defined here for reuse across several AST nodes. Care must
        # be taken to avoid possible naming conflicts, hence the underscore.
        # AST class keys should be stored with their names converted from
        # camelcase to lowercased snakecase, i.e. TestCase = test_case
        node: {
          'background-color' => lambda { |v|
            return 'shd', { val: 'clear', fill: v.delete('#') }
          },
          _border: lambda { |v|
            props = { sz: 2, val: 'single', color: '000000' }
            vals = v.split
            vals[1] = 'single' if vals[1] == 'solid'
            #
            props[:sz] = @defined_style_conversions[:node][:_sz].call(vals[0])
            props[:val] = vals[1] if vals[1]
            props[:color] = vals[2].delete('#') if vals[2]
            #
            return props
          },
          _sz: lambda { |v|
            return nil unless v
            (2 * Float(v.gsub(/[^\d.]/, '')).ceil).to_s
          },
          'text-align' => ->(v) { return 'jc', v }
        },
        # Styles specific to the Table AST class
        table: {
          'border' => lambda { |v|
            props = @defined_style_conversions[:node][:_border].call(v)
            #
            return 'tblBorders', [
              { top: props }, { start: props }, { bottom: props },
              { end: props }, { insideH: props }, { insideV: props }
            ]
          },
          'margin' => lambda { |v|
            vals = v.split.map do |s|
              @defined_style_conversions[:node][:_sz].call(s)
            end
            #
            props = [vals[0], vals[0], vals[0], vals[0]] if vals.length == 1
            props = [vals[0], vals[1], vals[0], vals[1]] if vals.length == 2
            props = [vals[0], vals[1], vals[2], vals[1]] if vals.length == 3
            props = [vals[0], vals[1], vals[2], vals[3]] if vals.length > 3
            return 'tblCellMar', [
              { top: { w: props[0], type: 'dxa' } },
              { end: { w: props[1], type: 'dxa' } },
              { bottom: { w: props[2], type: 'dxa' } },
              { start: { w: props[3], type: 'dxa' } }
            ]
          },
          'cellspacing' => lambda { |v|
            v = @defined_style_conversions[:node][:_sz].call(v)
            return 'tblCellSpacing', { w: v, type: 'dxa' }
          },
          'width' => lambda { |v|
            v = @defined_style_conversions[:node][:_sz].call(v)
            return 'tblW', { w: v, type: 'dxa' }
          }
        },
        # Styles specific to the TableCell AST class
        table_cell: {
          'border' => lambda { |v|
            value = @defined_style_conversions[:table]['border'].call(v)[1]
            return 'tcBorders', value
          },
          'colspan' => ->(v) { return 'gridSpan', v },
          'margin' => lambda { |v|
            value = @defined_style_conversions[:table]['margin'].call(v)[1]
            return 'tcMar', value
          },
          'rowspan' => lambda { |v|
            return 'vMerge', 'restart' if v == 'start'
            return 'vMerge', v if v == 'continue'
            return 'vMerge', nil if v == 'end'
          },
          'vertical-align' => ->(v) { return 'vAlign', v },
          'white-space' => lambda { |v|
            return 'noWrap', nil if v == 'nowrap'
            return 'tcFitText', 'true' if v == 'fit'
          },
          'width' => lambda { |v|
            value = @defined_style_conversions[:table]['width'].call(v)[1]
            return 'tcW', value
          }
        },
        # Styles specific to the Paragraph AST class
        paragraph: {
          'border' => lambda { |v|
            props = @defined_style_conversions[:node][:_border].call(v)
            #
            return 'pBdr', [
              { top: props }, { bottom: props },
              { left: props }, { right: props }
            ]
          },
          'vertical-align' => ->(v) { return 'textAlignment', v }
        },
        # Styles specific to a run of text
        run: {
          'color' => ->(v) { return 'color', v.delete('#') },
          'font-size' => lambda { |v|
            return 'sz', @defined_style_conversions[:node][:_sz].call(v)
          },
          'font-style' => lambda { |v|
            return 'b', nil if v =~ /bold/
            return 'i', nil if v =~ /italic/
          },
          'font-weight' => ->(v) { return 'b', nil if v =~ /bold/ },
          'text-decoration' => lambda { |v|
            supported = %w[line-through underline]
            props = v.split
            return props[0], 'true' unless supported.include? props[0]
            return 'strike', 'true' if props[0] == 'line-through'
            return 'u', 'single' if props.length == 1
            return 'u', { val: props[1], color: 'auto' } if props.length == 2
            return 'u', { val: props[1], color: props[2].delete('#') }
          },
          'vertical-align' => lambda { |v|
            return 'vertAlign', 'subscript' if v =~ /sub/
            return 'vertAlign', 'superscript' if v =~ /super/
          }
        }
      }
    end
571003
function createCssyBrowser (src, imports) {
  imports = imports || []

  var changeListeners = []

  var instances = []

  function findInstance (to, media) {
    for (var i = 0, len = instances.length; i < len; i++) {
      if (instances[i].to === to && instances[i].media === media) {
        return instances[i]
      }
    }
    return null
  }

  function removeInstance (instance) {
    var result = []
    for (var i = 0, len = instances.length; i < len; i++) {
      if (instances[i] !== instance) {
        result.push(instances[i])
      }
    }
    instances = result
  }

  /**
   * CssyBrowser is the object exported by a module handled by cssy:
   *
   * ```javascript
   * var myCss = require('./my.css')
   * // myCss is a CssyBrowser
   * ```
   *
   * A CssyBrowser instance can be used as:
   *
   * - **An string** when used in a context that imply a string: thanks to
   *   `CssyBrowser.toString()` that return the css source.
   * - **A function**, alias of CssyBrowser.insert([to, [media]]), to inject
   *   the css source in the document: `myCss()`,
   *   `myCss(element)` or `myCss(element, 'media query')`.
   * - **An object** with the methods described below.
   *
   * @return {Object}
   *         See [CssyBrowser.insert()](#cssybrowserinsertto-media)
   */
  function CssyBrowser () {
    return CssyBrowser.insert.apply(null, arguments)
  }

  /**
   * Insert css source in the DOM
   *
   * Create and append a `<style>` element in the dom at `to`. If the source contain
   * `@import` at-rules, imported CssyBrowser modules are injected too.
   *
   * The content of all the injected `<style>` element is binded to css source
   * change: When `.update()` is called by you or by the cssy's live source
   * reload server.
   *
   * If a style element with the same parent (`to`) and the same media query
   * already exists, then this function only increment a counter for this kind
   * of pair (parent/media-query). And remove() calls only decrement this
   * counter until no more consumer require this style to be inserted.
   *
   *
   * @param  {HTMLElement|ShadowRoot} [to]
   *         Where to inject the style. Default to document's head.
   *
   * @param  {String} [media]
   *         Set the media attribute of the injected style tag
   *
   * @return {Object}
   *         An object with:
   *         - `element` **{HTMLElement}**: The `style` element inserted
   *         - `children` **{Array}**: The other CssyBrowser instances imported
   *           and injected by this instance
   *         - `remove` **{Function}**: Remove injected `style` element and all
   *           other CssyBrowser instances imported
   */
  CssyBrowser.insert = function (to, media) {
    var children, element, instance

    // Parent for style element (default is document's head)
    to = to || document.getElementsByTagName('head')[0]

    // Insert each imported styles
    children = imports.map(function (imp) {
      var submodule = imp.module
      var child

      var submedia = []
      if (media) { submedia.push(media) }
      if (imp.media) { submedia.push(imp.media) }
      submedia = submedia.join(' and ')

      if (typeof (submodule.insert) === 'function') {
        child = submodule.insert(to, submedia)
      } else if (typeof (submodule.toString) === 'function') {
        // A string or any thing that provide a string
        // we crate and inject a new CssyBrowser instance.
        // As this module is not bundler with cssy's transform
        // we can not provide live source update.
        child = createCssyBrowser(submodule.toString()).insert(to, submedia)
      }
      return child
    })

    // Source content update (used as listener for change event)
    function update (src) {
      if (element.styleSheet) {
        element.styleSheet.cssText = src
      } else {
        element.textContent = src
      }
    }

    // Is this parent (to) contain already an instance of this css source
    // with the same media query ?
    instance = findInstance(to, media)

    if (instance) {
      element = instance.element
      instance.counter++
    } else {
      element = document.createElement('style')
      element.setAttribute('type', 'text/css')
      if (media) {
        element.setAttribute('media', media)
      }
      to.appendChild(element)
      instances.push({
        element: element,
        to: to,
        media: media,
        counter: 1
      })
      // Initialize:
      update(CssyBrowser.toString())
      CssyBrowser.onChange(update)
    }

    function remove () {
      var instance = findInstance(to, media)
      if (!instance) return
      instance.counter--
      if (instance.counter === 0) {
        removeInstance(instance)
        CssyBrowser.offChange(update)
        try {
          element.parentNode.removeChild(element)
        } catch (_) {}
      }
      children.forEach(function (child) {
        if (typeof (child.remove) === 'function') {
          child.remove()
        }
      })
    }

    return {
      element: element,
      children: children,
      remove: remove
    }
  }

  /**
   * Update current css source
   *
   * Each inject style element are updated too
   *
   * @param  {String} src
   */
  CssyBrowser.update = function (src) {
    CssyBrowser.src = src
    changeListeners.forEach(function (listener) {
      listener(src)
    })
    return CssyBrowser
  }

  /**
   * Listen for css source changes
   *
   * @param {Function} listener
   *        Change listener. Receive new css source
   */
  CssyBrowser.onChange = function (listener) {
    changeListeners.push(listener)
    return CssyBrowser
  }

  /**
   * Detach change listener
   *
   * @param {Function} listener
   */
  CssyBrowser.offChange = function (listener) {
    changeListeners = changeListeners.filter(function (l) { return l !== listener })
    return CssyBrowser
  }

  /**
   * Get the imported CssyBrowser instance (based on `@import` at-rules)
   *
   * @return {Array}
   *         Array of CssyBrowser instance
   */
  CssyBrowser.getImports = function () {
    return imports
  }

  /**
   * Override default toString()
   *
   * @return {String}
   *         The current css source
   */
  CssyBrowser.toString = function () {
    return CssyBrowser.src
  }

  CssyBrowser.src = src

  return CssyBrowser
}
1095033
function appendCSS(cssText, element) {
  console.log(element);
  const styleElement = document.createElement('style');
  styleElement.setAttribute('type', 'text/css');
  styleElement.innerHTML = cssText;
  const refNode = element.hasChildNodes() ? element.children[0] : null;
  element.insertBefore(styleElement, refNode);
}
494715
def parse_css(self, css):
        
        rulesets = self.ruleset_re.findall(css)
        for (selector, declarations) in rulesets:
            rule = Rule(self.parse_selector(selector))
            rule.properties = self.parse_declarations(declarations)
            self.rules.append(rule)
1314005
function setCss (dom, obj) {
    let css = ''

    for (let key in obj) {
      if (!obj[key] && obj[key] !== 0) {
        dom.style.removeProperty(dasherize(key))
      } else {
        css += dasherize(key) + ':' + obj[key] + ';'
      }
    }

    dom.style.cssText += ';' + css
  }
1168919
private void initCss() {

        I_CmsLayoutBundle.INSTANCE.galleryDialogCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.galleryResultItemCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.listTreeCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.previewDialogCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.croppingDialogCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.imageEditorFormCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.imageAdvancedFormCss().ensureInjected();
    }
1012408
function setCss(el, prop, val, idx) {
  if ('string' == typeof prop) {
    var styles = getCss(el);
    if (typeof val === 'function') {
      val = val.call(el, idx, styles[prop]);
    }

    if (val === '') {
      delete styles[prop];
    } else if (val != null) {
      styles[prop] = val;
    }

    el.attribs.style = stringify(styles);
  } else if ('object' == typeof prop) {
    Object.keys(prop).forEach(function(k){
      setCss(el, k, prop[k]);
    });
  }
}
1108380
public void init(Converter converter, Converter convIndent, int iIndentAmount)
    {
        m_convIndent = null;
        m_iIndentAmount = 0;
        super.init(converter);
        m_convIndent = convIndent;
        m_iIndentAmount = iIndentAmount;
    }