Sort CSS declarations alphabetically or using the set sorting order
335498
function sortCssDecls (cssDecls, sortOrder) {
  if (sortOrder === 'alphabetically') {
    timsort(cssDecls, (a, b) => {
      if (a.type === 'decl' && b.type === 'decl') {
        return comparator(a.prop, b.prop);
      } else {
        return compareDifferentType(a, b);
      }
    });
  } else {
    timsort(cssDecls, (a, b) => {
      if (a.type === 'decl' && b.type === 'decl') {
        const aIndex = sortOrder.indexOf(a.prop);
        const bIndex = sortOrder.indexOf(b.prop);
        return comparator(aIndex, bIndex);
      } else {
        return compareDifferentType(a, b);
      }
    });
  }
}
1348438
def do_sort_by(self, element, decl, pseudo):
        """"""
        if ',' in decl.value:
            css, flags = split(decl.value, ',')
        else:
            css = decl.value
            flags = None
        sort = css_to_func(serialize(css), serialize(flags or ''),
                           self.css_namespaces, self.state['lang'])
        step = self.state[self.state['current_step']]

        target = self.current_target()
        target.sort = sort
        target.lang = self.state['lang']
        target.isgroup = False
        target.groupby = None
        #  Find current target, set its sort as well
        for pos, action in \
                enumerate(reversed(step['actions'])):
            if action[0] == 'target' and \
                    action[1].tree == element.etree_element:
                action[1].sort = sort
                action[1].isgroup = False
                action[1].groupby = None
                break
358080
public void sortDeclarations(Element el, PseudoElementType pseudo)
    {
        List<Declaration> list = get(el, pseudo);
        if (list != null)
            Collections.sort(list);
    }
1318052
function CssFlagsClass() {
      var _this;

      var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
      var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var cssFlagsPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flags';

      _classCallCheck(this, CssFlagsClass);

      _this = _possibleConstructorReturn(this, _getPrototypeOf(CssFlagsClass).call(this, ua));
      _this._flags = flags;
      _this._cssFlagsPrefix = cssFlagsPrefix;
      return _this;
    }
984664
def alphabetize_attributes(self):
        
        self.attributes.sort(key=lambda name: (name == self.class_attr_name, name))
1001504
function toCssModule(styles) {
    var done = false;
    var res;

    new modules().load(styles, prefix + uni()).then(function(next) {
      done = true;
      res = next;
    });

    deasync.loopWhile(function() {
      return !done;
    });

    return res;
  }
660440
function css(prefix, escape) {
		var mw = core.base();
		mw.prefix = (typeof prefix !== 'undefined' ? prefix : 'mw-');
		mw.error = function (str) {
			return mw.wrap(str, 'error');
		};
		mw.warning = function (str) {
			return mw.wrap(str, 'warning');
		};
		mw.success = function (str) {
			return mw.wrap(str, 'success');
		};
		mw.accent = function (str) {
			return mw.wrap(str, 'accent');
		};
		mw.signal = function (str) {
			return mw.wrap(str, 'signal');
		};
		mw.muted = function (str) {
			return mw.wrap(str, 'muted');
		};
		mw.plain = function (str) {
			return mw.wrap(str, 'plain');
		};
		// html encode?
		if (escape) {
			mw.wrap = function (str, style) {
				return '<span class="' + mw.prefix + style + '">' + escapeHTML(str) + '</span>';
			};
		} else {
			mw.wrap = function (str, style) {
				return '<span class="' + mw.prefix + style + '">' + str + '</span>';
			};
		}
		mw.toString = function () {
			return '<ministyle-css>';
		};
		return mw;
	}
929548
function parseStyles(s) {
  var parser = new parserlib.css.Parser();
  var result = { property: Object.create(null), priority: Object.create(null) };
  parser.addListener("property", function(e) {
    if (e.invalid) return; // Skip errors
    result.property[e.property.text] = e.value.text;
    if (e.important) result.priority[e.property.text] = 'important';
  });
  s = (''+s).replace(/^;/, '');
  parser.parseStyleAttribute(s);
  return result;
}
476413
def csort(objs, key):
    """"""
    idxs = dict((obj, i) for (i, obj) in enumerate(objs))
    return sorted(objs, key=lambda obj: (key(obj), idxs[obj]))
1042961
function distCssFiles() {
        var src = cog.pathDist() + cog.getConfig('name') + '.css';
        var subdir = cog.getConfig('src.css') || '';
        if (subdir && subdir.indexOf('*') >= 0) {
            subdir = subdir.substr(0, subdir.indexOf('*'));
        }
        var dst = cog.pathDist() + subdir + cog.getConfig('name') + '.min.css';

        return [{src: src, dst: dst}];
    }
1090345
function _fnCompatCols ( init )
	{
		_fnCompatMap( init, 'orderable',     'bSortable' );
		_fnCompatMap( init, 'orderData',     'aDataSort' );
		_fnCompatMap( init, 'orderSequence', 'asSorting' );
		_fnCompatMap( init, 'orderDataType', 'sortDataType' );
	}
1310167
function orderAndSort(sortConf) {
    return {
        sortFieldName: sortConf.sortBy,
        sortDesc: sortConf.sortAsc === undefined ? false : !sortConf.sortAsc
    };
}
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 "";
		}
1065481
function css(prefix) {
	var stream;
	if (prefix === 'bootstrap') {
		stream = gulp.src('src/clockpicker.css');
	} else {
		// Concat with some styles picked from bootstrap
		stream = gulp.src(['src/standalone.css', 'src/clockpicker.css'])
			.pipe(concat('clockpicker.css'));
	}
	stream.pipe(rename({
			prefix: prefix + '-'
		}))
		.pipe(replace(versionRegExp, version))
		.pipe(gulp.dest('dist'))
		.pipe(minifyCSS({
			keepSpecialComments: 1
		}))
		.pipe(rename({
			suffix: '.min'
		}))
		.pipe(gulp.dest('dist'));
}
48218
function eval_css(locator, inDocument) {
    var results = [];
    try {
      window.Sizzle(locator, inDocument, results);
    } catch (ignored) {
      // Presumably poor formatting
    }
    return results;
}
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;
  }
1304047
public function prependCSS(&$attr, $css)
    {
        $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
        $attr['style'] = $css . $attr['style'];
    }