update deps
This commit is contained in:
16
node_modules/cssom/README.mdown
generated
vendored
16
node_modules/cssom/README.mdown
generated
vendored
@@ -1,6 +1,6 @@
|
||||
# CSSOM
|
||||
|
||||
CSSOM.js is a CSS parser written in pure JavaScript. It also a partial implementation of [CSS Object Model](http://dev.w3.org/csswg/cssom/).
|
||||
CSSOM.js is a CSS parser written in pure JavaScript. It is also a partial implementation of [CSS Object Model](http://dev.w3.org/csswg/cssom/).
|
||||
|
||||
CSSOM.parse("body {color: black}")
|
||||
-> {
|
||||
@@ -22,12 +22,11 @@ CSSOM.js is a CSS parser written in pure JavaScript. It also a partial implement
|
||||
Works well in Google Chrome 6+, Safari 5+, Firefox 3.6+, Opera 10.63+.
|
||||
Doesn't work in IE < 9 because of unsupported getters/setters.
|
||||
|
||||
To use CSSOM.js in the browser you might want to build a one-file version that exposes CSSOM global variable:
|
||||
To use CSSOM.js in the browser you might want to build a one-file version that exposes a single `CSSOM` global variable:
|
||||
|
||||
➤ git clone https://github.com/NV/CSSOM.git
|
||||
➤ cd CSSOM
|
||||
➤ npm install -d
|
||||
➤ ./node_modules/.bin/jake
|
||||
➤ node build.js
|
||||
build/CSSOM.js is done
|
||||
|
||||
To use it with Node.js or any other CommonJS loader:
|
||||
@@ -36,7 +35,7 @@ To use it with Node.js or any other CommonJS loader:
|
||||
|
||||
## Don’t use it if...
|
||||
|
||||
You parse CSS to mungle, minify or reformat the following code:
|
||||
You parse CSS to mungle, minify or reformat code like this:
|
||||
|
||||
```css
|
||||
div {
|
||||
@@ -47,8 +46,7 @@ div {
|
||||
|
||||
This pattern is often used to give browsers that don’t understand linear gradients a fallback solution (e.g. gray color in the example).
|
||||
In CSSOM, `background: gray` [gets overwritten](http://nv.github.io/CSSOM/docs/parse.html#css=div%20%7B%0A%20%20%20%20%20%20background%3A%20gray%3B%0A%20%20%20%20background%3A%20linear-gradient(to%20bottom%2C%20white%200%25%2C%20black%20100%25)%3B%0A%7D).
|
||||
The last same-name property always overwrites all the previous ones.
|
||||
|
||||
It doesn't get preserved.
|
||||
|
||||
If you do CSS mungling, minification, image inlining, and such, CSSOM.js is no good for you, considere using one of the following:
|
||||
|
||||
@@ -58,9 +56,9 @@ If you do CSS mungling, minification, image inlining, and such, CSSOM.js is no g
|
||||
* [mensch](https://github.com/brettstimmerman/mensch)
|
||||
|
||||
|
||||
## [Specs](http://nv.github.com/CSSOM/spec/)
|
||||
## [Tests](http://nv.github.com/CSSOM/spec/)
|
||||
|
||||
To run specs locally:
|
||||
To run tests locally:
|
||||
|
||||
➤ git submodule init
|
||||
➤ git submodule update
|
||||
|
362
node_modules/cssom/lib/Parser.js
generated
vendored
362
node_modules/cssom/lib/Parser.js
generated
vendored
@@ -1,362 +0,0 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet,
|
||||
CSSStyleRule: require("./CSSStyleRule").CSSStyleRule,
|
||||
CSSImportRule: require("./CSSImportRule").CSSImportRule,
|
||||
CSSMediaRule: require("./CSSMediaRule").CSSMediaRule
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
CSSOM.Parser = function Parser() {};
|
||||
|
||||
/**
|
||||
* @param {string} cssText
|
||||
* @param {Object} options
|
||||
*/
|
||||
CSSOM.Parser.prototype.parseStyleSheet = function(cssText, options) {
|
||||
options = options || {};
|
||||
var i = options.startIndex || 0;
|
||||
|
||||
for (var character; character = token.charAt(i); i++) {
|
||||
switch (character) {
|
||||
|
||||
case " ":
|
||||
case "\t":
|
||||
case "\r":
|
||||
case "\n":
|
||||
case "\f":
|
||||
if (SIGNIFICANT_WHITESPACE[state]) {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
CSSOM.Parser.prototype.parse = function(token, options) {
|
||||
|
||||
options = options || {};
|
||||
var i = options.startIndex || 0;
|
||||
|
||||
this.styleSheetStart(i);
|
||||
|
||||
/**
|
||||
"before-selector" or
|
||||
"selector" or
|
||||
"atRule" or
|
||||
"atBlock" or
|
||||
"before-name" or
|
||||
"name" or
|
||||
"before-value" or
|
||||
"value"
|
||||
*/
|
||||
var state = options.state || "before-selector";
|
||||
|
||||
var index;
|
||||
var j = i;
|
||||
var buffer = "";
|
||||
|
||||
var SIGNIFICANT_WHITESPACE = {
|
||||
"selector": true,
|
||||
"value": true,
|
||||
"atRule": true,
|
||||
"importRule-begin": true,
|
||||
"importRule": true,
|
||||
"atBlock": true
|
||||
};
|
||||
|
||||
var styleSheet = new CSSOM.CSSStyleSheet;
|
||||
|
||||
// @type CSSStyleSheet|CSSMediaRule
|
||||
var currentScope = styleSheet;
|
||||
|
||||
var selector, name, value, priority="", styleRule, mediaRule, importRule;
|
||||
|
||||
var declarationStarts;
|
||||
var declarationEnds;
|
||||
|
||||
for (var character; character = token.charAt(i); i++) {
|
||||
|
||||
switch (character) {
|
||||
|
||||
case " ":
|
||||
case "\t":
|
||||
case "\r":
|
||||
case "\n":
|
||||
case "\f":
|
||||
if (SIGNIFICANT_WHITESPACE[state]) {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
// String
|
||||
case '"':
|
||||
j = i + 1;
|
||||
index = token.indexOf('"', j) + 1;
|
||||
if (!index) {
|
||||
throw '" is missing';
|
||||
}
|
||||
buffer += token.slice(i, index);
|
||||
i = index - 1;
|
||||
if (state == 'before-value') {
|
||||
state = 'value';
|
||||
}
|
||||
break;
|
||||
|
||||
case "'":
|
||||
j = i + 1;
|
||||
index = token.indexOf("'", j) + 1;
|
||||
if (!index) {
|
||||
throw "' is missing";
|
||||
}
|
||||
buffer += token.slice(i, index);
|
||||
i = index - 1;
|
||||
switch (state) {
|
||||
case 'before-value':
|
||||
state = 'value';
|
||||
break;
|
||||
case 'importRule-begin':
|
||||
state = 'importRule';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
// Comment
|
||||
case "/":
|
||||
if (token.charAt(i + 1) == "*") {
|
||||
i += 2;
|
||||
index = token.indexOf("*/", i);
|
||||
if (index == -1) {
|
||||
throw SyntaxError("Missing */");
|
||||
} else {
|
||||
i = index + 1;
|
||||
}
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
if (state == "importRule-begin") {
|
||||
buffer += " ";
|
||||
state = "importRule";
|
||||
}
|
||||
break;
|
||||
|
||||
// At-rule
|
||||
case "@":
|
||||
if (token.indexOf("@media", i) == i) {
|
||||
state = "atBlock";
|
||||
mediaRule = new CSSOM.CSSMediaRule;
|
||||
mediaRule.__starts = i;
|
||||
i += "media".length;
|
||||
buffer = "";
|
||||
break;
|
||||
} else if (token.indexOf("@import", i) == i) {
|
||||
state = "importRule-begin";
|
||||
i += "import".length;
|
||||
buffer += "@import";
|
||||
break;
|
||||
} else if (state == "selector") {
|
||||
state = "atRule";
|
||||
}
|
||||
buffer += character;
|
||||
break;
|
||||
|
||||
case "{":
|
||||
if (state == "selector" || state == "atRule") {
|
||||
this.selectorEnd(i, buffer);
|
||||
buffer = "";
|
||||
state = "before-name";
|
||||
} else if (state == "atBlock") {
|
||||
mediaRule.media.mediaText = buffer.trim();
|
||||
currentScope = mediaRule;
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
}
|
||||
break;
|
||||
|
||||
case ":":
|
||||
if (state == "name") {
|
||||
name = buffer;
|
||||
buffer = "";
|
||||
state = "before-value";
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case '(':
|
||||
if (state == 'value') {
|
||||
index = token.indexOf(')', i + 1);
|
||||
if (index == -1) {
|
||||
throw i + ': unclosed "("';
|
||||
}
|
||||
buffer += token.slice(i, index + 1);
|
||||
i = index;
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case "!":
|
||||
if (state == "value" && token.indexOf("!important", i) === i) {
|
||||
priority = "important";
|
||||
i += "important".length;
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case ";":
|
||||
switch (state) {
|
||||
case "value":
|
||||
this.declarationEnd(i, name, buffer, priority);
|
||||
priority = "";
|
||||
buffer = "";
|
||||
state = "before-name";
|
||||
break;
|
||||
case "atRule":
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
break;
|
||||
case "importRule":
|
||||
importRule = new CSSOM.CSSImportRule;
|
||||
importRule.cssText = buffer + character;
|
||||
currentScope.cssRules.push(importRule);
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
break;
|
||||
default:
|
||||
buffer += character;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "}":
|
||||
switch (state) {
|
||||
case "value":
|
||||
this.declarationEnd(i, name, buffer, priority);
|
||||
// fall down
|
||||
case "before-name":
|
||||
this.styleRuleEnd(i);
|
||||
buffer = "";
|
||||
break;
|
||||
case "name":
|
||||
throw i + ": Oops";
|
||||
break;
|
||||
case "before-selector":
|
||||
case "selector":
|
||||
// End of media rule.
|
||||
// Nesting rules aren't supported yet
|
||||
if (!mediaRule) {
|
||||
throw "unexpected }";
|
||||
}
|
||||
mediaRule.__ends = i + 1;
|
||||
styleSheet.cssRules.push(mediaRule);
|
||||
currentScope = styleSheet;
|
||||
buffer = "";
|
||||
break;
|
||||
}
|
||||
state = "before-selector";
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (state) {
|
||||
case "before-selector":
|
||||
this.styleRuleStart(i);
|
||||
state = "selector";
|
||||
break;
|
||||
case "before-name":
|
||||
state = "name";
|
||||
break;
|
||||
case "before-value":
|
||||
state = "value";
|
||||
break;
|
||||
case "importRule-begin":
|
||||
state = "importRule";
|
||||
break;
|
||||
}
|
||||
buffer += character;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return styleSheet;
|
||||
};
|
||||
|
||||
CSSOM.Parser.prototype.compile = function() {
|
||||
var handlers = {
|
||||
styleSheetStart: this.styleSheetStart,
|
||||
styleRuleStart: this.styleRuleStart,
|
||||
selectorEnd: this.selectorEnd,
|
||||
declarationEnd: this.declarationEnd,
|
||||
styleRuleEnd: this.styleRuleEnd,
|
||||
styleSheetEnd: this.styleSheetEnd
|
||||
};
|
||||
var parser = this.parse.toString();
|
||||
for (var key in handlers) {
|
||||
if (!handlers.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
parser = parser.replace(new RegExp('^.*' + key + '.*$', 'gm'), handlers[key].toString()
|
||||
.replace(/^function.+$/m, '')
|
||||
.replace(/^}/m, ''))
|
||||
.replace(/this\.?/g, '');
|
||||
}
|
||||
return parser;
|
||||
};
|
||||
|
||||
CSSOM.Parser.prototype.styleSheetStart = function(i) {
|
||||
console.log('styleSheetStart', i);
|
||||
this.styleSheet = new CSSOM.CSSStyleSheet;
|
||||
this.scopeRules = this.styleSheet.cssRules;
|
||||
};
|
||||
|
||||
CSSOM.Parser.prototype.styleRuleStart = function(i) {
|
||||
console.log('styleRuleStart', i);
|
||||
this.styleRule = new CSSOM.CSSStyleRule;
|
||||
this.styleRule._start = i;
|
||||
};
|
||||
|
||||
CSSOM.Parser.prototype.selectorEnd = function(i, buffer) {
|
||||
this.styleRule.selectorText = buffer.trimRight();
|
||||
this.styleRule.style._start = i;
|
||||
};
|
||||
|
||||
CSSOM.Parser.prototype.declarationEnd = function(name, value, priority, startIndex, endIndex) {
|
||||
console.log('declarationEnd', name, value, priority, startIndex, endIndex);
|
||||
};
|
||||
|
||||
CSSOM.Parser.prototype.styleRuleEnd = function(i) {
|
||||
this.styleRule._end = i;
|
||||
this.scopeRules.push(this.styleRule);
|
||||
};
|
||||
|
||||
|
||||
CSSOM.Parser.prototype.styleSheetEnd = function(i) {
|
||||
return this.styleSheet;
|
||||
};
|
||||
|
||||
/*
|
||||
Parser.prototype.nameStart = function(i) {
|
||||
this.nameStartIndex = i;
|
||||
};
|
||||
|
||||
Parser.prototype.nameEnd = function(i, buffer) {
|
||||
this.name = buffer.trimRight();
|
||||
this.nameEndIndex = this.nameStartIndex + this.name.length;
|
||||
};
|
||||
|
||||
|
||||
Parser.prototype.valueStart = function(i) {
|
||||
this.valueStartIndex = i;
|
||||
};
|
||||
|
||||
Parser.prototype.valueEnd = function(i, buffer) {
|
||||
var value = buffer.trimRight();
|
||||
this.styleRule.style.add(this.name, value, this.nameStartIndex, this.nameEndIndex, this.valueStartIndex, this.valueStartIndex + value.length);
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.Parser = CSSOM.Parser;
|
||||
///CommonJS
|
76
node_modules/cssom/lib/snapshot.js
generated
vendored
76
node_modules/cssom/lib/snapshot.js
generated
vendored
@@ -1,76 +0,0 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet,
|
||||
CSSStyleRule: require("./CSSStyleRule").CSSStyleRule,
|
||||
CSSMediaRule: require("./CSSMediaRule").CSSMediaRule,
|
||||
CSSStyleDeclaration: require("./CSSStyleDeclaration").CSSStyleDeclaration,
|
||||
CSSKeyframeRule: require('./CSSKeyframeRule').CSSKeyframeRule,
|
||||
CSSKeyframesRule: require('./CSSKeyframesRule').CSSKeyframesRule
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* Produces a deep copy of stylesheet — the instance variables of stylesheet are copied recursively.
|
||||
* @param {CSSStyleSheet|CSSOM.CSSStyleSheet} stylesheet
|
||||
* @nosideeffects
|
||||
* @return {CSSOM.CSSStyleSheet}
|
||||
*/
|
||||
CSSOM.snapshot = function clone(stylesheet) {
|
||||
|
||||
var cloned = new CSSOM.CSSStyleSheet;
|
||||
|
||||
var rules = stylesheet.cssRules;
|
||||
if (!rules) {
|
||||
return cloned;
|
||||
}
|
||||
|
||||
var RULE_TYPES = {
|
||||
1: CSSOM.CSSStyleRule,
|
||||
4: CSSOM.CSSMediaRule,
|
||||
//3: CSSOM.CSSImportRule,
|
||||
//5: CSSOM.CSSFontFaceRule,
|
||||
//6: CSSOM.CSSPageRule,
|
||||
8: CSSOM.CSSKeyframesRule,
|
||||
9: CSSOM.CSSKeyframeRule
|
||||
};
|
||||
|
||||
for (var i=0, rulesLength=rules.length; i < rulesLength; i++) {
|
||||
var rule = rules[i];
|
||||
var ruleClone = cloned.cssRules[i] = new RULE_TYPES[rule.type];
|
||||
|
||||
var style = rule.style;
|
||||
if (style) {
|
||||
var styleClone = ruleClone.style = new CSSOM.CSSStyleDeclaration;
|
||||
for (var j=0, styleLength=style.length; j < styleLength; j++) {
|
||||
var name = styleClone[j] = style[j];
|
||||
styleClone[name] = style[name];
|
||||
styleClone._importants[name] = style.getPropertyPriority(name);
|
||||
}
|
||||
styleClone.length = style.length;
|
||||
}
|
||||
|
||||
if ("keyText" in rule) {
|
||||
ruleClone.keyText = rule.keyText;
|
||||
}
|
||||
|
||||
if ("selectorText" in rule) {
|
||||
ruleClone.selectorText = rule.selectorText;
|
||||
}
|
||||
|
||||
if ("mediaText" in rule) {
|
||||
ruleClone.mediaText = rule.mediaText;
|
||||
}
|
||||
|
||||
if ("cssRules" in rule) {
|
||||
rule.cssRules = clone(rule).cssRules;
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
|
||||
};
|
||||
|
||||
//.CommonJS
|
||||
exports.clone = CSSOM.clone;
|
||||
///CommonJS
|
18
node_modules/cssom/package.json
generated
vendored
18
node_modules/cssom/package.json
generated
vendored
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"_from": "cssom@^0.3.4",
|
||||
"_id": "cssom@0.3.6",
|
||||
"_id": "cssom@0.3.8",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-DtUeseGk9/GBW0hl0vVPpU22iHL6YB5BUX7ml1hB+GMpo0NX5G4voX3kdWiMSEguFtcW3Vh3djqNF4aIe6ne0A==",
|
||||
"_integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==",
|
||||
"_location": "/cssom",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
@@ -19,10 +19,10 @@
|
||||
"/cssstyle",
|
||||
"/jsdom"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.6.tgz",
|
||||
"_shasum": "f85206cee04efa841f3c5982a74ba96ab20d65ad",
|
||||
"_resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz",
|
||||
"_shasum": "9f1276f5b2b463f2114d3f2c75250af8c1a36f4a",
|
||||
"_spec": "cssom@^0.3.4",
|
||||
"_where": "F:\\projects\\vanillajs-seed\\node_modules\\jsdom",
|
||||
"_where": "/home/s2/Code/vanillajs-seed/node_modules/jsdom",
|
||||
"author": {
|
||||
"name": "Nikita Vasilyev",
|
||||
"email": "me@elv1s.ru"
|
||||
@@ -33,9 +33,6 @@
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "CSS Object Model implementation and CSS parser",
|
||||
"devDependencies": {
|
||||
"jake": "~0.7.3"
|
||||
},
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
@@ -53,8 +50,5 @@
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/NV/CSSOM.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "jake lib/index.js"
|
||||
},
|
||||
"version": "0.3.6"
|
||||
"version": "0.3.8"
|
||||
}
|
||||
|
Reference in New Issue
Block a user