Sha256: fa7101393439a3e4e14ade86acb9677a14c446a7fa3268f3d9574c188c4d19ab
Contents?: true
Size: 1.59 KB
Versions: 29
Compression:
Stored size: 1.59 KB
Contents
/* --- name : Sheet authors : Thomas Aylott copyright : © 2010 Thomas Aylott license : MIT provides : Sheet requires : SheetParser.CSS ... */ ;(function(exports){ /*<depend>*/ var UNDEF = {undefined:1} /*<CommonJS>*/ var SheetParser = UNDEF[typeof require] ? exports.SheetParser : require('./SheetParser.CSS').SheetParser exports.Sheet = Sheet /*</CommonJS>*/ /*<debug>*/;if (!(!UNDEF[typeof SheetParser] && SheetParser.CSS)) throw new Error('Missing required function: "SheetParser.CSS"');/*</debug>*/ /*</depend>*/ Sheet.version = '1.0.1' function Sheet(cssText){ if (this instanceof Sheet) this.initialize(cssText) else return Sheet.from(cssText) } Sheet.from = function(cssText){ return new Sheet(cssText) } Sheet.prototype = { parser: SheetParser.CSS, initialize: function(cssText){ this.cssText = cssText || '' this.style = this.rules = this.cssRules = this.parser.parse(this.cssText) var self = this }, update: function(){ var cssText = '', i = -1, rule, rules = this.style || this.rules || this.cssRules while ((rule = rules[++i])){ if (typeof rule == 'object'){ // cssRule if (this.update) rule.cssText = this.update.call(rule) cssText += rule.cssText = rule.selectorText + '{' + rule.cssText + '}' } else { // style key/value cssText += rule + ':' cssText += rules[rule] + ';' } } if (rules.selectorText) return rules.cssText = rules.selectorText + '{' + cssText + '}' return rules.cssText = cssText } } Sheet.prototype.toString = Sheet.prototype.update }(typeof exports != 'undefined' ? exports : this));
Version data entries
29 entries across 29 versions & 1 rubygems