Comparing version 0.2.5 to 0.2.6
{ | ||
"name": "jss", | ||
"description": "Dynamic stylesheets for web components.", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Oleg Slobodskoi", |
@@ -111,6 +111,6 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jss=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
this.text = '' | ||
this.element = this.createElement() | ||
if (!this.attributes.type) this.attributes.type = 'text/css' | ||
if (!this.attributes.media) this.attributes.media = 'screen' | ||
if (!this.attributes.title) this.attributes.title = 'Generated by jss.' | ||
this.element = this.createElement() | ||
@@ -117,0 +117,0 @@ if (rules) this.createRules(rules) |
@@ -1,2 +0,2 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jss=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){module.exports=require("./lib/index")},{"./lib/index":4}],2:[function(require,module,exports){"use strict";var uid=0;var processors=[];function Rule(selector,style,stylesheet){if(typeof selector=="object"){stylesheet=style;style=selector;selector=null}if(selector){this.selector=selector}else{this.className=Rule.NAMESPACE_PREFIX+"-"+uid;uid++;this.selector="."+this.className}this.stylesheet=stylesheet;this.style=style}module.exports=Rule;Rule.NAMESPACE_PREFIX="jss";Rule.addPreprocessor=function(fn){processors.push(fn);return processors};Rule.prototype.runPreprocessors=function(){for(var i=0;i<processors.length;i++){processors[i](this)}return this};Rule.prototype.toString=function(){var style=this.style;var str=this.selector+" {";for(var prop in style){str+="\n "+prop+": "+style[prop]+";"}str+="\n}";return str}},{}],3:[function(require,module,exports){"use strict";var Rule=require("./Rule");function Stylesheet(rules,named,attributes){if(typeof named=="object"){attributes=named;named=false}this.element=null;this.attached=false;this.named=named||false;this.rules={};this.attributes=attributes||{};this.classes={};this.text="";this.element=this.createElement();if(!this.attributes.type)this.attributes.type="text/css";if(!this.attributes.media)this.attributes.media="screen";if(!this.attributes.title)this.attributes.title="Generated by jss.";if(rules)this.createRules(rules)}module.exports=Stylesheet;Stylesheet.prototype.attach=function(){if(this.attached)return this;if(!this.text){this.text=this.toString();this.element.innerHTML="\n"+this.text+"\n"}document.head.appendChild(this.element);this.attached=true;return this};Stylesheet.prototype.detach=function(){if(!this.attached)return this;this.element.parentNode.removeChild(this.element);this.attached=false;return this};Stylesheet.prototype.addRule=function(key,style){var rule=this.createRule(key,style);var sheet=this.element.sheet;sheet.insertRule(rule.toString(),sheet.cssRules.length);return rule};Stylesheet.prototype.addRules=function(rules){for(var key in rules){this.addRule(key,rules[key])}return this};Stylesheet.prototype.getRule=function(key){return this.rules[key]};Stylesheet.prototype.toString=function(){var str="";var rules=this.rules;for(var key in rules){if(str)str+="\n";str+=rules[key].toString()}return str};Stylesheet.prototype.createRule=function(key,style){var selector,name;if(this.named)name=key;else selector=key;var rule=new Rule(selector,style,this);this.rules[name||rule.selector]=rule;if(this.named)this.classes[name]=rule.className;rule.runPreprocessors();return rule};Stylesheet.prototype.createRules=function(rules){for(var key in rules){this.createRule(key,rules[key])}return this};Stylesheet.prototype.createElement=function(){var el=document.createElement("style");for(var name in this.attributes)el.setAttribute(name,this.attributes[name]);return el}},{"./Rule":2}],4:[function(require,module,exports){/** | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jss=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){module.exports=require("./lib/index")},{"./lib/index":4}],2:[function(require,module,exports){"use strict";var uid=0;var processors=[];function Rule(selector,style,stylesheet){if(typeof selector=="object"){stylesheet=style;style=selector;selector=null}if(selector){this.selector=selector}else{this.className=Rule.NAMESPACE_PREFIX+"-"+uid;uid++;this.selector="."+this.className}this.stylesheet=stylesheet;this.style=style}module.exports=Rule;Rule.NAMESPACE_PREFIX="jss";Rule.addPreprocessor=function(fn){processors.push(fn);return processors};Rule.prototype.runPreprocessors=function(){for(var i=0;i<processors.length;i++){processors[i](this)}return this};Rule.prototype.toString=function(){var style=this.style;var str=this.selector+" {";for(var prop in style){str+="\n "+prop+": "+style[prop]+";"}str+="\n}";return str}},{}],3:[function(require,module,exports){"use strict";var Rule=require("./Rule");function Stylesheet(rules,named,attributes){if(typeof named=="object"){attributes=named;named=false}this.element=null;this.attached=false;this.named=named||false;this.rules={};this.attributes=attributes||{};this.classes={};this.text="";if(!this.attributes.type)this.attributes.type="text/css";if(!this.attributes.media)this.attributes.media="screen";if(!this.attributes.title)this.attributes.title="Generated by jss.";this.element=this.createElement();if(rules)this.createRules(rules)}module.exports=Stylesheet;Stylesheet.prototype.attach=function(){if(this.attached)return this;if(!this.text){this.text=this.toString();this.element.innerHTML="\n"+this.text+"\n"}document.head.appendChild(this.element);this.attached=true;return this};Stylesheet.prototype.detach=function(){if(!this.attached)return this;this.element.parentNode.removeChild(this.element);this.attached=false;return this};Stylesheet.prototype.addRule=function(key,style){var rule=this.createRule(key,style);var sheet=this.element.sheet;sheet.insertRule(rule.toString(),sheet.cssRules.length);return rule};Stylesheet.prototype.addRules=function(rules){for(var key in rules){this.addRule(key,rules[key])}return this};Stylesheet.prototype.getRule=function(key){return this.rules[key]};Stylesheet.prototype.toString=function(){var str="";var rules=this.rules;for(var key in rules){if(str)str+="\n";str+=rules[key].toString()}return str};Stylesheet.prototype.createRule=function(key,style){var selector,name;if(this.named)name=key;else selector=key;var rule=new Rule(selector,style,this);this.rules[name||rule.selector]=rule;if(this.named)this.classes[name]=rule.className;rule.runPreprocessors();return rule};Stylesheet.prototype.createRules=function(rules){for(var key in rules){this.createRule(key,rules[key])}return this};Stylesheet.prototype.createElement=function(){var el=document.createElement("style");for(var name in this.attributes)el.setAttribute(name,this.attributes[name]);return el}},{"./Rule":2}],4:[function(require,module,exports){/** | ||
* Stylesheets written in javascript. | ||
@@ -3,0 +3,0 @@ * |
@@ -141,6 +141,6 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
this.text = '' | ||
this.element = this.createElement() | ||
if (!this.attributes.type) this.attributes.type = 'text/css' | ||
if (!this.attributes.media) this.attributes.media = 'screen' | ||
if (!this.attributes.title) this.attributes.title = 'Generated by jss.' | ||
this.element = this.createElement() | ||
@@ -147,0 +147,0 @@ if (rules) this.createRules(rules) |
## 0.2.5 / 2014-11-02 | ||
- create perf comparence for bootstrap #13 | ||
## 0.2.5 / 2014-11-02 | ||
- create css->jss converter #11 | ||
@@ -4,0 +8,0 @@ |
@@ -25,6 +25,6 @@ 'use strict' | ||
this.text = '' | ||
this.element = this.createElement() | ||
if (!this.attributes.type) this.attributes.type = 'text/css' | ||
if (!this.attributes.media) this.attributes.media = 'screen' | ||
if (!this.attributes.title) this.attributes.title = 'Generated by jss.' | ||
this.element = this.createElement() | ||
@@ -31,0 +31,0 @@ if (rules) this.createRules(rules) |
{ | ||
"name": "jss", | ||
"description": "Dynamic stylesheets for web components.", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Oleg Slobodskoi", |
@@ -253,2 +253,8 @@ ## Dynamic stylesheets for web components. | ||
## Benchmarks | ||
To make some realistic assumptions about performance overhead, I have converted bootstraps css to jss. In `bench/bootstrap` folder you will find [jss](http://kof.github.io/jss/bench/bootstrap/jss.html) and [css](http://kof.github.io/jss/bench/bootstrap/css.html) files. You need to try more than once to have some average value. | ||
In my tests overhead is 10-15ms. | ||
## Run tests | ||
@@ -255,0 +261,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
326990
273
0