mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 04:10:04 +02:00
update modules
This commit is contained in:
3
node_modules/cssstyle/.eslintignore
generated
vendored
3
node_modules/cssstyle/.eslintignore
generated
vendored
@@ -1,3 +0,0 @@
|
||||
node_modules
|
||||
lib/implementedProperties.js
|
||||
lib/properties.js
|
50
node_modules/cssstyle/.eslintrc.js
generated
vendored
50
node_modules/cssstyle/.eslintrc.js
generated
vendored
@@ -1,50 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['eslint:recommended', 'prettier'],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
},
|
||||
env: {
|
||||
es6: true,
|
||||
},
|
||||
globals: {
|
||||
exports: true,
|
||||
module: true,
|
||||
require: true,
|
||||
window: true,
|
||||
},
|
||||
plugins: ['prettier'],
|
||||
rules: {
|
||||
'prettier/prettier': [
|
||||
'warn',
|
||||
{
|
||||
printWidth: 100,
|
||||
singleQuote: true,
|
||||
trailingComma: 'es5',
|
||||
},
|
||||
],
|
||||
strict: ['warn', 'global'],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['lib/implementedProperties.js', 'lib/properties.js'],
|
||||
rules: {
|
||||
'prettier/prettier': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: 'scripts/**/*',
|
||||
rules: {
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['scripts/**/*', 'tests/**/*'],
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
15
node_modules/cssstyle/.travis.yml
generated
vendored
15
node_modules/cssstyle/.travis.yml
generated
vendored
@@ -1,15 +0,0 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
notifications:
|
||||
email: true
|
||||
node_js:
|
||||
- 6
|
||||
- 8
|
||||
- 10
|
||||
- 11
|
||||
|
||||
script:
|
||||
- npm run test-ci
|
0
node_modules/cssstyle/MIT-LICENSE.txt → node_modules/cssstyle/LICENSE
generated
vendored
0
node_modules/cssstyle/MIT-LICENSE.txt → node_modules/cssstyle/LICENSE
generated
vendored
26
node_modules/cssstyle/README.md
generated
vendored
26
node_modules/cssstyle/README.md
generated
vendored
@@ -1,27 +1,15 @@
|
||||
# CSSStyleDeclaration
|
||||
|
||||
[](https://www.npmjs.com/package/cssstyle) [](https://travis-ci.org/jsakas/CSSStyleDeclaration)
|
||||
A Node JS implementation of the CSS Object Model [CSSStyleDeclaration interface](https://www.w3.org/TR/cssom-1/#the-cssstyledeclaration-interface).
|
||||
|
||||
CSSStyleDeclaration is a work-a-like to the CSSStyleDeclaration class in Nikita Vasilyev's [CSSOM](https://github.com/NV/CSSOM). I made it so that when using [jQuery in node](https://github.com/tmtk75/node-jquery) setting css attributes via $.fn.css() would work. node-jquery uses [jsdom](https://github.com/tmpvar/jsdom) to create a DOM to use in node. jsdom uses CSSOM for styling, and CSSOM's implementation of the [CSSStyleDeclaration](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration) doesn't support [CSS2Properties](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties), which is how jQuery's [$.fn.css()](http://api.jquery.com/css/) operates.
|
||||
[](https://www.npmjs.com/package/cssstyle) [](https://travis-ci.org/jsdom/cssstyle) [](https://codecov.io/gh/jsdom/cssstyle)
|
||||
|
||||
### Why not just issue a pull request?
|
||||
---
|
||||
|
||||
Well, NV wants to keep CSSOM fast (which I can appreciate) and CSS2Properties aren't required by the standard (though every browser has the interface). So I figured the path of least resistance would be to just modify this one class, publish it as a node module (that requires CSSOM) and then make a pull request of jsdom to use it.
|
||||
#### Background
|
||||
|
||||
### How do I test this code?
|
||||
This package is an extension of the CSSStyleDeclaration class in Nikita Vasilyev's [CSSOM](https://github.com/NV/CSSOM) with added support for CSS 2 & 3 properties. The primary use case is for testing browser code in a Node environment.
|
||||
|
||||
`npm test` should do the trick, assuming you have the dev dependencies installed:
|
||||
It was originally created by Chad Walker, it is now maintaind by Jon Sakas and other open source contributors.
|
||||
|
||||
```
|
||||
$ npm test
|
||||
|
||||
tests
|
||||
✔ Verify Has Properties
|
||||
✔ Verify Has Functions
|
||||
✔ Verify Has Special Properties
|
||||
✔ Test From Style String
|
||||
✔ Test From Properties
|
||||
✔ Test Shorthand Properties
|
||||
✔ Test width and height Properties and null and empty strings
|
||||
✔ Test Implicit Properties
|
||||
```
|
||||
Bug reports and pull requests are welcome.
|
||||
|
5
node_modules/cssstyle/lib/CSSStyleDeclaration.js
generated
vendored
5
node_modules/cssstyle/lib/CSSStyleDeclaration.js
generated
vendored
@@ -56,6 +56,11 @@ CSSStyleDeclaration.prototype = {
|
||||
this.removeProperty(name);
|
||||
return;
|
||||
}
|
||||
var isCustomProperty = name.indexOf('--') === 0;
|
||||
if (isCustomProperty) {
|
||||
this._setProperty(name, value, priority);
|
||||
return;
|
||||
}
|
||||
var lowercaseName = name.toLowerCase();
|
||||
if (!allProperties.has(lowercaseName) && !allExtraProperties.has(lowercaseName)) {
|
||||
return;
|
||||
|
556
node_modules/cssstyle/lib/CSSStyleDeclaration.test.js
generated
vendored
Normal file
556
node_modules/cssstyle/lib/CSSStyleDeclaration.test.js
generated
vendored
Normal file
@@ -0,0 +1,556 @@
|
||||
'use strict';
|
||||
|
||||
var { CSSStyleDeclaration } = require('./CSSStyleDeclaration');
|
||||
|
||||
var allProperties = require('./allProperties');
|
||||
var allExtraProperties = require('./allExtraProperties');
|
||||
var implementedProperties = require('./implementedProperties');
|
||||
var parsers = require('./parsers');
|
||||
|
||||
var dashedProperties = [...allProperties, ...allExtraProperties];
|
||||
var allowedProperties = dashedProperties.map(parsers.dashedToCamelCase);
|
||||
implementedProperties = Array.from(implementedProperties).map(parsers.dashedToCamelCase);
|
||||
var invalidProperties = implementedProperties.filter(prop => !allowedProperties.includes(prop));
|
||||
|
||||
describe('CSSStyleDeclaration', () => {
|
||||
test('has only valid properties implemented', () => {
|
||||
expect(invalidProperties.length).toEqual(0);
|
||||
});
|
||||
|
||||
test('has all properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
allProperties.forEach(property => {
|
||||
expect(style.__lookupGetter__(property)).toBeTruthy();
|
||||
expect(style.__lookupSetter__(property)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
test('has dashed properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
dashedProperties.forEach(property => {
|
||||
expect(style.__lookupGetter__(property)).toBeTruthy();
|
||||
expect(style.__lookupSetter__(property)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
test('has all functions', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
|
||||
expect(typeof style.item).toEqual('function');
|
||||
expect(typeof style.getPropertyValue).toEqual('function');
|
||||
expect(typeof style.setProperty).toEqual('function');
|
||||
expect(typeof style.getPropertyPriority).toEqual('function');
|
||||
expect(typeof style.removeProperty).toEqual('function');
|
||||
|
||||
// TODO - deprecated according to MDN and not implemented at all, can we remove?
|
||||
expect(typeof style.getPropertyCSSValue).toEqual('function');
|
||||
});
|
||||
|
||||
test('has special properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
|
||||
expect(style.__lookupGetter__('cssText')).toBeTruthy();
|
||||
expect(style.__lookupSetter__('cssText')).toBeTruthy();
|
||||
expect(style.__lookupGetter__('length')).toBeTruthy();
|
||||
expect(style.__lookupSetter__('length')).toBeTruthy();
|
||||
expect(style.__lookupGetter__('parentRule')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('from style string', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.cssText = 'color: blue; background-color: red; width: 78%; height: 50vh;';
|
||||
expect(style.length).toEqual(4);
|
||||
expect(style.cssText).toEqual('color: blue; background-color: red; width: 78%; height: 50vh;');
|
||||
expect(style.getPropertyValue('color')).toEqual('blue');
|
||||
expect(style.item(0)).toEqual('color');
|
||||
expect(style[1]).toEqual('background-color');
|
||||
expect(style.backgroundColor).toEqual('red');
|
||||
style.cssText = '';
|
||||
expect(style.cssText).toEqual('');
|
||||
expect(style.length).toEqual(0);
|
||||
});
|
||||
|
||||
test('from properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.color = 'blue';
|
||||
expect(style.length).toEqual(1);
|
||||
expect(style[0]).toEqual('color');
|
||||
expect(style.cssText).toEqual('color: blue;');
|
||||
expect(style.item(0)).toEqual('color');
|
||||
expect(style.color).toEqual('blue');
|
||||
style.backgroundColor = 'red';
|
||||
expect(style.length).toEqual(2);
|
||||
expect(style[0]).toEqual('color');
|
||||
expect(style[1]).toEqual('background-color');
|
||||
expect(style.cssText).toEqual('color: blue; background-color: red;');
|
||||
expect(style.backgroundColor).toEqual('red');
|
||||
style.removeProperty('color');
|
||||
expect(style[0]).toEqual('background-color');
|
||||
});
|
||||
|
||||
test('shorthand properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.background = 'blue url(http://www.example.com/some_img.jpg)';
|
||||
expect(style.backgroundColor).toEqual('blue');
|
||||
expect(style.backgroundImage).toEqual('url(http://www.example.com/some_img.jpg)');
|
||||
expect(style.background).toEqual('blue url(http://www.example.com/some_img.jpg)');
|
||||
style.border = '0 solid black';
|
||||
expect(style.borderWidth).toEqual('0px');
|
||||
expect(style.borderStyle).toEqual('solid');
|
||||
expect(style.borderColor).toEqual('black');
|
||||
expect(style.borderTopWidth).toEqual('0px');
|
||||
expect(style.borderLeftStyle).toEqual('solid');
|
||||
expect(style.borderBottomColor).toEqual('black');
|
||||
style.font = '12em monospace';
|
||||
expect(style.fontSize).toEqual('12em');
|
||||
expect(style.fontFamily).toEqual('monospace');
|
||||
});
|
||||
|
||||
test('width and height properties and null and empty strings', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.height = 6;
|
||||
expect(style.height).toEqual('');
|
||||
style.width = 0;
|
||||
expect(style.width).toEqual('0px');
|
||||
style.height = '34%';
|
||||
expect(style.height).toEqual('34%');
|
||||
style.height = '100vh';
|
||||
expect(style.height).toEqual('100vh');
|
||||
style.height = '100vw';
|
||||
expect(style.height).toEqual('100vw');
|
||||
style.height = '';
|
||||
expect(1).toEqual(style.length);
|
||||
expect(style.cssText).toEqual('width: 0px;');
|
||||
style.width = null;
|
||||
expect(0).toEqual(style.length);
|
||||
expect(style.cssText).toEqual('');
|
||||
});
|
||||
|
||||
test('implicit properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.borderWidth = 0;
|
||||
expect(style.length).toEqual(1);
|
||||
expect(style.borderWidth).toEqual('0px');
|
||||
expect(style.borderTopWidth).toEqual('0px');
|
||||
expect(style.borderBottomWidth).toEqual('0px');
|
||||
expect(style.borderLeftWidth).toEqual('0px');
|
||||
expect(style.borderRightWidth).toEqual('0px');
|
||||
expect(style.cssText).toEqual('border-width: 0px;');
|
||||
});
|
||||
|
||||
test('top, left, right, bottom properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.top = 0;
|
||||
style.left = '0%';
|
||||
style.right = '5em';
|
||||
style.bottom = '12pt';
|
||||
expect(style.top).toEqual('0px');
|
||||
expect(style.left).toEqual('0%');
|
||||
expect(style.right).toEqual('5em');
|
||||
expect(style.bottom).toEqual('12pt');
|
||||
expect(style.length).toEqual(4);
|
||||
expect(style.cssText).toEqual('top: 0px; left: 0%; right: 5em; bottom: 12pt;');
|
||||
});
|
||||
|
||||
test('clear and clip properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.clear = 'none';
|
||||
expect(style.clear).toEqual('none');
|
||||
style.clear = 'lfet';
|
||||
expect(style.clear).toEqual('none');
|
||||
style.clear = 'left';
|
||||
expect(style.clear).toEqual('left');
|
||||
style.clear = 'right';
|
||||
expect(style.clear).toEqual('right');
|
||||
style.clear = 'both';
|
||||
expect(style.clear).toEqual('both');
|
||||
style.clip = 'elipse(5px, 10px)';
|
||||
expect(style.clip).toEqual('');
|
||||
expect(style.length).toEqual(1);
|
||||
style.clip = 'rect(0, 3Em, 2pt, 50%)';
|
||||
expect(style.clip).toEqual('rect(0px, 3em, 2pt, 50%)');
|
||||
expect(style.length).toEqual(2);
|
||||
expect(style.cssText).toEqual('clear: both; clip: rect(0px, 3em, 2pt, 50%);');
|
||||
});
|
||||
|
||||
test('colors', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.color = 'rgba(0,0,0,0)';
|
||||
expect(style.color).toEqual('rgba(0, 0, 0, 0)');
|
||||
style.color = 'rgba(5%, 10%, 20%, 0.4)';
|
||||
expect(style.color).toEqual('rgba(12, 25, 51, 0.4)');
|
||||
style.color = 'rgb(33%, 34%, 33%)';
|
||||
expect(style.color).toEqual('rgb(84, 86, 84)');
|
||||
style.color = 'rgba(300, 200, 100, 1.5)';
|
||||
expect(style.color).toEqual('rgb(255, 200, 100)');
|
||||
style.color = 'hsla(0, 1%, 2%, 0.5)';
|
||||
expect(style.color).toEqual('rgba(5, 5, 5, 0.5)');
|
||||
style.color = 'hsl(0, 1%, 2%)';
|
||||
expect(style.color).toEqual('rgb(5, 5, 5)');
|
||||
style.color = 'rebeccapurple';
|
||||
expect(style.color).toEqual('rebeccapurple');
|
||||
style.color = 'transparent';
|
||||
expect(style.color).toEqual('transparent');
|
||||
style.color = 'currentcolor';
|
||||
expect(style.color).toEqual('currentcolor');
|
||||
style.color = '#ffffffff';
|
||||
expect(style.color).toEqual('rgba(255, 255, 255, 1)');
|
||||
style.color = '#fffa';
|
||||
expect(style.color).toEqual('rgba(255, 255, 255, 0.667)');
|
||||
style.color = '#ffffff66';
|
||||
expect(style.color).toEqual('rgba(255, 255, 255, 0.4)');
|
||||
});
|
||||
|
||||
test('short hand properties with embedded spaces', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.background = 'rgb(0, 0, 0) url(/something/somewhere.jpg)';
|
||||
expect(style.backgroundColor).toEqual('rgb(0, 0, 0)');
|
||||
expect(style.backgroundImage).toEqual('url(/something/somewhere.jpg)');
|
||||
expect(style.cssText).toEqual('background: rgb(0, 0, 0) url(/something/somewhere.jpg);');
|
||||
style = new CSSStyleDeclaration();
|
||||
style.border = ' 1px solid black ';
|
||||
expect(style.border).toEqual('1px solid black');
|
||||
});
|
||||
|
||||
test('setting shorthand properties to an empty string should clear all dependent properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.borderWidth = '1px';
|
||||
expect(style.cssText).toEqual('border-width: 1px;');
|
||||
style.border = '';
|
||||
expect(style.cssText).toEqual('');
|
||||
});
|
||||
|
||||
test('setting implicit properties to an empty string should clear all dependent properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.borderTopWidth = '1px';
|
||||
expect(style.cssText).toEqual('border-top-width: 1px;');
|
||||
style.borderWidth = '';
|
||||
expect(style.cssText).toEqual('');
|
||||
});
|
||||
|
||||
test('setting a shorthand property, whose shorthands are implicit properties, to an empty string should clear all dependent properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.borderTopWidth = '1px';
|
||||
expect(style.cssText).toEqual('border-top-width: 1px;');
|
||||
style.border = '';
|
||||
expect(style.cssText).toEqual('');
|
||||
style.borderTop = '1px solid black';
|
||||
expect(style.cssText).toEqual('border-top: 1px solid black;');
|
||||
style.border = '';
|
||||
expect(style.cssText).toEqual('');
|
||||
});
|
||||
|
||||
test('setting border values to "none" should clear dependent values', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.borderTopWidth = '1px';
|
||||
expect(style.cssText).toEqual('border-top-width: 1px;');
|
||||
style.border = 'none';
|
||||
expect(style.cssText).toEqual('');
|
||||
style.borderTopWidth = '1px';
|
||||
expect(style.cssText).toEqual('border-top-width: 1px;');
|
||||
style.borderTopStyle = 'none';
|
||||
expect(style.cssText).toEqual('');
|
||||
style.borderTopWidth = '1px';
|
||||
expect(style.cssText).toEqual('border-top-width: 1px;');
|
||||
style.borderTop = 'none';
|
||||
expect(style.cssText).toEqual('');
|
||||
style.borderTopWidth = '1px';
|
||||
style.borderLeftWidth = '1px';
|
||||
expect(style.cssText).toEqual('border-top-width: 1px; border-left-width: 1px;');
|
||||
style.borderTop = 'none';
|
||||
expect(style.cssText).toEqual('border-left-width: 1px;');
|
||||
});
|
||||
|
||||
test('setting border to 0 should be okay', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.border = 0;
|
||||
expect(style.cssText).toEqual('border: 0px;');
|
||||
});
|
||||
|
||||
test('setting values implicit and shorthand properties via csstext and setproperty should propagate to dependent properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.cssText = 'border: 1px solid black;';
|
||||
expect(style.cssText).toEqual('border: 1px solid black;');
|
||||
expect(style.borderTop).toEqual('1px solid black');
|
||||
style.border = '';
|
||||
expect(style.cssText).toEqual('');
|
||||
style.setProperty('border', '1px solid black');
|
||||
expect(style.cssText).toEqual('border: 1px solid black;');
|
||||
});
|
||||
|
||||
test('setting opacity should work', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.setProperty('opacity', 0.75);
|
||||
expect(style.cssText).toEqual('opacity: 0.75;');
|
||||
style.opacity = '0.50';
|
||||
expect(style.cssText).toEqual('opacity: 0.5;');
|
||||
style.opacity = 1;
|
||||
expect(style.cssText).toEqual('opacity: 1;');
|
||||
});
|
||||
|
||||
test('width and height of auto should work', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.width = 'auto';
|
||||
expect(style.cssText).toEqual('width: auto;');
|
||||
expect(style.width).toEqual('auto');
|
||||
style = new CSSStyleDeclaration();
|
||||
style.height = 'auto';
|
||||
expect(style.cssText).toEqual('height: auto;');
|
||||
expect(style.height).toEqual('auto');
|
||||
});
|
||||
|
||||
test('padding and margin should set/clear shorthand properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
var parts = ['Top', 'Right', 'Bottom', 'Left'];
|
||||
var testParts = function(name, v, V) {
|
||||
style[name] = v;
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var part = name + parts[i];
|
||||
expect(style[part]).toEqual(V[i]);
|
||||
}
|
||||
|
||||
expect(style[name]).toEqual(v);
|
||||
style[name] = '';
|
||||
};
|
||||
testParts('padding', '1px', ['1px', '1px', '1px', '1px']);
|
||||
testParts('padding', '1px 2%', ['1px', '2%', '1px', '2%']);
|
||||
testParts('padding', '1px 2px 3px', ['1px', '2px', '3px', '2px']);
|
||||
testParts('padding', '1px 2px 3px 4px', ['1px', '2px', '3px', '4px']);
|
||||
style.paddingTop = style.paddingRight = style.paddingBottom = style.paddingLeft = '1px';
|
||||
testParts('padding', '', ['', '', '', '']);
|
||||
testParts('margin', '1px', ['1px', '1px', '1px', '1px']);
|
||||
testParts('margin', '1px auto', ['1px', 'auto', '1px', 'auto']);
|
||||
testParts('margin', '1px 2% 3px', ['1px', '2%', '3px', '2%']);
|
||||
testParts('margin', '1px 2px 3px 4px', ['1px', '2px', '3px', '4px']);
|
||||
style.marginTop = style.marginRight = style.marginBottom = style.marginLeft = '1px';
|
||||
testParts('margin', '', ['', '', '', '']);
|
||||
});
|
||||
|
||||
test('padding and margin shorthands should set main properties', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
var parts = ['Top', 'Right', 'Bottom', 'Left'];
|
||||
var testParts = function(name, v, V) {
|
||||
var expected;
|
||||
for (var i = 0; i < 4; i++) {
|
||||
style[name] = v;
|
||||
style[name + parts[i]] = V;
|
||||
expected = v.split(/ /);
|
||||
expected[i] = V;
|
||||
expected = expected.join(' ');
|
||||
|
||||
expect(style[name]).toEqual(expected);
|
||||
}
|
||||
};
|
||||
testParts('padding', '1px 2px 3px 4px', '10px');
|
||||
testParts('margin', '1px 2px 3px 4px', '10px');
|
||||
testParts('margin', '1px 2px 3px 4px', 'auto');
|
||||
});
|
||||
|
||||
test('setting a value to 0 should return the string value', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.setProperty('fill-opacity', 0);
|
||||
expect(style.fillOpacity).toEqual('0');
|
||||
});
|
||||
|
||||
test('onchange callback should be called when the csstext changes', () => {
|
||||
var style = new CSSStyleDeclaration(function(cssText) {
|
||||
expect(cssText).toEqual('opacity: 0;');
|
||||
});
|
||||
style.setProperty('opacity', 0);
|
||||
});
|
||||
|
||||
test('setting float should work the same as cssfloat', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.float = 'left';
|
||||
expect(style.cssFloat).toEqual('left');
|
||||
});
|
||||
|
||||
test('setting improper css to csstext should not throw', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.cssText = 'color: ';
|
||||
expect(style.cssText).toEqual('');
|
||||
style.color = 'black';
|
||||
style.cssText = 'float: ';
|
||||
expect(style.cssText).toEqual('');
|
||||
});
|
||||
|
||||
test('url parsing works with quotes', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.backgroundImage = 'url(http://some/url/here1.png)';
|
||||
expect(style.backgroundImage).toEqual('url(http://some/url/here1.png)');
|
||||
style.backgroundImage = "url('http://some/url/here2.png')";
|
||||
expect(style.backgroundImage).toEqual('url(http://some/url/here2.png)');
|
||||
style.backgroundImage = 'url("http://some/url/here3.png")';
|
||||
expect(style.backgroundImage).toEqual('url(http://some/url/here3.png)');
|
||||
});
|
||||
|
||||
test('setting 0 to a padding or margin works', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.padding = 0;
|
||||
expect(style.cssText).toEqual('padding: 0px;');
|
||||
style.margin = '1em';
|
||||
style.marginTop = '0';
|
||||
expect(style.marginTop).toEqual('0px');
|
||||
});
|
||||
|
||||
test('setting ex units to a padding or margin works', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.padding = '1ex';
|
||||
expect(style.cssText).toEqual('padding: 1ex;');
|
||||
style.margin = '1em';
|
||||
style.marginTop = '0.5ex';
|
||||
expect(style.marginTop).toEqual('0.5ex');
|
||||
});
|
||||
|
||||
test('setting null to background works', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.background = 'red';
|
||||
expect(style.cssText).toEqual('background: red;');
|
||||
style.background = null;
|
||||
expect(style.cssText).toEqual('');
|
||||
});
|
||||
|
||||
test('flex properties should keep their values', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.flexDirection = 'column';
|
||||
expect(style.cssText).toEqual('flex-direction: column;');
|
||||
style.flexDirection = 'row';
|
||||
expect(style.cssText).toEqual('flex-direction: row;');
|
||||
});
|
||||
|
||||
test('camelcase properties are not assigned with `.setproperty()`', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.setProperty('fontSize', '12px');
|
||||
expect(style.cssText).toEqual('');
|
||||
});
|
||||
|
||||
test('casing is ignored in `.setproperty()`', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.setProperty('FoNt-SiZe', '12px');
|
||||
expect(style.fontSize).toEqual('12px');
|
||||
expect(style.getPropertyValue('font-size')).toEqual('12px');
|
||||
});
|
||||
|
||||
test('support non string entries in border-spacing', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.borderSpacing = 0;
|
||||
expect(style.cssText).toEqual('border-spacing: 0px;');
|
||||
});
|
||||
|
||||
test('float should be valid property for `.setproperty()`', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.setProperty('float', 'left');
|
||||
expect(style.float).toEqual('left');
|
||||
expect(style.getPropertyValue('float')).toEqual('left');
|
||||
});
|
||||
|
||||
test('flex-shrink works', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.setProperty('flex-shrink', 0);
|
||||
expect(style.getPropertyValue('flex-shrink')).toEqual('0');
|
||||
style.setProperty('flex-shrink', 1);
|
||||
expect(style.getPropertyValue('flex-shrink')).toEqual('1');
|
||||
expect(style.cssText).toEqual('flex-shrink: 1;');
|
||||
});
|
||||
|
||||
test('flex-grow works', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.setProperty('flex-grow', 2);
|
||||
expect(style.getPropertyValue('flex-grow')).toEqual('2');
|
||||
expect(style.cssText).toEqual('flex-grow: 2;');
|
||||
});
|
||||
|
||||
test('flex-basis works', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.setProperty('flex-basis', 0);
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('0px');
|
||||
style.setProperty('flex-basis', '250px');
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('250px');
|
||||
style.setProperty('flex-basis', '10em');
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('10em');
|
||||
style.setProperty('flex-basis', '30%');
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('30%');
|
||||
expect(style.cssText).toEqual('flex-basis: 30%;');
|
||||
});
|
||||
|
||||
test('shorthand flex works', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
style.setProperty('flex', 'none');
|
||||
expect(style.getPropertyValue('flex-grow')).toEqual('0');
|
||||
expect(style.getPropertyValue('flex-shrink')).toEqual('0');
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('auto');
|
||||
style.removeProperty('flex');
|
||||
style.removeProperty('flex-basis');
|
||||
style.setProperty('flex', 'auto');
|
||||
expect(style.getPropertyValue('flex-grow')).toEqual('');
|
||||
expect(style.getPropertyValue('flex-shrink')).toEqual('');
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('auto');
|
||||
style.removeProperty('flex');
|
||||
style.setProperty('flex', '0 1 250px');
|
||||
expect(style.getPropertyValue('flex')).toEqual('0 1 250px');
|
||||
expect(style.getPropertyValue('flex-grow')).toEqual('0');
|
||||
expect(style.getPropertyValue('flex-shrink')).toEqual('1');
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('250px');
|
||||
style.removeProperty('flex');
|
||||
style.setProperty('flex', '2');
|
||||
expect(style.getPropertyValue('flex-grow')).toEqual('2');
|
||||
expect(style.getPropertyValue('flex-shrink')).toEqual('');
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('');
|
||||
style.removeProperty('flex');
|
||||
style.setProperty('flex', '20%');
|
||||
expect(style.getPropertyValue('flex-grow')).toEqual('');
|
||||
expect(style.getPropertyValue('flex-shrink')).toEqual('');
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('20%');
|
||||
style.removeProperty('flex');
|
||||
style.setProperty('flex', '2 2');
|
||||
expect(style.getPropertyValue('flex-grow')).toEqual('2');
|
||||
expect(style.getPropertyValue('flex-shrink')).toEqual('2');
|
||||
expect(style.getPropertyValue('flex-basis')).toEqual('');
|
||||
style.removeProperty('flex');
|
||||
});
|
||||
|
||||
test('font-size get a valid value', () => {
|
||||
var style = new CSSStyleDeclaration();
|
||||
const invalidValue = '1r5px';
|
||||
style.cssText = 'font-size: 15px';
|
||||
expect(1).toEqual(style.length);
|
||||
style.cssText = `font-size: ${invalidValue}`;
|
||||
expect(0).toEqual(style.length);
|
||||
expect(undefined).toEqual(style[0]);
|
||||
});
|
||||
|
||||
test('getPropertyValue for custom properties in cssText', () => {
|
||||
const style = new CSSStyleDeclaration();
|
||||
style.cssText = '--foo: red';
|
||||
|
||||
expect(style.getPropertyValue('--foo')).toEqual('red');
|
||||
});
|
||||
|
||||
test('getPropertyValue for custom properties with setProperty', () => {
|
||||
const style = new CSSStyleDeclaration();
|
||||
style.setProperty('--bar', 'blue');
|
||||
|
||||
expect(style.getPropertyValue('--bar')).toEqual('blue');
|
||||
});
|
||||
|
||||
test('getPropertyValue for custom properties with object setter', () => {
|
||||
const style = new CSSStyleDeclaration();
|
||||
style['--baz'] = 'yellow';
|
||||
|
||||
expect(style.getPropertyValue('--baz')).toEqual('');
|
||||
});
|
||||
|
||||
test('custom properties are case-sensitive', () => {
|
||||
const style = new CSSStyleDeclaration();
|
||||
style.cssText = '--fOo: purple';
|
||||
|
||||
expect(style.getPropertyValue('--foo')).toEqual('');
|
||||
expect(style.getPropertyValue('--fOo')).toEqual('purple');
|
||||
});
|
||||
|
||||
test('supports calc', () => {
|
||||
const style = new CSSStyleDeclaration();
|
||||
style.setProperty('width', 'calc(100% - 100px)');
|
||||
expect(style.getPropertyValue('width')).toEqual('calc(100% - 100px)');
|
||||
});
|
||||
});
|
301
node_modules/cssstyle/lib/allExtraProperties.js
generated
vendored
301
node_modules/cssstyle/lib/allExtraProperties.js
generated
vendored
@@ -5,244 +5,63 @@
|
||||
* current specifications or drafts, but are handled by browsers nevertheless.
|
||||
*/
|
||||
|
||||
var allExtraProperties = new Set();
|
||||
module.exports = allExtraProperties;
|
||||
allExtraProperties.add('background-position-x');
|
||||
allExtraProperties.add('background-position-y');
|
||||
allExtraProperties.add('background-repeat-x');
|
||||
allExtraProperties.add('background-repeat-y');
|
||||
allExtraProperties.add('color-interpolation');
|
||||
allExtraProperties.add('color-profile');
|
||||
allExtraProperties.add('color-rendering');
|
||||
allExtraProperties.add('css-float');
|
||||
allExtraProperties.add('enable-background');
|
||||
allExtraProperties.add('fill');
|
||||
allExtraProperties.add('fill-opacity');
|
||||
allExtraProperties.add('fill-rule');
|
||||
allExtraProperties.add('glyph-orientation-horizontal');
|
||||
allExtraProperties.add('image-rendering');
|
||||
allExtraProperties.add('kerning');
|
||||
allExtraProperties.add('marker');
|
||||
allExtraProperties.add('marker-end');
|
||||
allExtraProperties.add('marker-mid');
|
||||
allExtraProperties.add('marker-offset');
|
||||
allExtraProperties.add('marker-start');
|
||||
allExtraProperties.add('marks');
|
||||
allExtraProperties.add('pointer-events');
|
||||
allExtraProperties.add('shape-rendering');
|
||||
allExtraProperties.add('size');
|
||||
allExtraProperties.add('src');
|
||||
allExtraProperties.add('stop-color');
|
||||
allExtraProperties.add('stop-opacity');
|
||||
allExtraProperties.add('stroke');
|
||||
allExtraProperties.add('stroke-dasharray');
|
||||
allExtraProperties.add('stroke-dashoffset');
|
||||
allExtraProperties.add('stroke-linecap');
|
||||
allExtraProperties.add('stroke-linejoin');
|
||||
allExtraProperties.add('stroke-miterlimit');
|
||||
allExtraProperties.add('stroke-opacity');
|
||||
allExtraProperties.add('stroke-width');
|
||||
allExtraProperties.add('text-anchor');
|
||||
allExtraProperties.add('text-line-through');
|
||||
allExtraProperties.add('text-line-through-color');
|
||||
allExtraProperties.add('text-line-through-mode');
|
||||
allExtraProperties.add('text-line-through-style');
|
||||
allExtraProperties.add('text-line-through-width');
|
||||
allExtraProperties.add('text-overline');
|
||||
allExtraProperties.add('text-overline-color');
|
||||
allExtraProperties.add('text-overline-mode');
|
||||
allExtraProperties.add('text-overline-style');
|
||||
allExtraProperties.add('text-overline-width');
|
||||
allExtraProperties.add('text-rendering');
|
||||
allExtraProperties.add('text-underline');
|
||||
allExtraProperties.add('text-underline-color');
|
||||
allExtraProperties.add('text-underline-mode');
|
||||
allExtraProperties.add('text-underline-style');
|
||||
allExtraProperties.add('text-underline-width');
|
||||
allExtraProperties.add('unicode-range');
|
||||
allExtraProperties.add('vector-effect');
|
||||
allExtraProperties.add('webkit-animation');
|
||||
allExtraProperties.add('webkit-animation-delay');
|
||||
allExtraProperties.add('webkit-animation-direction');
|
||||
allExtraProperties.add('webkit-animation-duration');
|
||||
allExtraProperties.add('webkit-animation-fill-mode');
|
||||
allExtraProperties.add('webkit-animation-iteration-count');
|
||||
allExtraProperties.add('webkit-animation-name');
|
||||
allExtraProperties.add('webkit-animation-play-state');
|
||||
allExtraProperties.add('webkit-animation-timing-function');
|
||||
allExtraProperties.add('webkit-appearance');
|
||||
allExtraProperties.add('webkit-aspect-ratio');
|
||||
allExtraProperties.add('webkit-backface-visibility');
|
||||
allExtraProperties.add('webkit-background-clip');
|
||||
allExtraProperties.add('webkit-background-composite');
|
||||
allExtraProperties.add('webkit-background-origin');
|
||||
allExtraProperties.add('webkit-background-size');
|
||||
allExtraProperties.add('webkit-border-after');
|
||||
allExtraProperties.add('webkit-border-after-color');
|
||||
allExtraProperties.add('webkit-border-after-style');
|
||||
allExtraProperties.add('webkit-border-after-width');
|
||||
allExtraProperties.add('webkit-border-before');
|
||||
allExtraProperties.add('webkit-border-before-color');
|
||||
allExtraProperties.add('webkit-border-before-style');
|
||||
allExtraProperties.add('webkit-border-before-width');
|
||||
allExtraProperties.add('webkit-border-end');
|
||||
allExtraProperties.add('webkit-border-end-color');
|
||||
allExtraProperties.add('webkit-border-end-style');
|
||||
allExtraProperties.add('webkit-border-end-width');
|
||||
allExtraProperties.add('webkit-border-fit');
|
||||
allExtraProperties.add('webkit-border-horizontal-spacing');
|
||||
allExtraProperties.add('webkit-border-image');
|
||||
allExtraProperties.add('webkit-border-radius');
|
||||
allExtraProperties.add('webkit-border-start');
|
||||
allExtraProperties.add('webkit-border-start-color');
|
||||
allExtraProperties.add('webkit-border-start-style');
|
||||
allExtraProperties.add('webkit-border-start-width');
|
||||
allExtraProperties.add('webkit-border-vertical-spacing');
|
||||
allExtraProperties.add('webkit-box-align');
|
||||
allExtraProperties.add('webkit-box-direction');
|
||||
allExtraProperties.add('webkit-box-flex');
|
||||
allExtraProperties.add('webkit-box-flex-group');
|
||||
allExtraProperties.add('webkit-box-lines');
|
||||
allExtraProperties.add('webkit-box-ordinal-group');
|
||||
allExtraProperties.add('webkit-box-orient');
|
||||
allExtraProperties.add('webkit-box-pack');
|
||||
allExtraProperties.add('webkit-box-reflect');
|
||||
allExtraProperties.add('webkit-box-shadow');
|
||||
allExtraProperties.add('webkit-color-correction');
|
||||
allExtraProperties.add('webkit-column-axis');
|
||||
allExtraProperties.add('webkit-column-break-after');
|
||||
allExtraProperties.add('webkit-column-break-before');
|
||||
allExtraProperties.add('webkit-column-break-inside');
|
||||
allExtraProperties.add('webkit-column-count');
|
||||
allExtraProperties.add('webkit-column-gap');
|
||||
allExtraProperties.add('webkit-column-rule');
|
||||
allExtraProperties.add('webkit-column-rule-color');
|
||||
allExtraProperties.add('webkit-column-rule-style');
|
||||
allExtraProperties.add('webkit-column-rule-width');
|
||||
allExtraProperties.add('webkit-columns');
|
||||
allExtraProperties.add('webkit-column-span');
|
||||
allExtraProperties.add('webkit-column-width');
|
||||
allExtraProperties.add('webkit-filter');
|
||||
allExtraProperties.add('webkit-flex-align');
|
||||
allExtraProperties.add('webkit-flex-direction');
|
||||
allExtraProperties.add('webkit-flex-flow');
|
||||
allExtraProperties.add('webkit-flex-item-align');
|
||||
allExtraProperties.add('webkit-flex-line-pack');
|
||||
allExtraProperties.add('webkit-flex-order');
|
||||
allExtraProperties.add('webkit-flex-pack');
|
||||
allExtraProperties.add('webkit-flex-wrap');
|
||||
allExtraProperties.add('webkit-flow-from');
|
||||
allExtraProperties.add('webkit-flow-into');
|
||||
allExtraProperties.add('webkit-font-feature-settings');
|
||||
allExtraProperties.add('webkit-font-kerning');
|
||||
allExtraProperties.add('webkit-font-size-delta');
|
||||
allExtraProperties.add('webkit-font-smoothing');
|
||||
allExtraProperties.add('webkit-font-variant-ligatures');
|
||||
allExtraProperties.add('webkit-highlight');
|
||||
allExtraProperties.add('webkit-hyphenate-character');
|
||||
allExtraProperties.add('webkit-hyphenate-limit-after');
|
||||
allExtraProperties.add('webkit-hyphenate-limit-before');
|
||||
allExtraProperties.add('webkit-hyphenate-limit-lines');
|
||||
allExtraProperties.add('webkit-hyphens');
|
||||
allExtraProperties.add('webkit-line-align');
|
||||
allExtraProperties.add('webkit-line-box-contain');
|
||||
allExtraProperties.add('webkit-line-break');
|
||||
allExtraProperties.add('webkit-line-clamp');
|
||||
allExtraProperties.add('webkit-line-grid');
|
||||
allExtraProperties.add('webkit-line-snap');
|
||||
allExtraProperties.add('webkit-locale');
|
||||
allExtraProperties.add('webkit-logical-height');
|
||||
allExtraProperties.add('webkit-logical-width');
|
||||
allExtraProperties.add('webkit-margin-after');
|
||||
allExtraProperties.add('webkit-margin-after-collapse');
|
||||
allExtraProperties.add('webkit-margin-before');
|
||||
allExtraProperties.add('webkit-margin-before-collapse');
|
||||
allExtraProperties.add('webkit-margin-bottom-collapse');
|
||||
allExtraProperties.add('webkit-margin-collapse');
|
||||
allExtraProperties.add('webkit-margin-end');
|
||||
allExtraProperties.add('webkit-margin-start');
|
||||
allExtraProperties.add('webkit-margin-top-collapse');
|
||||
allExtraProperties.add('webkit-marquee');
|
||||
allExtraProperties.add('webkit-marquee-direction');
|
||||
allExtraProperties.add('webkit-marquee-increment');
|
||||
allExtraProperties.add('webkit-marquee-repetition');
|
||||
allExtraProperties.add('webkit-marquee-speed');
|
||||
allExtraProperties.add('webkit-marquee-style');
|
||||
allExtraProperties.add('webkit-mask');
|
||||
allExtraProperties.add('webkit-mask-attachment');
|
||||
allExtraProperties.add('webkit-mask-box-image');
|
||||
allExtraProperties.add('webkit-mask-box-image-outset');
|
||||
allExtraProperties.add('webkit-mask-box-image-repeat');
|
||||
allExtraProperties.add('webkit-mask-box-image-slice');
|
||||
allExtraProperties.add('webkit-mask-box-image-source');
|
||||
allExtraProperties.add('webkit-mask-box-image-width');
|
||||
allExtraProperties.add('webkit-mask-clip');
|
||||
allExtraProperties.add('webkit-mask-composite');
|
||||
allExtraProperties.add('webkit-mask-image');
|
||||
allExtraProperties.add('webkit-mask-origin');
|
||||
allExtraProperties.add('webkit-mask-position');
|
||||
allExtraProperties.add('webkit-mask-position-x');
|
||||
allExtraProperties.add('webkit-mask-position-y');
|
||||
allExtraProperties.add('webkit-mask-repeat');
|
||||
allExtraProperties.add('webkit-mask-repeat-x');
|
||||
allExtraProperties.add('webkit-mask-repeat-y');
|
||||
allExtraProperties.add('webkit-mask-size');
|
||||
allExtraProperties.add('webkit-match-nearest-mail-blockquote-color');
|
||||
allExtraProperties.add('webkit-max-logical-height');
|
||||
allExtraProperties.add('webkit-max-logical-width');
|
||||
allExtraProperties.add('webkit-min-logical-height');
|
||||
allExtraProperties.add('webkit-min-logical-width');
|
||||
allExtraProperties.add('webkit-nbsp-mode');
|
||||
allExtraProperties.add('webkit-overflow-scrolling');
|
||||
allExtraProperties.add('webkit-padding-after');
|
||||
allExtraProperties.add('webkit-padding-before');
|
||||
allExtraProperties.add('webkit-padding-end');
|
||||
allExtraProperties.add('webkit-padding-start');
|
||||
allExtraProperties.add('webkit-perspective');
|
||||
allExtraProperties.add('webkit-perspective-origin');
|
||||
allExtraProperties.add('webkit-perspective-origin-x');
|
||||
allExtraProperties.add('webkit-perspective-origin-y');
|
||||
allExtraProperties.add('webkit-print-color-adjust');
|
||||
allExtraProperties.add('webkit-region-break-after');
|
||||
allExtraProperties.add('webkit-region-break-before');
|
||||
allExtraProperties.add('webkit-region-break-inside');
|
||||
allExtraProperties.add('webkit-region-overflow');
|
||||
allExtraProperties.add('webkit-rtl-ordering');
|
||||
allExtraProperties.add('webkit-svg-shadow');
|
||||
allExtraProperties.add('webkit-tap-highlight-color');
|
||||
allExtraProperties.add('webkit-text-combine');
|
||||
allExtraProperties.add('webkit-text-decorations-in-effect');
|
||||
allExtraProperties.add('webkit-text-emphasis');
|
||||
allExtraProperties.add('webkit-text-emphasis-color');
|
||||
allExtraProperties.add('webkit-text-emphasis-position');
|
||||
allExtraProperties.add('webkit-text-emphasis-style');
|
||||
allExtraProperties.add('webkit-text-fill-color');
|
||||
allExtraProperties.add('webkit-text-orientation');
|
||||
allExtraProperties.add('webkit-text-security');
|
||||
allExtraProperties.add('webkit-text-size-adjust');
|
||||
allExtraProperties.add('webkit-text-stroke');
|
||||
allExtraProperties.add('webkit-text-stroke-color');
|
||||
allExtraProperties.add('webkit-text-stroke-width');
|
||||
allExtraProperties.add('webkit-transform');
|
||||
allExtraProperties.add('webkit-transform-origin');
|
||||
allExtraProperties.add('webkit-transform-origin-x');
|
||||
allExtraProperties.add('webkit-transform-origin-y');
|
||||
allExtraProperties.add('webkit-transform-origin-z');
|
||||
allExtraProperties.add('webkit-transform-style');
|
||||
allExtraProperties.add('webkit-transition');
|
||||
allExtraProperties.add('webkit-transition-delay');
|
||||
allExtraProperties.add('webkit-transition-duration');
|
||||
allExtraProperties.add('webkit-transition-property');
|
||||
allExtraProperties.add('webkit-transition-timing-function');
|
||||
allExtraProperties.add('webkit-user-drag');
|
||||
allExtraProperties.add('webkit-user-modify');
|
||||
allExtraProperties.add('webkit-user-select');
|
||||
allExtraProperties.add('webkit-wrap');
|
||||
allExtraProperties.add('webkit-wrap-flow');
|
||||
allExtraProperties.add('webkit-wrap-margin');
|
||||
allExtraProperties.add('webkit-wrap-padding');
|
||||
allExtraProperties.add('webkit-wrap-shape-inside');
|
||||
allExtraProperties.add('webkit-wrap-shape-outside');
|
||||
allExtraProperties.add('webkit-wrap-through');
|
||||
allExtraProperties.add('webkit-writing-mode');
|
||||
allExtraProperties.add('zoom');
|
||||
var allWebkitProperties = require('./allWebkitProperties');
|
||||
|
||||
module.exports = new Set(
|
||||
[
|
||||
'background-position-x',
|
||||
'background-position-y',
|
||||
'background-repeat-x',
|
||||
'background-repeat-y',
|
||||
'color-interpolation',
|
||||
'color-profile',
|
||||
'color-rendering',
|
||||
'css-float',
|
||||
'enable-background',
|
||||
'fill',
|
||||
'fill-opacity',
|
||||
'fill-rule',
|
||||
'glyph-orientation-horizontal',
|
||||
'image-rendering',
|
||||
'kerning',
|
||||
'marker',
|
||||
'marker-end',
|
||||
'marker-mid',
|
||||
'marker-offset',
|
||||
'marker-start',
|
||||
'marks',
|
||||
'pointer-events',
|
||||
'shape-rendering',
|
||||
'size',
|
||||
'src',
|
||||
'stop-color',
|
||||
'stop-opacity',
|
||||
'stroke',
|
||||
'stroke-dasharray',
|
||||
'stroke-dashoffset',
|
||||
'stroke-linecap',
|
||||
'stroke-linejoin',
|
||||
'stroke-miterlimit',
|
||||
'stroke-opacity',
|
||||
'stroke-width',
|
||||
'text-anchor',
|
||||
'text-line-through',
|
||||
'text-line-through-color',
|
||||
'text-line-through-mode',
|
||||
'text-line-through-style',
|
||||
'text-line-through-width',
|
||||
'text-overline',
|
||||
'text-overline-color',
|
||||
'text-overline-mode',
|
||||
'text-overline-style',
|
||||
'text-overline-width',
|
||||
'text-rendering',
|
||||
'text-underline',
|
||||
'text-underline-color',
|
||||
'text-underline-mode',
|
||||
'text-underline-style',
|
||||
'text-underline-width',
|
||||
'unicode-range',
|
||||
'vector-effect',
|
||||
].concat(allWebkitProperties)
|
||||
);
|
||||
|
903
node_modules/cssstyle/lib/allProperties.js
generated
vendored
903
node_modules/cssstyle/lib/allProperties.js
generated
vendored
@@ -1,457 +1,462 @@
|
||||
'use strict';
|
||||
|
||||
// autogenerated - 2/3/2019
|
||||
// autogenerated - 4/29/2020
|
||||
|
||||
/*
|
||||
*
|
||||
* https://www.w3.org/Style/CSS/all-properties.en.html
|
||||
*/
|
||||
|
||||
var allProperties = new Set();
|
||||
module.exports = allProperties;
|
||||
allProperties.add('align-content');
|
||||
allProperties.add('align-items');
|
||||
allProperties.add('align-self');
|
||||
allProperties.add('alignment-baseline');
|
||||
allProperties.add('all');
|
||||
allProperties.add('animation');
|
||||
allProperties.add('animation-delay');
|
||||
allProperties.add('animation-direction');
|
||||
allProperties.add('animation-duration');
|
||||
allProperties.add('animation-fill-mode');
|
||||
allProperties.add('animation-iteration-count');
|
||||
allProperties.add('animation-name');
|
||||
allProperties.add('animation-play-state');
|
||||
allProperties.add('animation-timing-function');
|
||||
allProperties.add('appearance');
|
||||
allProperties.add('azimuth');
|
||||
allProperties.add('background');
|
||||
allProperties.add('background-attachment');
|
||||
allProperties.add('background-blend-mode');
|
||||
allProperties.add('background-clip');
|
||||
allProperties.add('background-color');
|
||||
allProperties.add('background-image');
|
||||
allProperties.add('background-origin');
|
||||
allProperties.add('background-position');
|
||||
allProperties.add('background-repeat');
|
||||
allProperties.add('background-size');
|
||||
allProperties.add('baseline-shift');
|
||||
allProperties.add('block-overflow');
|
||||
allProperties.add('block-size');
|
||||
allProperties.add('bookmark-label');
|
||||
allProperties.add('bookmark-level');
|
||||
allProperties.add('bookmark-state');
|
||||
allProperties.add('border');
|
||||
allProperties.add('border-block');
|
||||
allProperties.add('border-block-color');
|
||||
allProperties.add('border-block-end');
|
||||
allProperties.add('border-block-end-color');
|
||||
allProperties.add('border-block-end-style');
|
||||
allProperties.add('border-block-end-width');
|
||||
allProperties.add('border-block-start');
|
||||
allProperties.add('border-block-start-color');
|
||||
allProperties.add('border-block-start-style');
|
||||
allProperties.add('border-block-start-width');
|
||||
allProperties.add('border-block-style');
|
||||
allProperties.add('border-block-width');
|
||||
allProperties.add('border-bottom');
|
||||
allProperties.add('border-bottom-color');
|
||||
allProperties.add('border-bottom-left-radius');
|
||||
allProperties.add('border-bottom-right-radius');
|
||||
allProperties.add('border-bottom-style');
|
||||
allProperties.add('border-bottom-width');
|
||||
allProperties.add('border-boundary');
|
||||
allProperties.add('border-collapse');
|
||||
allProperties.add('border-color');
|
||||
allProperties.add('border-end-end-radius');
|
||||
allProperties.add('border-end-start-radius');
|
||||
allProperties.add('border-image');
|
||||
allProperties.add('border-image-outset');
|
||||
allProperties.add('border-image-repeat');
|
||||
allProperties.add('border-image-slice');
|
||||
allProperties.add('border-image-source');
|
||||
allProperties.add('border-image-width');
|
||||
allProperties.add('border-inline');
|
||||
allProperties.add('border-inline-color');
|
||||
allProperties.add('border-inline-end');
|
||||
allProperties.add('border-inline-end-color');
|
||||
allProperties.add('border-inline-end-style');
|
||||
allProperties.add('border-inline-end-width');
|
||||
allProperties.add('border-inline-start');
|
||||
allProperties.add('border-inline-start-color');
|
||||
allProperties.add('border-inline-start-style');
|
||||
allProperties.add('border-inline-start-width');
|
||||
allProperties.add('border-inline-style');
|
||||
allProperties.add('border-inline-width');
|
||||
allProperties.add('border-left');
|
||||
allProperties.add('border-left-color');
|
||||
allProperties.add('border-left-style');
|
||||
allProperties.add('border-left-width');
|
||||
allProperties.add('border-radius');
|
||||
allProperties.add('border-right');
|
||||
allProperties.add('border-right-color');
|
||||
allProperties.add('border-right-style');
|
||||
allProperties.add('border-right-width');
|
||||
allProperties.add('border-spacing');
|
||||
allProperties.add('border-start-end-radius');
|
||||
allProperties.add('border-start-start-radius');
|
||||
allProperties.add('border-style');
|
||||
allProperties.add('border-top');
|
||||
allProperties.add('border-top-color');
|
||||
allProperties.add('border-top-left-radius');
|
||||
allProperties.add('border-top-right-radius');
|
||||
allProperties.add('border-top-style');
|
||||
allProperties.add('border-top-width');
|
||||
allProperties.add('border-width');
|
||||
allProperties.add('bottom');
|
||||
allProperties.add('box-decoration-break');
|
||||
allProperties.add('box-shadow');
|
||||
allProperties.add('box-sizing');
|
||||
allProperties.add('box-snap');
|
||||
allProperties.add('break-after');
|
||||
allProperties.add('break-before');
|
||||
allProperties.add('break-inside');
|
||||
allProperties.add('caption-side');
|
||||
allProperties.add('caret');
|
||||
allProperties.add('caret-color');
|
||||
allProperties.add('caret-shape');
|
||||
allProperties.add('chains');
|
||||
allProperties.add('clear');
|
||||
allProperties.add('clip');
|
||||
allProperties.add('clip-path');
|
||||
allProperties.add('clip-rule');
|
||||
allProperties.add('color');
|
||||
allProperties.add('color-interpolation-filters');
|
||||
allProperties.add('column-count');
|
||||
allProperties.add('column-fill');
|
||||
allProperties.add('column-gap');
|
||||
allProperties.add('column-rule');
|
||||
allProperties.add('column-rule-color');
|
||||
allProperties.add('column-rule-style');
|
||||
allProperties.add('column-rule-width');
|
||||
allProperties.add('column-span');
|
||||
allProperties.add('column-width');
|
||||
allProperties.add('columns');
|
||||
allProperties.add('contain');
|
||||
allProperties.add('content');
|
||||
allProperties.add('continue');
|
||||
allProperties.add('counter-increment');
|
||||
allProperties.add('counter-reset');
|
||||
allProperties.add('counter-set');
|
||||
allProperties.add('cue');
|
||||
allProperties.add('cue-after');
|
||||
allProperties.add('cue-before');
|
||||
allProperties.add('cursor');
|
||||
allProperties.add('direction');
|
||||
allProperties.add('display');
|
||||
allProperties.add('dominant-baseline');
|
||||
allProperties.add('elevation');
|
||||
allProperties.add('empty-cells');
|
||||
allProperties.add('filter');
|
||||
allProperties.add('flex');
|
||||
allProperties.add('flex-basis');
|
||||
allProperties.add('flex-direction');
|
||||
allProperties.add('flex-flow');
|
||||
allProperties.add('flex-grow');
|
||||
allProperties.add('flex-shrink');
|
||||
allProperties.add('flex-wrap');
|
||||
allProperties.add('float');
|
||||
allProperties.add('flood-color');
|
||||
allProperties.add('flood-opacity');
|
||||
allProperties.add('flow');
|
||||
allProperties.add('flow-from');
|
||||
allProperties.add('flow-into');
|
||||
allProperties.add('font');
|
||||
allProperties.add('font-family');
|
||||
allProperties.add('font-feature-settings');
|
||||
allProperties.add('font-kerning');
|
||||
allProperties.add('font-language-override');
|
||||
allProperties.add('font-max-size');
|
||||
allProperties.add('font-min-size');
|
||||
allProperties.add('font-optical-sizing');
|
||||
allProperties.add('font-palette');
|
||||
allProperties.add('font-size');
|
||||
allProperties.add('font-size-adjust');
|
||||
allProperties.add('font-stretch');
|
||||
allProperties.add('font-style');
|
||||
allProperties.add('font-synthesis');
|
||||
allProperties.add('font-synthesis-small-caps');
|
||||
allProperties.add('font-synthesis-style');
|
||||
allProperties.add('font-synthesis-weight');
|
||||
allProperties.add('font-variant');
|
||||
allProperties.add('font-variant-alternates');
|
||||
allProperties.add('font-variant-caps');
|
||||
allProperties.add('font-variant-east-asian');
|
||||
allProperties.add('font-variant-emoji');
|
||||
allProperties.add('font-variant-ligatures');
|
||||
allProperties.add('font-variant-numeric');
|
||||
allProperties.add('font-variant-position');
|
||||
allProperties.add('font-variation-settings');
|
||||
allProperties.add('font-weight');
|
||||
allProperties.add('footnote-display');
|
||||
allProperties.add('footnote-policy');
|
||||
allProperties.add('gap');
|
||||
allProperties.add('glyph-orientation-vertical');
|
||||
allProperties.add('grid');
|
||||
allProperties.add('grid-area');
|
||||
allProperties.add('grid-auto-columns');
|
||||
allProperties.add('grid-auto-flow');
|
||||
allProperties.add('grid-auto-rows');
|
||||
allProperties.add('grid-column');
|
||||
allProperties.add('grid-column-end');
|
||||
allProperties.add('grid-column-start');
|
||||
allProperties.add('grid-row');
|
||||
allProperties.add('grid-row-end');
|
||||
allProperties.add('grid-row-start');
|
||||
allProperties.add('grid-template');
|
||||
allProperties.add('grid-template-areas');
|
||||
allProperties.add('grid-template-columns');
|
||||
allProperties.add('grid-template-rows');
|
||||
allProperties.add('hanging-punctuation');
|
||||
allProperties.add('height');
|
||||
allProperties.add('hyphenate-character');
|
||||
allProperties.add('hyphenate-limit-chars');
|
||||
allProperties.add('hyphenate-limit-last');
|
||||
allProperties.add('hyphenate-limit-lines');
|
||||
allProperties.add('hyphenate-limit-zone');
|
||||
allProperties.add('hyphens');
|
||||
allProperties.add('image-orientation');
|
||||
allProperties.add('image-resolution');
|
||||
allProperties.add('initial-letters');
|
||||
allProperties.add('initial-letters-align');
|
||||
allProperties.add('initial-letters-wrap');
|
||||
allProperties.add('inline-size');
|
||||
allProperties.add('inline-sizing');
|
||||
allProperties.add('inset');
|
||||
allProperties.add('inset-block');
|
||||
allProperties.add('inset-block-end');
|
||||
allProperties.add('inset-block-start');
|
||||
allProperties.add('inset-inline');
|
||||
allProperties.add('inset-inline-end');
|
||||
allProperties.add('inset-inline-start');
|
||||
allProperties.add('isolation');
|
||||
allProperties.add('justify-content');
|
||||
allProperties.add('justify-items');
|
||||
allProperties.add('justify-self');
|
||||
allProperties.add('left');
|
||||
allProperties.add('letter-spacing');
|
||||
allProperties.add('lighting-color');
|
||||
allProperties.add('line-break');
|
||||
allProperties.add('line-clamp');
|
||||
allProperties.add('line-grid');
|
||||
allProperties.add('line-height');
|
||||
allProperties.add('line-padding');
|
||||
allProperties.add('line-snap');
|
||||
allProperties.add('list-style');
|
||||
allProperties.add('list-style-image');
|
||||
allProperties.add('list-style-position');
|
||||
allProperties.add('list-style-type');
|
||||
allProperties.add('margin');
|
||||
allProperties.add('margin-block');
|
||||
allProperties.add('margin-block-end');
|
||||
allProperties.add('margin-block-start');
|
||||
allProperties.add('margin-bottom');
|
||||
allProperties.add('margin-inline');
|
||||
allProperties.add('margin-inline-end');
|
||||
allProperties.add('margin-inline-start');
|
||||
allProperties.add('margin-left');
|
||||
allProperties.add('margin-right');
|
||||
allProperties.add('margin-top');
|
||||
allProperties.add('margin-trim');
|
||||
allProperties.add('marker-side');
|
||||
allProperties.add('mask');
|
||||
allProperties.add('mask-border');
|
||||
allProperties.add('mask-border-mode');
|
||||
allProperties.add('mask-border-outset');
|
||||
allProperties.add('mask-border-repeat');
|
||||
allProperties.add('mask-border-slice');
|
||||
allProperties.add('mask-border-source');
|
||||
allProperties.add('mask-border-width');
|
||||
allProperties.add('mask-clip');
|
||||
allProperties.add('mask-composite');
|
||||
allProperties.add('mask-image');
|
||||
allProperties.add('mask-mode');
|
||||
allProperties.add('mask-origin');
|
||||
allProperties.add('mask-position');
|
||||
allProperties.add('mask-repeat');
|
||||
allProperties.add('mask-size');
|
||||
allProperties.add('mask-type');
|
||||
allProperties.add('max-block-size');
|
||||
allProperties.add('max-height');
|
||||
allProperties.add('max-inline-size');
|
||||
allProperties.add('max-lines');
|
||||
allProperties.add('max-width');
|
||||
allProperties.add('min-block-size');
|
||||
allProperties.add('min-height');
|
||||
allProperties.add('min-inline-size');
|
||||
allProperties.add('min-width');
|
||||
allProperties.add('mix-blend-mode');
|
||||
allProperties.add('nav-down');
|
||||
allProperties.add('nav-left');
|
||||
allProperties.add('nav-right');
|
||||
allProperties.add('nav-up');
|
||||
allProperties.add('object-fit');
|
||||
allProperties.add('object-position');
|
||||
allProperties.add('offset');
|
||||
allProperties.add('offset-after');
|
||||
allProperties.add('offset-anchor');
|
||||
allProperties.add('offset-before');
|
||||
allProperties.add('offset-distance');
|
||||
allProperties.add('offset-end');
|
||||
allProperties.add('offset-path');
|
||||
allProperties.add('offset-position');
|
||||
allProperties.add('offset-rotate');
|
||||
allProperties.add('offset-start');
|
||||
allProperties.add('opacity');
|
||||
allProperties.add('order');
|
||||
allProperties.add('orphans');
|
||||
allProperties.add('outline');
|
||||
allProperties.add('outline-color');
|
||||
allProperties.add('outline-offset');
|
||||
allProperties.add('outline-style');
|
||||
allProperties.add('outline-width');
|
||||
allProperties.add('overflow');
|
||||
allProperties.add('overflow-block');
|
||||
allProperties.add('overflow-inline');
|
||||
allProperties.add('overflow-wrap');
|
||||
allProperties.add('overflow-x');
|
||||
allProperties.add('overflow-y');
|
||||
allProperties.add('padding');
|
||||
allProperties.add('padding-block');
|
||||
allProperties.add('padding-block-end');
|
||||
allProperties.add('padding-block-start');
|
||||
allProperties.add('padding-bottom');
|
||||
allProperties.add('padding-inline');
|
||||
allProperties.add('padding-inline-end');
|
||||
allProperties.add('padding-inline-start');
|
||||
allProperties.add('padding-left');
|
||||
allProperties.add('padding-right');
|
||||
allProperties.add('padding-top');
|
||||
allProperties.add('page');
|
||||
allProperties.add('page-break-after');
|
||||
allProperties.add('page-break-before');
|
||||
allProperties.add('page-break-inside');
|
||||
allProperties.add('pause');
|
||||
allProperties.add('pause-after');
|
||||
allProperties.add('pause-before');
|
||||
allProperties.add('pitch');
|
||||
allProperties.add('pitch-range');
|
||||
allProperties.add('place-content');
|
||||
allProperties.add('place-items');
|
||||
allProperties.add('place-self');
|
||||
allProperties.add('play-during');
|
||||
allProperties.add('position');
|
||||
allProperties.add('presentation-level');
|
||||
allProperties.add('quotes');
|
||||
allProperties.add('region-fragment');
|
||||
allProperties.add('resize');
|
||||
allProperties.add('rest');
|
||||
allProperties.add('rest-after');
|
||||
allProperties.add('rest-before');
|
||||
allProperties.add('richness');
|
||||
allProperties.add('right');
|
||||
allProperties.add('row-gap');
|
||||
allProperties.add('ruby-align');
|
||||
allProperties.add('ruby-merge');
|
||||
allProperties.add('ruby-position');
|
||||
allProperties.add('running');
|
||||
allProperties.add('scroll-behavior');
|
||||
allProperties.add('scroll-margin');
|
||||
allProperties.add('scroll-margin-block');
|
||||
allProperties.add('scroll-margin-block-end');
|
||||
allProperties.add('scroll-margin-block-start');
|
||||
allProperties.add('scroll-margin-bottom');
|
||||
allProperties.add('scroll-margin-inline');
|
||||
allProperties.add('scroll-margin-inline-end');
|
||||
allProperties.add('scroll-margin-inline-start');
|
||||
allProperties.add('scroll-margin-left');
|
||||
allProperties.add('scroll-margin-right');
|
||||
allProperties.add('scroll-margin-top');
|
||||
allProperties.add('scroll-padding');
|
||||
allProperties.add('scroll-padding-block');
|
||||
allProperties.add('scroll-padding-block-end');
|
||||
allProperties.add('scroll-padding-block-start');
|
||||
allProperties.add('scroll-padding-bottom');
|
||||
allProperties.add('scroll-padding-inline');
|
||||
allProperties.add('scroll-padding-inline-end');
|
||||
allProperties.add('scroll-padding-inline-start');
|
||||
allProperties.add('scroll-padding-left');
|
||||
allProperties.add('scroll-padding-right');
|
||||
allProperties.add('scroll-padding-top');
|
||||
allProperties.add('scroll-snap-align');
|
||||
allProperties.add('scroll-snap-stop');
|
||||
allProperties.add('scroll-snap-type');
|
||||
allProperties.add('shape-image-threshold');
|
||||
allProperties.add('shape-inside');
|
||||
allProperties.add('shape-margin');
|
||||
allProperties.add('shape-outside');
|
||||
allProperties.add('speak');
|
||||
allProperties.add('speak-as');
|
||||
allProperties.add('speak-header');
|
||||
allProperties.add('speak-numeral');
|
||||
allProperties.add('speak-punctuation');
|
||||
allProperties.add('speech-rate');
|
||||
allProperties.add('stress');
|
||||
allProperties.add('string-set');
|
||||
allProperties.add('tab-size');
|
||||
allProperties.add('table-layout');
|
||||
allProperties.add('text-align');
|
||||
allProperties.add('text-align-all');
|
||||
allProperties.add('text-align-last');
|
||||
allProperties.add('text-combine-upright');
|
||||
allProperties.add('text-decoration');
|
||||
allProperties.add('text-decoration-color');
|
||||
allProperties.add('text-decoration-line');
|
||||
allProperties.add('text-decoration-style');
|
||||
allProperties.add('text-emphasis');
|
||||
allProperties.add('text-emphasis-color');
|
||||
allProperties.add('text-emphasis-position');
|
||||
allProperties.add('text-emphasis-style');
|
||||
allProperties.add('text-group-align');
|
||||
allProperties.add('text-indent');
|
||||
allProperties.add('text-justify');
|
||||
allProperties.add('text-orientation');
|
||||
allProperties.add('text-overflow');
|
||||
allProperties.add('text-shadow');
|
||||
allProperties.add('text-space-collapse');
|
||||
allProperties.add('text-space-trim');
|
||||
allProperties.add('text-spacing');
|
||||
allProperties.add('text-transform');
|
||||
allProperties.add('text-underline-position');
|
||||
allProperties.add('text-wrap');
|
||||
allProperties.add('top');
|
||||
allProperties.add('transform');
|
||||
allProperties.add('transform-box');
|
||||
allProperties.add('transform-origin');
|
||||
allProperties.add('transition');
|
||||
allProperties.add('transition-delay');
|
||||
allProperties.add('transition-duration');
|
||||
allProperties.add('transition-property');
|
||||
allProperties.add('transition-timing-function');
|
||||
allProperties.add('unicode-bidi');
|
||||
allProperties.add('user-select');
|
||||
allProperties.add('vertical-align');
|
||||
allProperties.add('visibility');
|
||||
allProperties.add('voice-balance');
|
||||
allProperties.add('voice-duration');
|
||||
allProperties.add('voice-family');
|
||||
allProperties.add('voice-pitch');
|
||||
allProperties.add('voice-range');
|
||||
allProperties.add('voice-rate');
|
||||
allProperties.add('voice-stress');
|
||||
allProperties.add('voice-volume');
|
||||
allProperties.add('volume');
|
||||
allProperties.add('white-space');
|
||||
allProperties.add('widows');
|
||||
allProperties.add('width');
|
||||
allProperties.add('will-change');
|
||||
allProperties.add('word-break');
|
||||
allProperties.add('word-spacing');
|
||||
allProperties.add('word-wrap');
|
||||
allProperties.add('wrap-after');
|
||||
allProperties.add('wrap-before');
|
||||
allProperties.add('wrap-flow');
|
||||
allProperties.add('wrap-inside');
|
||||
allProperties.add('wrap-through');
|
||||
allProperties.add('writing-mode');
|
||||
allProperties.add('z-index');
|
||||
module.exports = new Set([
|
||||
'align-content',
|
||||
'align-items',
|
||||
'align-self',
|
||||
'alignment-baseline',
|
||||
'all',
|
||||
'animation',
|
||||
'animation-delay',
|
||||
'animation-direction',
|
||||
'animation-duration',
|
||||
'animation-fill-mode',
|
||||
'animation-iteration-count',
|
||||
'animation-name',
|
||||
'animation-play-state',
|
||||
'animation-timing-function',
|
||||
'appearance',
|
||||
'azimuth',
|
||||
'background',
|
||||
'background-attachment',
|
||||
'background-blend-mode',
|
||||
'background-clip',
|
||||
'background-color',
|
||||
'background-image',
|
||||
'background-origin',
|
||||
'background-position',
|
||||
'background-repeat',
|
||||
'background-size',
|
||||
'baseline-shift',
|
||||
'block-overflow',
|
||||
'block-size',
|
||||
'bookmark-label',
|
||||
'bookmark-level',
|
||||
'bookmark-state',
|
||||
'border',
|
||||
'border-block',
|
||||
'border-block-color',
|
||||
'border-block-end',
|
||||
'border-block-end-color',
|
||||
'border-block-end-style',
|
||||
'border-block-end-width',
|
||||
'border-block-start',
|
||||
'border-block-start-color',
|
||||
'border-block-start-style',
|
||||
'border-block-start-width',
|
||||
'border-block-style',
|
||||
'border-block-width',
|
||||
'border-bottom',
|
||||
'border-bottom-color',
|
||||
'border-bottom-left-radius',
|
||||
'border-bottom-right-radius',
|
||||
'border-bottom-style',
|
||||
'border-bottom-width',
|
||||
'border-boundary',
|
||||
'border-collapse',
|
||||
'border-color',
|
||||
'border-end-end-radius',
|
||||
'border-end-start-radius',
|
||||
'border-image',
|
||||
'border-image-outset',
|
||||
'border-image-repeat',
|
||||
'border-image-slice',
|
||||
'border-image-source',
|
||||
'border-image-width',
|
||||
'border-inline',
|
||||
'border-inline-color',
|
||||
'border-inline-end',
|
||||
'border-inline-end-color',
|
||||
'border-inline-end-style',
|
||||
'border-inline-end-width',
|
||||
'border-inline-start',
|
||||
'border-inline-start-color',
|
||||
'border-inline-start-style',
|
||||
'border-inline-start-width',
|
||||
'border-inline-style',
|
||||
'border-inline-width',
|
||||
'border-left',
|
||||
'border-left-color',
|
||||
'border-left-style',
|
||||
'border-left-width',
|
||||
'border-radius',
|
||||
'border-right',
|
||||
'border-right-color',
|
||||
'border-right-style',
|
||||
'border-right-width',
|
||||
'border-spacing',
|
||||
'border-start-end-radius',
|
||||
'border-start-start-radius',
|
||||
'border-style',
|
||||
'border-top',
|
||||
'border-top-color',
|
||||
'border-top-left-radius',
|
||||
'border-top-right-radius',
|
||||
'border-top-style',
|
||||
'border-top-width',
|
||||
'border-width',
|
||||
'bottom',
|
||||
'box-decoration-break',
|
||||
'box-shadow',
|
||||
'box-sizing',
|
||||
'box-snap',
|
||||
'break-after',
|
||||
'break-before',
|
||||
'break-inside',
|
||||
'caption-side',
|
||||
'caret',
|
||||
'caret-color',
|
||||
'caret-shape',
|
||||
'chains',
|
||||
'clear',
|
||||
'clip',
|
||||
'clip-path',
|
||||
'clip-rule',
|
||||
'color',
|
||||
'color-adjust',
|
||||
'color-interpolation-filters',
|
||||
'color-scheme',
|
||||
'column-count',
|
||||
'column-fill',
|
||||
'column-gap',
|
||||
'column-rule',
|
||||
'column-rule-color',
|
||||
'column-rule-style',
|
||||
'column-rule-width',
|
||||
'column-span',
|
||||
'column-width',
|
||||
'columns',
|
||||
'contain',
|
||||
'content',
|
||||
'continue',
|
||||
'counter-increment',
|
||||
'counter-reset',
|
||||
'counter-set',
|
||||
'cue',
|
||||
'cue-after',
|
||||
'cue-before',
|
||||
'cursor',
|
||||
'direction',
|
||||
'display',
|
||||
'dominant-baseline',
|
||||
'elevation',
|
||||
'empty-cells',
|
||||
'filter',
|
||||
'flex',
|
||||
'flex-basis',
|
||||
'flex-direction',
|
||||
'flex-flow',
|
||||
'flex-grow',
|
||||
'flex-shrink',
|
||||
'flex-wrap',
|
||||
'float',
|
||||
'flood-color',
|
||||
'flood-opacity',
|
||||
'flow',
|
||||
'flow-from',
|
||||
'flow-into',
|
||||
'font',
|
||||
'font-family',
|
||||
'font-feature-settings',
|
||||
'font-kerning',
|
||||
'font-language-override',
|
||||
'font-optical-sizing',
|
||||
'font-palette',
|
||||
'font-size',
|
||||
'font-size-adjust',
|
||||
'font-stretch',
|
||||
'font-style',
|
||||
'font-synthesis',
|
||||
'font-synthesis-small-caps',
|
||||
'font-synthesis-style',
|
||||
'font-synthesis-weight',
|
||||
'font-variant',
|
||||
'font-variant-alternates',
|
||||
'font-variant-caps',
|
||||
'font-variant-east-asian',
|
||||
'font-variant-emoji',
|
||||
'font-variant-ligatures',
|
||||
'font-variant-numeric',
|
||||
'font-variant-position',
|
||||
'font-variation-settings',
|
||||
'font-weight',
|
||||
'footnote-display',
|
||||
'footnote-policy',
|
||||
'forced-color-adjust',
|
||||
'gap',
|
||||
'glyph-orientation-vertical',
|
||||
'grid',
|
||||
'grid-area',
|
||||
'grid-auto-columns',
|
||||
'grid-auto-flow',
|
||||
'grid-auto-rows',
|
||||
'grid-column',
|
||||
'grid-column-end',
|
||||
'grid-column-start',
|
||||
'grid-row',
|
||||
'grid-row-end',
|
||||
'grid-row-start',
|
||||
'grid-template',
|
||||
'grid-template-areas',
|
||||
'grid-template-columns',
|
||||
'grid-template-rows',
|
||||
'hanging-punctuation',
|
||||
'height',
|
||||
'hyphenate-character',
|
||||
'hyphenate-limit-chars',
|
||||
'hyphenate-limit-last',
|
||||
'hyphenate-limit-lines',
|
||||
'hyphenate-limit-zone',
|
||||
'hyphens',
|
||||
'image-orientation',
|
||||
'image-rendering',
|
||||
'image-resolution',
|
||||
'initial-letters',
|
||||
'initial-letters-align',
|
||||
'initial-letters-wrap',
|
||||
'inline-size',
|
||||
'inline-sizing',
|
||||
'inset',
|
||||
'inset-block',
|
||||
'inset-block-end',
|
||||
'inset-block-start',
|
||||
'inset-inline',
|
||||
'inset-inline-end',
|
||||
'inset-inline-start',
|
||||
'isolation',
|
||||
'justify-content',
|
||||
'justify-items',
|
||||
'justify-self',
|
||||
'left',
|
||||
'letter-spacing',
|
||||
'lighting-color',
|
||||
'line-break',
|
||||
'line-clamp',
|
||||
'line-grid',
|
||||
'line-height',
|
||||
'line-padding',
|
||||
'line-snap',
|
||||
'list-style',
|
||||
'list-style-image',
|
||||
'list-style-position',
|
||||
'list-style-type',
|
||||
'margin',
|
||||
'margin-block',
|
||||
'margin-block-end',
|
||||
'margin-block-start',
|
||||
'margin-bottom',
|
||||
'margin-inline',
|
||||
'margin-inline-end',
|
||||
'margin-inline-start',
|
||||
'margin-left',
|
||||
'margin-right',
|
||||
'margin-top',
|
||||
'marker-side',
|
||||
'mask',
|
||||
'mask-border',
|
||||
'mask-border-mode',
|
||||
'mask-border-outset',
|
||||
'mask-border-repeat',
|
||||
'mask-border-slice',
|
||||
'mask-border-source',
|
||||
'mask-border-width',
|
||||
'mask-clip',
|
||||
'mask-composite',
|
||||
'mask-image',
|
||||
'mask-mode',
|
||||
'mask-origin',
|
||||
'mask-position',
|
||||
'mask-repeat',
|
||||
'mask-size',
|
||||
'mask-type',
|
||||
'max-block-size',
|
||||
'max-height',
|
||||
'max-inline-size',
|
||||
'max-lines',
|
||||
'max-width',
|
||||
'min-block-size',
|
||||
'min-height',
|
||||
'min-inline-size',
|
||||
'min-width',
|
||||
'mix-blend-mode',
|
||||
'nav-down',
|
||||
'nav-left',
|
||||
'nav-right',
|
||||
'nav-up',
|
||||
'object-fit',
|
||||
'object-position',
|
||||
'offset',
|
||||
'offset-after',
|
||||
'offset-anchor',
|
||||
'offset-before',
|
||||
'offset-distance',
|
||||
'offset-end',
|
||||
'offset-path',
|
||||
'offset-position',
|
||||
'offset-rotate',
|
||||
'offset-start',
|
||||
'opacity',
|
||||
'order',
|
||||
'orphans',
|
||||
'outline',
|
||||
'outline-color',
|
||||
'outline-offset',
|
||||
'outline-style',
|
||||
'outline-width',
|
||||
'overflow',
|
||||
'overflow-block',
|
||||
'overflow-inline',
|
||||
'overflow-wrap',
|
||||
'overflow-x',
|
||||
'overflow-y',
|
||||
'padding',
|
||||
'padding-block',
|
||||
'padding-block-end',
|
||||
'padding-block-start',
|
||||
'padding-bottom',
|
||||
'padding-inline',
|
||||
'padding-inline-end',
|
||||
'padding-inline-start',
|
||||
'padding-left',
|
||||
'padding-right',
|
||||
'padding-top',
|
||||
'page',
|
||||
'page-break-after',
|
||||
'page-break-before',
|
||||
'page-break-inside',
|
||||
'pause',
|
||||
'pause-after',
|
||||
'pause-before',
|
||||
'pitch',
|
||||
'pitch-range',
|
||||
'place-content',
|
||||
'place-items',
|
||||
'place-self',
|
||||
'play-during',
|
||||
'position',
|
||||
'quotes',
|
||||
'region-fragment',
|
||||
'resize',
|
||||
'rest',
|
||||
'rest-after',
|
||||
'rest-before',
|
||||
'richness',
|
||||
'right',
|
||||
'row-gap',
|
||||
'ruby-align',
|
||||
'ruby-merge',
|
||||
'ruby-position',
|
||||
'running',
|
||||
'scroll-behavior',
|
||||
'scroll-margin',
|
||||
'scroll-margin-block',
|
||||
'scroll-margin-block-end',
|
||||
'scroll-margin-block-start',
|
||||
'scroll-margin-bottom',
|
||||
'scroll-margin-inline',
|
||||
'scroll-margin-inline-end',
|
||||
'scroll-margin-inline-start',
|
||||
'scroll-margin-left',
|
||||
'scroll-margin-right',
|
||||
'scroll-margin-top',
|
||||
'scroll-padding',
|
||||
'scroll-padding-block',
|
||||
'scroll-padding-block-end',
|
||||
'scroll-padding-block-start',
|
||||
'scroll-padding-bottom',
|
||||
'scroll-padding-inline',
|
||||
'scroll-padding-inline-end',
|
||||
'scroll-padding-inline-start',
|
||||
'scroll-padding-left',
|
||||
'scroll-padding-right',
|
||||
'scroll-padding-top',
|
||||
'scroll-snap-align',
|
||||
'scroll-snap-stop',
|
||||
'scroll-snap-type',
|
||||
'shape-image-threshold',
|
||||
'shape-inside',
|
||||
'shape-margin',
|
||||
'shape-outside',
|
||||
'spatial-navigation-action',
|
||||
'spatial-navigation-contain',
|
||||
'spatial-navigation-function',
|
||||
'speak',
|
||||
'speak-as',
|
||||
'speak-header',
|
||||
'speak-numeral',
|
||||
'speak-punctuation',
|
||||
'speech-rate',
|
||||
'stress',
|
||||
'string-set',
|
||||
'tab-size',
|
||||
'table-layout',
|
||||
'text-align',
|
||||
'text-align-all',
|
||||
'text-align-last',
|
||||
'text-combine-upright',
|
||||
'text-decoration',
|
||||
'text-decoration-color',
|
||||
'text-decoration-line',
|
||||
'text-decoration-style',
|
||||
'text-emphasis',
|
||||
'text-emphasis-color',
|
||||
'text-emphasis-position',
|
||||
'text-emphasis-style',
|
||||
'text-group-align',
|
||||
'text-indent',
|
||||
'text-justify',
|
||||
'text-orientation',
|
||||
'text-overflow',
|
||||
'text-shadow',
|
||||
'text-space-collapse',
|
||||
'text-space-trim',
|
||||
'text-spacing',
|
||||
'text-transform',
|
||||
'text-underline-position',
|
||||
'text-wrap',
|
||||
'top',
|
||||
'transform',
|
||||
'transform-box',
|
||||
'transform-origin',
|
||||
'transition',
|
||||
'transition-delay',
|
||||
'transition-duration',
|
||||
'transition-property',
|
||||
'transition-timing-function',
|
||||
'unicode-bidi',
|
||||
'user-select',
|
||||
'vertical-align',
|
||||
'visibility',
|
||||
'voice-balance',
|
||||
'voice-duration',
|
||||
'voice-family',
|
||||
'voice-pitch',
|
||||
'voice-range',
|
||||
'voice-rate',
|
||||
'voice-stress',
|
||||
'voice-volume',
|
||||
'volume',
|
||||
'white-space',
|
||||
'widows',
|
||||
'width',
|
||||
'will-change',
|
||||
'word-boundary-detection',
|
||||
'word-boundary-expansion',
|
||||
'word-break',
|
||||
'word-spacing',
|
||||
'word-wrap',
|
||||
'wrap-after',
|
||||
'wrap-before',
|
||||
'wrap-flow',
|
||||
'wrap-inside',
|
||||
'wrap-through',
|
||||
'writing-mode',
|
||||
'z-index',
|
||||
]);
|
||||
|
194
node_modules/cssstyle/lib/allWebkitProperties.js
generated
vendored
Normal file
194
node_modules/cssstyle/lib/allWebkitProperties.js
generated
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* This file contains all implemented properties that are not a part of any
|
||||
* current specifications or drafts, but are handled by browsers nevertheless.
|
||||
*/
|
||||
|
||||
module.exports = [
|
||||
'animation',
|
||||
'animation-delay',
|
||||
'animation-direction',
|
||||
'animation-duration',
|
||||
'animation-fill-mode',
|
||||
'animation-iteration-count',
|
||||
'animation-name',
|
||||
'animation-play-state',
|
||||
'animation-timing-function',
|
||||
'appearance',
|
||||
'aspect-ratio',
|
||||
'backface-visibility',
|
||||
'background-clip',
|
||||
'background-composite',
|
||||
'background-origin',
|
||||
'background-size',
|
||||
'border-after',
|
||||
'border-after-color',
|
||||
'border-after-style',
|
||||
'border-after-width',
|
||||
'border-before',
|
||||
'border-before-color',
|
||||
'border-before-style',
|
||||
'border-before-width',
|
||||
'border-end',
|
||||
'border-end-color',
|
||||
'border-end-style',
|
||||
'border-end-width',
|
||||
'border-fit',
|
||||
'border-horizontal-spacing',
|
||||
'border-image',
|
||||
'border-radius',
|
||||
'border-start',
|
||||
'border-start-color',
|
||||
'border-start-style',
|
||||
'border-start-width',
|
||||
'border-vertical-spacing',
|
||||
'box-align',
|
||||
'box-direction',
|
||||
'box-flex',
|
||||
'box-flex-group',
|
||||
'box-lines',
|
||||
'box-ordinal-group',
|
||||
'box-orient',
|
||||
'box-pack',
|
||||
'box-reflect',
|
||||
'box-shadow',
|
||||
'color-correction',
|
||||
'column-axis',
|
||||
'column-break-after',
|
||||
'column-break-before',
|
||||
'column-break-inside',
|
||||
'column-count',
|
||||
'column-gap',
|
||||
'column-rule',
|
||||
'column-rule-color',
|
||||
'column-rule-style',
|
||||
'column-rule-width',
|
||||
'columns',
|
||||
'column-span',
|
||||
'column-width',
|
||||
'filter',
|
||||
'flex-align',
|
||||
'flex-direction',
|
||||
'flex-flow',
|
||||
'flex-item-align',
|
||||
'flex-line-pack',
|
||||
'flex-order',
|
||||
'flex-pack',
|
||||
'flex-wrap',
|
||||
'flow-from',
|
||||
'flow-into',
|
||||
'font-feature-settings',
|
||||
'font-kerning',
|
||||
'font-size-delta',
|
||||
'font-smoothing',
|
||||
'font-variant-ligatures',
|
||||
'highlight',
|
||||
'hyphenate-character',
|
||||
'hyphenate-limit-after',
|
||||
'hyphenate-limit-before',
|
||||
'hyphenate-limit-lines',
|
||||
'hyphens',
|
||||
'line-align',
|
||||
'line-box-contain',
|
||||
'line-break',
|
||||
'line-clamp',
|
||||
'line-grid',
|
||||
'line-snap',
|
||||
'locale',
|
||||
'logical-height',
|
||||
'logical-width',
|
||||
'margin-after',
|
||||
'margin-after-collapse',
|
||||
'margin-before',
|
||||
'margin-before-collapse',
|
||||
'margin-bottom-collapse',
|
||||
'margin-collapse',
|
||||
'margin-end',
|
||||
'margin-start',
|
||||
'margin-top-collapse',
|
||||
'marquee',
|
||||
'marquee-direction',
|
||||
'marquee-increment',
|
||||
'marquee-repetition',
|
||||
'marquee-speed',
|
||||
'marquee-style',
|
||||
'mask',
|
||||
'mask-attachment',
|
||||
'mask-box-image',
|
||||
'mask-box-image-outset',
|
||||
'mask-box-image-repeat',
|
||||
'mask-box-image-slice',
|
||||
'mask-box-image-source',
|
||||
'mask-box-image-width',
|
||||
'mask-clip',
|
||||
'mask-composite',
|
||||
'mask-image',
|
||||
'mask-origin',
|
||||
'mask-position',
|
||||
'mask-position-x',
|
||||
'mask-position-y',
|
||||
'mask-repeat',
|
||||
'mask-repeat-x',
|
||||
'mask-repeat-y',
|
||||
'mask-size',
|
||||
'match-nearest-mail-blockquote-color',
|
||||
'max-logical-height',
|
||||
'max-logical-width',
|
||||
'min-logical-height',
|
||||
'min-logical-width',
|
||||
'nbsp-mode',
|
||||
'overflow-scrolling',
|
||||
'padding-after',
|
||||
'padding-before',
|
||||
'padding-end',
|
||||
'padding-start',
|
||||
'perspective',
|
||||
'perspective-origin',
|
||||
'perspective-origin-x',
|
||||
'perspective-origin-y',
|
||||
'print-color-adjust',
|
||||
'region-break-after',
|
||||
'region-break-before',
|
||||
'region-break-inside',
|
||||
'region-overflow',
|
||||
'rtl-ordering',
|
||||
'svg-shadow',
|
||||
'tap-highlight-color',
|
||||
'text-combine',
|
||||
'text-decorations-in-effect',
|
||||
'text-emphasis',
|
||||
'text-emphasis-color',
|
||||
'text-emphasis-position',
|
||||
'text-emphasis-style',
|
||||
'text-fill-color',
|
||||
'text-orientation',
|
||||
'text-security',
|
||||
'text-size-adjust',
|
||||
'text-stroke',
|
||||
'text-stroke-color',
|
||||
'text-stroke-width',
|
||||
'transform',
|
||||
'transform-origin',
|
||||
'transform-origin-x',
|
||||
'transform-origin-y',
|
||||
'transform-origin-z',
|
||||
'transform-style',
|
||||
'transition',
|
||||
'transition-delay',
|
||||
'transition-duration',
|
||||
'transition-property',
|
||||
'transition-timing-function',
|
||||
'user-drag',
|
||||
'user-modify',
|
||||
'user-select',
|
||||
'wrap',
|
||||
'wrap-flow',
|
||||
'wrap-margin',
|
||||
'wrap-padding',
|
||||
'wrap-shape-inside',
|
||||
'wrap-shape-outside',
|
||||
'wrap-through',
|
||||
'writing-mode',
|
||||
'zoom',
|
||||
].map(prop => 'webkit-' + prop);
|
2
node_modules/cssstyle/lib/implementedProperties.js
generated
vendored
2
node_modules/cssstyle/lib/implementedProperties.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
// autogenerated - 7/15/2019
|
||||
// autogenerated - 4/29/2020
|
||||
|
||||
/*
|
||||
*
|
||||
|
41
node_modules/cssstyle/lib/parsers.js
generated
vendored
41
node_modules/cssstyle/lib/parsers.js
generated
vendored
@@ -5,6 +5,7 @@
|
||||
'use strict';
|
||||
|
||||
const namedColors = require('./named_colors.json');
|
||||
const { hslToRgb } = require('./utils/colorSpace');
|
||||
|
||||
exports.TYPES = {
|
||||
INTEGER: 1,
|
||||
@@ -17,18 +18,20 @@ exports.TYPES = {
|
||||
ANGLE: 8,
|
||||
KEYWORD: 9,
|
||||
NULL_OR_EMPTY_STR: 10,
|
||||
CALC: 11,
|
||||
};
|
||||
|
||||
// rough regular expressions
|
||||
var integerRegEx = /^[-+]?[0-9]+$/;
|
||||
var numberRegEx = /^[-+]?[0-9]*\.[0-9]+$/;
|
||||
var lengthRegEx = /^(0|[-+]?[0-9]*\.?[0-9]+(in|cm|em|mm|pt|pc|px|ex|rem|vh|vw))$/;
|
||||
var numberRegEx = /^[-+]?[0-9]*\.?[0-9]+$/;
|
||||
var lengthRegEx = /^(0|[-+]?[0-9]*\.?[0-9]+(in|cm|em|mm|pt|pc|px|ex|rem|vh|vw|ch))$/;
|
||||
var percentRegEx = /^[-+]?[0-9]*\.?[0-9]+%$/;
|
||||
var urlRegEx = /^url\(\s*([^)]*)\s*\)$/;
|
||||
var stringRegEx = /^("[^"]*"|'[^']*')$/;
|
||||
var colorRegEx1 = /^#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])?$/;
|
||||
var colorRegEx1 = /^#([0-9a-fA-F]{3,4}){1,2}$/;
|
||||
var colorRegEx2 = /^rgb\(([^)]*)\)$/;
|
||||
var colorRegEx3 = /^rgba\(([^)]*)\)$/;
|
||||
var calcRegEx = /^calc\(([^)]*)\)$/;
|
||||
var colorRegEx4 = /^hsla?\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*(,\s*(-?\d+|-?\d*.\d+)\s*)?\)/;
|
||||
var angleRegEx = /^([-+]?[0-9]*\.?[0-9]+)(deg|grad|rad)$/;
|
||||
|
||||
@@ -60,6 +63,9 @@ exports.valueType = function valueType(val) {
|
||||
if (urlRegEx.test(val)) {
|
||||
return exports.TYPES.URL;
|
||||
}
|
||||
if (calcRegEx.test(val)) {
|
||||
return exports.TYPES.CALC;
|
||||
}
|
||||
if (stringRegEx.test(val)) {
|
||||
return exports.TYPES.STRING;
|
||||
}
|
||||
@@ -69,6 +75,7 @@ exports.valueType = function valueType(val) {
|
||||
if (colorRegEx1.test(val)) {
|
||||
return exports.TYPES.COLOR;
|
||||
}
|
||||
|
||||
var res = colorRegEx2.exec(val);
|
||||
var parts;
|
||||
if (res !== null) {
|
||||
@@ -92,7 +99,7 @@ exports.valueType = function valueType(val) {
|
||||
}
|
||||
if (
|
||||
parts.slice(0, 3).every(percentRegEx.test.bind(percentRegEx)) ||
|
||||
parts.every(integerRegEx.test.bind(integerRegEx))
|
||||
parts.slice(0, 3).every(integerRegEx.test.bind(integerRegEx))
|
||||
) {
|
||||
if (numberRegEx.test(parts[3])) {
|
||||
return exports.TYPES.COLOR;
|
||||
@@ -200,6 +207,11 @@ exports.parsePercent = function parsePercent(val) {
|
||||
|
||||
// either a length or a percent
|
||||
exports.parseMeasurement = function parseMeasurement(val) {
|
||||
var type = exports.valueType(val);
|
||||
if (type === exports.TYPES.CALC) {
|
||||
return val;
|
||||
}
|
||||
|
||||
var length = exports.parseLength(val);
|
||||
if (length !== undefined) {
|
||||
return length;
|
||||
@@ -287,15 +299,26 @@ exports.parseColor = function parseColor(val) {
|
||||
alpha = 1;
|
||||
var parts;
|
||||
var res = colorRegEx1.exec(val);
|
||||
// is it #aaa or #ababab
|
||||
// is it #aaa, #ababab, #aaaa, #abababaa
|
||||
if (res) {
|
||||
var defaultHex = val.substr(1);
|
||||
var hex = val.substr(1);
|
||||
if (hex.length === 3) {
|
||||
if (hex.length === 3 || hex.length === 4) {
|
||||
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
||||
|
||||
if (defaultHex.length === 4) {
|
||||
hex = hex + defaultHex[3] + defaultHex[3];
|
||||
}
|
||||
}
|
||||
red = parseInt(hex.substr(0, 2), 16);
|
||||
green = parseInt(hex.substr(2, 2), 16);
|
||||
blue = parseInt(hex.substr(4, 2), 16);
|
||||
if (hex.length === 8) {
|
||||
var hexAlpha = hex.substr(6, 2);
|
||||
var hexAlphaToRgbaAlpha = Number((parseInt(hexAlpha, 16) / 255).toFixed(3));
|
||||
|
||||
return 'rgba(' + red + ', ' + green + ', ' + blue + ', ' + hexAlphaToRgbaAlpha + ')';
|
||||
}
|
||||
return 'rgb(' + red + ', ' + green + ', ' + blue + ')';
|
||||
}
|
||||
|
||||
@@ -367,10 +390,12 @@ exports.parseColor = function parseColor(val) {
|
||||
if (_alpha && numberRegEx.test(_alpha)) {
|
||||
alpha = parseFloat(_alpha);
|
||||
}
|
||||
|
||||
const [r, g, b] = hslToRgb(hue, saturation / 100, lightness / 100);
|
||||
if (!_alphaString || alpha === 1) {
|
||||
return 'hsl(' + hue + ', ' + saturation + '%, ' + lightness + '%)';
|
||||
return 'rgb(' + r + ', ' + g + ', ' + b + ')';
|
||||
}
|
||||
return 'hsla(' + hue + ', ' + saturation + '%, ' + lightness + '%, ' + alpha + ')';
|
||||
return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + alpha + ')';
|
||||
}
|
||||
|
||||
if (type === exports.TYPES.COLOR) {
|
||||
|
139
node_modules/cssstyle/lib/parsers.test.js
generated
vendored
Normal file
139
node_modules/cssstyle/lib/parsers.test.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
'use strict';
|
||||
|
||||
const parsers = require('./parsers');
|
||||
|
||||
describe('valueType', () => {
|
||||
it('returns color for red', () => {
|
||||
let input = 'red';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.COLOR);
|
||||
});
|
||||
|
||||
it('returns color for #nnnnnn', () => {
|
||||
let input = '#fefefe';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.COLOR);
|
||||
});
|
||||
|
||||
it('returns color for rgb(n, n, n)', () => {
|
||||
let input = 'rgb(10, 10, 10)';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.COLOR);
|
||||
});
|
||||
|
||||
it('returns color for rgb(p, p, p)', () => {
|
||||
let input = 'rgb(10%, 10%, 10%)';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.COLOR);
|
||||
});
|
||||
|
||||
it('returns color for rgba(n, n, n, n)', () => {
|
||||
let input = 'rgba(10, 10, 10, 1)';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.COLOR);
|
||||
});
|
||||
|
||||
it('returns color for rgba(n, n, n, n) with decimal alpha', () => {
|
||||
let input = 'rgba(10, 10, 10, 0.5)';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.COLOR);
|
||||
});
|
||||
|
||||
it('returns color for rgba(p, p, p, n)', () => {
|
||||
let input = 'rgba(10%, 10%, 10%, 1)';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.COLOR);
|
||||
});
|
||||
|
||||
it('returns color for rgba(p, p, p, n) with decimal alpha', () => {
|
||||
let input = 'rgba(10%, 10%, 10%, 0.5)';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.COLOR);
|
||||
});
|
||||
|
||||
it('returns length for 100ch', () => {
|
||||
let input = '100ch';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.LENGTH);
|
||||
});
|
||||
|
||||
it('returns calc from calc(100px * 2)', () => {
|
||||
let input = 'calc(100px * 2)';
|
||||
let output = parsers.valueType(input);
|
||||
|
||||
expect(output).toEqual(parsers.TYPES.CALC);
|
||||
});
|
||||
});
|
||||
describe('parseInteger', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('parseNumber', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('parseLength', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('parsePercent', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('parseMeasurement', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('parseUrl', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('parseString', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('parseColor', () => {
|
||||
it('should convert hsl to rgb values', () => {
|
||||
let input = 'hsla(0, 1%, 2%)';
|
||||
let output = parsers.parseColor(input);
|
||||
|
||||
expect(output).toEqual('rgb(5, 5, 5)');
|
||||
});
|
||||
it('should convert hsla to rgba values', () => {
|
||||
let input = 'hsla(0, 1%, 2%, 0.5)';
|
||||
let output = parsers.parseColor(input);
|
||||
|
||||
expect(output).toEqual('rgba(5, 5, 5, 0.5)');
|
||||
});
|
||||
|
||||
it.todo('Add more tests');
|
||||
});
|
||||
describe('parseAngle', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('parseKeyword', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('dashedToCamelCase', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('shorthandParser', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('shorthandSetter', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('shorthandGetter', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('implicitSetter', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('subImplicitSetter', () => {
|
||||
it.todo('test');
|
||||
});
|
||||
describe('camelToDashed', () => {
|
||||
it.todo('test');
|
||||
});
|
11
node_modules/cssstyle/lib/properties.js
generated
vendored
11
node_modules/cssstyle/lib/properties.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
// autogenerated - 7/15/2019
|
||||
// autogenerated - 4/29/2020
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -1040,9 +1040,16 @@ fontSize_export_isValid = function (v) {
|
||||
return type === external_dependency_parsers_0.TYPES.LENGTH || type === external_dependency_parsers_0.TYPES.PERCENT || type === external_dependency_parsers_0.TYPES.KEYWORD && fontSize_local_var_absoluteSizes.indexOf(v.toLowerCase()) !== -1 || type === external_dependency_parsers_0.TYPES.KEYWORD && fontSize_local_var_relativeSizes.indexOf(v.toLowerCase()) !== -1;
|
||||
};
|
||||
|
||||
function fontSize_local_fn_parse(v) {
|
||||
const valueAsString = String(v).toLowerCase();
|
||||
const optionalArguments = fontSize_local_var_absoluteSizes.concat(fontSize_local_var_relativeSizes);
|
||||
const isOptionalArgument = optionalArguments.some(stringValue => stringValue.toLowerCase() === valueAsString);
|
||||
return isOptionalArgument ? valueAsString : external_dependency_parsers_0.parseMeasurement(v);
|
||||
}
|
||||
|
||||
fontSize_export_definition = {
|
||||
set: function (v) {
|
||||
this._setProperty('font-size', v);
|
||||
this._setProperty('font-size', fontSize_local_fn_parse(v));
|
||||
},
|
||||
get: function () {
|
||||
return this.getPropertyValue('font-size');
|
||||
|
12
node_modules/cssstyle/lib/properties/fontSize.js
generated
vendored
12
node_modules/cssstyle/lib/properties/fontSize.js
generated
vendored
@@ -2,6 +2,7 @@
|
||||
|
||||
var TYPES = require('../parsers').TYPES;
|
||||
var valueType = require('../parsers').valueType;
|
||||
var parseMeasurement = require('../parsers').parseMeasurement;
|
||||
|
||||
var absoluteSizes = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
|
||||
var relativeSizes = ['larger', 'smaller'];
|
||||
@@ -16,9 +17,18 @@ module.exports.isValid = function(v) {
|
||||
);
|
||||
};
|
||||
|
||||
function parse(v) {
|
||||
const valueAsString = String(v).toLowerCase();
|
||||
const optionalArguments = absoluteSizes.concat(relativeSizes);
|
||||
const isOptionalArgument = optionalArguments.some(
|
||||
stringValue => stringValue.toLowerCase() === valueAsString
|
||||
);
|
||||
return isOptionalArgument ? valueAsString : parseMeasurement(v);
|
||||
}
|
||||
|
||||
module.exports.definition = {
|
||||
set: function(v) {
|
||||
this._setProperty('font-size', v);
|
||||
this._setProperty('font-size', parse(v));
|
||||
},
|
||||
get: function() {
|
||||
return this.getPropertyValue('font-size');
|
||||
|
21
node_modules/cssstyle/lib/utils/colorSpace.js
generated
vendored
Normal file
21
node_modules/cssstyle/lib/utils/colorSpace.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
const hueToRgb = (t1, t2, hue) => {
|
||||
if (hue < 0) hue += 6;
|
||||
if (hue >= 6) hue -= 6;
|
||||
|
||||
if (hue < 1) return (t2 - t1) * hue + t1;
|
||||
else if (hue < 3) return t2;
|
||||
else if (hue < 4) return (t2 - t1) * (4 - hue) + t1;
|
||||
else return t1;
|
||||
};
|
||||
|
||||
// https://www.w3.org/TR/css-color-4/#hsl-to-rgb
|
||||
exports.hslToRgb = (hue, sat, light) => {
|
||||
const t2 = light <= 0.5 ? light * (sat + 1) : light + sat - light * sat;
|
||||
const t1 = light * 2 - t2;
|
||||
const r = hueToRgb(t1, t2, hue + 2);
|
||||
const g = hueToRgb(t1, t2, hue);
|
||||
const b = hueToRgb(t1, t2, hue - 2);
|
||||
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
|
||||
};
|
20
node_modules/cssstyle/node_modules/cssom/LICENSE.txt
generated
vendored
Normal file
20
node_modules/cssstyle/node_modules/cssom/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) Nikita Vasilyev
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
67
node_modules/cssstyle/node_modules/cssom/README.mdown
generated
vendored
Normal file
67
node_modules/cssstyle/node_modules/cssom/README.mdown
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# 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}")
|
||||
-> {
|
||||
cssRules: [
|
||||
{
|
||||
selectorText: "body",
|
||||
style: {
|
||||
0: "color",
|
||||
color: "black",
|
||||
length: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
## [Parser demo](http://nv.github.com/CSSOM/docs/parse.html)
|
||||
|
||||
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 a single `CSSOM` global variable:
|
||||
|
||||
➤ git clone https://github.com/NV/CSSOM.git
|
||||
➤ cd CSSOM
|
||||
➤ node build.js
|
||||
build/CSSOM.js is done
|
||||
|
||||
To use it with Node.js or any other CommonJS loader:
|
||||
|
||||
➤ npm install cssom
|
||||
|
||||
## Don’t use it if...
|
||||
|
||||
You parse CSS to mungle, minify or reformat code like this:
|
||||
|
||||
```css
|
||||
div {
|
||||
background: gray;
|
||||
background: linear-gradient(to bottom, white 0%, black 100%);
|
||||
}
|
||||
```
|
||||
|
||||
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).
|
||||
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:
|
||||
|
||||
* [postcss](https://github.com/postcss/postcss)
|
||||
* [reworkcss/css](https://github.com/reworkcss/css)
|
||||
* [csso](https://github.com/css/csso)
|
||||
* [mensch](https://github.com/brettstimmerman/mensch)
|
||||
|
||||
|
||||
## [Tests](http://nv.github.com/CSSOM/spec/)
|
||||
|
||||
To run tests locally:
|
||||
|
||||
➤ git submodule init
|
||||
➤ git submodule update
|
||||
|
||||
|
||||
## [Who uses CSSOM.js](https://github.com/NV/CSSOM/wiki/Who-uses-CSSOM.js)
|
39
node_modules/cssstyle/node_modules/cssom/lib/CSSDocumentRule.js
generated
vendored
Normal file
39
node_modules/cssstyle/node_modules/cssom/lib/CSSDocumentRule.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSRule: require("./CSSRule").CSSRule,
|
||||
MatcherList: require("./MatcherList").MatcherList
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developer.mozilla.org/en/CSS/@-moz-document
|
||||
*/
|
||||
CSSOM.CSSDocumentRule = function CSSDocumentRule() {
|
||||
CSSOM.CSSRule.call(this);
|
||||
this.matcher = new CSSOM.MatcherList();
|
||||
this.cssRules = [];
|
||||
};
|
||||
|
||||
CSSOM.CSSDocumentRule.prototype = new CSSOM.CSSRule();
|
||||
CSSOM.CSSDocumentRule.prototype.constructor = CSSOM.CSSDocumentRule;
|
||||
CSSOM.CSSDocumentRule.prototype.type = 10;
|
||||
//FIXME
|
||||
//CSSOM.CSSDocumentRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
||||
//CSSOM.CSSDocumentRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
||||
|
||||
Object.defineProperty(CSSOM.CSSDocumentRule.prototype, "cssText", {
|
||||
get: function() {
|
||||
var cssTexts = [];
|
||||
for (var i=0, length=this.cssRules.length; i < length; i++) {
|
||||
cssTexts.push(this.cssRules[i].cssText);
|
||||
}
|
||||
return "@-moz-document " + this.matcher.matcherText + " {" + cssTexts.join("") + "}";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSDocumentRule = CSSOM.CSSDocumentRule;
|
||||
///CommonJS
|
36
node_modules/cssstyle/node_modules/cssom/lib/CSSFontFaceRule.js
generated
vendored
Normal file
36
node_modules/cssstyle/node_modules/cssom/lib/CSSFontFaceRule.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSStyleDeclaration: require("./CSSStyleDeclaration").CSSStyleDeclaration,
|
||||
CSSRule: require("./CSSRule").CSSRule
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://dev.w3.org/csswg/cssom/#css-font-face-rule
|
||||
*/
|
||||
CSSOM.CSSFontFaceRule = function CSSFontFaceRule() {
|
||||
CSSOM.CSSRule.call(this);
|
||||
this.style = new CSSOM.CSSStyleDeclaration();
|
||||
this.style.parentRule = this;
|
||||
};
|
||||
|
||||
CSSOM.CSSFontFaceRule.prototype = new CSSOM.CSSRule();
|
||||
CSSOM.CSSFontFaceRule.prototype.constructor = CSSOM.CSSFontFaceRule;
|
||||
CSSOM.CSSFontFaceRule.prototype.type = 5;
|
||||
//FIXME
|
||||
//CSSOM.CSSFontFaceRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
||||
//CSSOM.CSSFontFaceRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
||||
|
||||
// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSFontFaceRule.cpp
|
||||
Object.defineProperty(CSSOM.CSSFontFaceRule.prototype, "cssText", {
|
||||
get: function() {
|
||||
return "@font-face {" + this.style.cssText + "}";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSFontFaceRule = CSSOM.CSSFontFaceRule;
|
||||
///CommonJS
|
37
node_modules/cssstyle/node_modules/cssom/lib/CSSHostRule.js
generated
vendored
Normal file
37
node_modules/cssstyle/node_modules/cssom/lib/CSSHostRule.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSRule: require("./CSSRule").CSSRule
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://www.w3.org/TR/shadow-dom/#host-at-rule
|
||||
*/
|
||||
CSSOM.CSSHostRule = function CSSHostRule() {
|
||||
CSSOM.CSSRule.call(this);
|
||||
this.cssRules = [];
|
||||
};
|
||||
|
||||
CSSOM.CSSHostRule.prototype = new CSSOM.CSSRule();
|
||||
CSSOM.CSSHostRule.prototype.constructor = CSSOM.CSSHostRule;
|
||||
CSSOM.CSSHostRule.prototype.type = 1001;
|
||||
//FIXME
|
||||
//CSSOM.CSSHostRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
||||
//CSSOM.CSSHostRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
||||
|
||||
Object.defineProperty(CSSOM.CSSHostRule.prototype, "cssText", {
|
||||
get: function() {
|
||||
var cssTexts = [];
|
||||
for (var i=0, length=this.cssRules.length; i < length; i++) {
|
||||
cssTexts.push(this.cssRules[i].cssText);
|
||||
}
|
||||
return "@host {" + cssTexts.join("") + "}";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSHostRule = CSSOM.CSSHostRule;
|
||||
///CommonJS
|
132
node_modules/cssstyle/node_modules/cssom/lib/CSSImportRule.js
generated
vendored
Normal file
132
node_modules/cssstyle/node_modules/cssom/lib/CSSImportRule.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSRule: require("./CSSRule").CSSRule,
|
||||
CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet,
|
||||
MediaList: require("./MediaList").MediaList
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://dev.w3.org/csswg/cssom/#cssimportrule
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSImportRule
|
||||
*/
|
||||
CSSOM.CSSImportRule = function CSSImportRule() {
|
||||
CSSOM.CSSRule.call(this);
|
||||
this.href = "";
|
||||
this.media = new CSSOM.MediaList();
|
||||
this.styleSheet = new CSSOM.CSSStyleSheet();
|
||||
};
|
||||
|
||||
CSSOM.CSSImportRule.prototype = new CSSOM.CSSRule();
|
||||
CSSOM.CSSImportRule.prototype.constructor = CSSOM.CSSImportRule;
|
||||
CSSOM.CSSImportRule.prototype.type = 3;
|
||||
|
||||
Object.defineProperty(CSSOM.CSSImportRule.prototype, "cssText", {
|
||||
get: function() {
|
||||
var mediaText = this.media.mediaText;
|
||||
return "@import url(" + this.href + ")" + (mediaText ? " " + mediaText : "") + ";";
|
||||
},
|
||||
set: function(cssText) {
|
||||
var i = 0;
|
||||
|
||||
/**
|
||||
* @import url(partial.css) screen, handheld;
|
||||
* || |
|
||||
* after-import media
|
||||
* |
|
||||
* url
|
||||
*/
|
||||
var state = '';
|
||||
|
||||
var buffer = '';
|
||||
var index;
|
||||
for (var character; (character = cssText.charAt(i)); i++) {
|
||||
|
||||
switch (character) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
case '\f':
|
||||
if (state === 'after-import') {
|
||||
state = 'url';
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case '@':
|
||||
if (!state && cssText.indexOf('@import', i) === i) {
|
||||
state = 'after-import';
|
||||
i += 'import'.length;
|
||||
buffer = '';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
if (state === 'url' && cssText.indexOf('url(', i) === i) {
|
||||
index = cssText.indexOf(')', i + 1);
|
||||
if (index === -1) {
|
||||
throw i + ': ")" not found';
|
||||
}
|
||||
i += 'url('.length;
|
||||
var url = cssText.slice(i, index);
|
||||
if (url[0] === url[url.length - 1]) {
|
||||
if (url[0] === '"' || url[0] === "'") {
|
||||
url = url.slice(1, -1);
|
||||
}
|
||||
}
|
||||
this.href = url;
|
||||
i = index;
|
||||
state = 'media';
|
||||
}
|
||||
break;
|
||||
|
||||
case '"':
|
||||
if (state === 'url') {
|
||||
index = cssText.indexOf('"', i + 1);
|
||||
if (!index) {
|
||||
throw i + ": '\"' not found";
|
||||
}
|
||||
this.href = cssText.slice(i + 1, index);
|
||||
i = index;
|
||||
state = 'media';
|
||||
}
|
||||
break;
|
||||
|
||||
case "'":
|
||||
if (state === 'url') {
|
||||
index = cssText.indexOf("'", i + 1);
|
||||
if (!index) {
|
||||
throw i + ': "\'" not found';
|
||||
}
|
||||
this.href = cssText.slice(i + 1, index);
|
||||
i = index;
|
||||
state = 'media';
|
||||
}
|
||||
break;
|
||||
|
||||
case ';':
|
||||
if (state === 'media') {
|
||||
if (buffer) {
|
||||
this.media.mediaText = buffer.trim();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (state === 'media') {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSImportRule = CSSOM.CSSImportRule;
|
||||
///CommonJS
|
37
node_modules/cssstyle/node_modules/cssom/lib/CSSKeyframeRule.js
generated
vendored
Normal file
37
node_modules/cssstyle/node_modules/cssom/lib/CSSKeyframeRule.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSRule: require("./CSSRule").CSSRule,
|
||||
CSSStyleDeclaration: require('./CSSStyleDeclaration').CSSStyleDeclaration
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframeRule
|
||||
*/
|
||||
CSSOM.CSSKeyframeRule = function CSSKeyframeRule() {
|
||||
CSSOM.CSSRule.call(this);
|
||||
this.keyText = '';
|
||||
this.style = new CSSOM.CSSStyleDeclaration();
|
||||
this.style.parentRule = this;
|
||||
};
|
||||
|
||||
CSSOM.CSSKeyframeRule.prototype = new CSSOM.CSSRule();
|
||||
CSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule;
|
||||
CSSOM.CSSKeyframeRule.prototype.type = 9;
|
||||
//FIXME
|
||||
//CSSOM.CSSKeyframeRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
||||
//CSSOM.CSSKeyframeRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
||||
|
||||
// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframeRule.cpp
|
||||
Object.defineProperty(CSSOM.CSSKeyframeRule.prototype, "cssText", {
|
||||
get: function() {
|
||||
return this.keyText + " {" + this.style.cssText + "} ";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSKeyframeRule = CSSOM.CSSKeyframeRule;
|
||||
///CommonJS
|
39
node_modules/cssstyle/node_modules/cssom/lib/CSSKeyframesRule.js
generated
vendored
Normal file
39
node_modules/cssstyle/node_modules/cssom/lib/CSSKeyframesRule.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSRule: require("./CSSRule").CSSRule
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframesRule
|
||||
*/
|
||||
CSSOM.CSSKeyframesRule = function CSSKeyframesRule() {
|
||||
CSSOM.CSSRule.call(this);
|
||||
this.name = '';
|
||||
this.cssRules = [];
|
||||
};
|
||||
|
||||
CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule();
|
||||
CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;
|
||||
CSSOM.CSSKeyframesRule.prototype.type = 8;
|
||||
//FIXME
|
||||
//CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
||||
//CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
||||
|
||||
// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframesRule.cpp
|
||||
Object.defineProperty(CSSOM.CSSKeyframesRule.prototype, "cssText", {
|
||||
get: function() {
|
||||
var cssTexts = [];
|
||||
for (var i=0, length=this.cssRules.length; i < length; i++) {
|
||||
cssTexts.push(" " + this.cssRules[i].cssText);
|
||||
}
|
||||
return "@" + (this._vendorPrefix || '') + "keyframes " + this.name + " { \n" + cssTexts.join("\n") + "\n}";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSKeyframesRule = CSSOM.CSSKeyframesRule;
|
||||
///CommonJS
|
41
node_modules/cssstyle/node_modules/cssom/lib/CSSMediaRule.js
generated
vendored
Normal file
41
node_modules/cssstyle/node_modules/cssom/lib/CSSMediaRule.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSRule: require("./CSSRule").CSSRule,
|
||||
MediaList: require("./MediaList").MediaList
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://dev.w3.org/csswg/cssom/#cssmediarule
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule
|
||||
*/
|
||||
CSSOM.CSSMediaRule = function CSSMediaRule() {
|
||||
CSSOM.CSSRule.call(this);
|
||||
this.media = new CSSOM.MediaList();
|
||||
this.cssRules = [];
|
||||
};
|
||||
|
||||
CSSOM.CSSMediaRule.prototype = new CSSOM.CSSRule();
|
||||
CSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule;
|
||||
CSSOM.CSSMediaRule.prototype.type = 4;
|
||||
//FIXME
|
||||
//CSSOM.CSSMediaRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
||||
//CSSOM.CSSMediaRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
||||
|
||||
// http://opensource.apple.com/source/WebCore/WebCore-658.28/css/CSSMediaRule.cpp
|
||||
Object.defineProperty(CSSOM.CSSMediaRule.prototype, "cssText", {
|
||||
get: function() {
|
||||
var cssTexts = [];
|
||||
for (var i=0, length=this.cssRules.length; i < length; i++) {
|
||||
cssTexts.push(this.cssRules[i].cssText);
|
||||
}
|
||||
return "@media " + this.media.mediaText + " {" + cssTexts.join("") + "}";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSMediaRule = CSSOM.CSSMediaRule;
|
||||
///CommonJS
|
3
node_modules/cssstyle/node_modules/cssom/lib/CSSOM.js
generated
vendored
Normal file
3
node_modules/cssstyle/node_modules/cssom/lib/CSSOM.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var CSSOM = {};
|
||||
|
||||
|
43
node_modules/cssstyle/node_modules/cssom/lib/CSSRule.js
generated
vendored
Normal file
43
node_modules/cssstyle/node_modules/cssom/lib/CSSRule.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://dev.w3.org/csswg/cssom/#the-cssrule-interface
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRule
|
||||
*/
|
||||
CSSOM.CSSRule = function CSSRule() {
|
||||
this.parentRule = null;
|
||||
this.parentStyleSheet = null;
|
||||
};
|
||||
|
||||
CSSOM.CSSRule.UNKNOWN_RULE = 0; // obsolete
|
||||
CSSOM.CSSRule.STYLE_RULE = 1;
|
||||
CSSOM.CSSRule.CHARSET_RULE = 2; // obsolete
|
||||
CSSOM.CSSRule.IMPORT_RULE = 3;
|
||||
CSSOM.CSSRule.MEDIA_RULE = 4;
|
||||
CSSOM.CSSRule.FONT_FACE_RULE = 5;
|
||||
CSSOM.CSSRule.PAGE_RULE = 6;
|
||||
CSSOM.CSSRule.KEYFRAMES_RULE = 7;
|
||||
CSSOM.CSSRule.KEYFRAME_RULE = 8;
|
||||
CSSOM.CSSRule.MARGIN_RULE = 9;
|
||||
CSSOM.CSSRule.NAMESPACE_RULE = 10;
|
||||
CSSOM.CSSRule.COUNTER_STYLE_RULE = 11;
|
||||
CSSOM.CSSRule.SUPPORTS_RULE = 12;
|
||||
CSSOM.CSSRule.DOCUMENT_RULE = 13;
|
||||
CSSOM.CSSRule.FONT_FEATURE_VALUES_RULE = 14;
|
||||
CSSOM.CSSRule.VIEWPORT_RULE = 15;
|
||||
CSSOM.CSSRule.REGION_STYLE_RULE = 16;
|
||||
|
||||
|
||||
CSSOM.CSSRule.prototype = {
|
||||
constructor: CSSOM.CSSRule
|
||||
//FIXME
|
||||
};
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSRule = CSSOM.CSSRule;
|
||||
///CommonJS
|
148
node_modules/cssstyle/node_modules/cssom/lib/CSSStyleDeclaration.js
generated
vendored
Normal file
148
node_modules/cssstyle/node_modules/cssom/lib/CSSStyleDeclaration.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration
|
||||
*/
|
||||
CSSOM.CSSStyleDeclaration = function CSSStyleDeclaration(){
|
||||
this.length = 0;
|
||||
this.parentRule = null;
|
||||
|
||||
// NON-STANDARD
|
||||
this._importants = {};
|
||||
};
|
||||
|
||||
|
||||
CSSOM.CSSStyleDeclaration.prototype = {
|
||||
|
||||
constructor: CSSOM.CSSStyleDeclaration,
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} name
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyValue
|
||||
* @return {string} the value of the property if it has been explicitly set for this declaration block.
|
||||
* Returns the empty string if the property has not been set.
|
||||
*/
|
||||
getPropertyValue: function(name) {
|
||||
return this[name] || "";
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {string} value
|
||||
* @param {string} [priority=null] "important" or null
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty
|
||||
*/
|
||||
setProperty: function(name, value, priority) {
|
||||
if (this[name]) {
|
||||
// Property already exist. Overwrite it.
|
||||
var index = Array.prototype.indexOf.call(this, name);
|
||||
if (index < 0) {
|
||||
this[this.length] = name;
|
||||
this.length++;
|
||||
}
|
||||
} else {
|
||||
// New property.
|
||||
this[this.length] = name;
|
||||
this.length++;
|
||||
}
|
||||
this[name] = value + "";
|
||||
this._importants[name] = priority;
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} name
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-removeProperty
|
||||
* @return {string} the value of the property if it has been explicitly set for this declaration block.
|
||||
* Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property.
|
||||
*/
|
||||
removeProperty: function(name) {
|
||||
if (!(name in this)) {
|
||||
return "";
|
||||
}
|
||||
var index = Array.prototype.indexOf.call(this, name);
|
||||
if (index < 0) {
|
||||
return "";
|
||||
}
|
||||
var prevValue = this[name];
|
||||
this[name] = "";
|
||||
|
||||
// That's what WebKit and Opera do
|
||||
Array.prototype.splice.call(this, index, 1);
|
||||
|
||||
// That's what Firefox does
|
||||
//this[index] = ""
|
||||
|
||||
return prevValue;
|
||||
},
|
||||
|
||||
getPropertyCSSValue: function() {
|
||||
//FIXME
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} name
|
||||
*/
|
||||
getPropertyPriority: function(name) {
|
||||
return this._importants[name] || "";
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* element.style.overflow = "auto"
|
||||
* element.style.getPropertyShorthand("overflow-x")
|
||||
* -> "overflow"
|
||||
*/
|
||||
getPropertyShorthand: function() {
|
||||
//FIXME
|
||||
},
|
||||
|
||||
isPropertyImplicit: function() {
|
||||
//FIXME
|
||||
},
|
||||
|
||||
// Doesn't work in IE < 9
|
||||
get cssText(){
|
||||
var properties = [];
|
||||
for (var i=0, length=this.length; i < length; ++i) {
|
||||
var name = this[i];
|
||||
var value = this.getPropertyValue(name);
|
||||
var priority = this.getPropertyPriority(name);
|
||||
if (priority) {
|
||||
priority = " !" + priority;
|
||||
}
|
||||
properties[i] = name + ": " + value + priority + ";";
|
||||
}
|
||||
return properties.join(" ");
|
||||
},
|
||||
|
||||
set cssText(text){
|
||||
var i, name;
|
||||
for (i = this.length; i--;) {
|
||||
name = this[i];
|
||||
this[name] = "";
|
||||
}
|
||||
Array.prototype.splice.call(this, 0, this.length);
|
||||
this._importants = {};
|
||||
|
||||
var dummyRule = CSSOM.parse('#bogus{' + text + '}').cssRules[0].style;
|
||||
var length = dummyRule.length;
|
||||
for (i = 0; i < length; ++i) {
|
||||
name = dummyRule[i];
|
||||
this.setProperty(dummyRule[i], dummyRule.getPropertyValue(name), dummyRule.getPropertyPriority(name));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSStyleDeclaration = CSSOM.CSSStyleDeclaration;
|
||||
CSSOM.parse = require('./parse').parse; // Cannot be included sooner due to the mutual dependency between parse.js and CSSStyleDeclaration.js
|
||||
///CommonJS
|
190
node_modules/cssstyle/node_modules/cssom/lib/CSSStyleRule.js
generated
vendored
Normal file
190
node_modules/cssstyle/node_modules/cssom/lib/CSSStyleRule.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSStyleDeclaration: require("./CSSStyleDeclaration").CSSStyleDeclaration,
|
||||
CSSRule: require("./CSSRule").CSSRule
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://dev.w3.org/csswg/cssom/#cssstylerule
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleRule
|
||||
*/
|
||||
CSSOM.CSSStyleRule = function CSSStyleRule() {
|
||||
CSSOM.CSSRule.call(this);
|
||||
this.selectorText = "";
|
||||
this.style = new CSSOM.CSSStyleDeclaration();
|
||||
this.style.parentRule = this;
|
||||
};
|
||||
|
||||
CSSOM.CSSStyleRule.prototype = new CSSOM.CSSRule();
|
||||
CSSOM.CSSStyleRule.prototype.constructor = CSSOM.CSSStyleRule;
|
||||
CSSOM.CSSStyleRule.prototype.type = 1;
|
||||
|
||||
Object.defineProperty(CSSOM.CSSStyleRule.prototype, "cssText", {
|
||||
get: function() {
|
||||
var text;
|
||||
if (this.selectorText) {
|
||||
text = this.selectorText + " {" + this.style.cssText + "}";
|
||||
} else {
|
||||
text = "";
|
||||
}
|
||||
return text;
|
||||
},
|
||||
set: function(cssText) {
|
||||
var rule = CSSOM.CSSStyleRule.parse(cssText);
|
||||
this.style = rule.style;
|
||||
this.selectorText = rule.selectorText;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* NON-STANDARD
|
||||
* lightweight version of parse.js.
|
||||
* @param {string} ruleText
|
||||
* @return CSSStyleRule
|
||||
*/
|
||||
CSSOM.CSSStyleRule.parse = function(ruleText) {
|
||||
var i = 0;
|
||||
var state = "selector";
|
||||
var index;
|
||||
var j = i;
|
||||
var buffer = "";
|
||||
|
||||
var SIGNIFICANT_WHITESPACE = {
|
||||
"selector": true,
|
||||
"value": true
|
||||
};
|
||||
|
||||
var styleRule = new CSSOM.CSSStyleRule();
|
||||
var name, priority="";
|
||||
|
||||
for (var character; (character = ruleText.charAt(i)); i++) {
|
||||
|
||||
switch (character) {
|
||||
|
||||
case " ":
|
||||
case "\t":
|
||||
case "\r":
|
||||
case "\n":
|
||||
case "\f":
|
||||
if (SIGNIFICANT_WHITESPACE[state]) {
|
||||
// Squash 2 or more white-spaces in the row into 1
|
||||
switch (ruleText.charAt(i - 1)) {
|
||||
case " ":
|
||||
case "\t":
|
||||
case "\r":
|
||||
case "\n":
|
||||
case "\f":
|
||||
break;
|
||||
default:
|
||||
buffer += " ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// String
|
||||
case '"':
|
||||
j = i + 1;
|
||||
index = ruleText.indexOf('"', j) + 1;
|
||||
if (!index) {
|
||||
throw '" is missing';
|
||||
}
|
||||
buffer += ruleText.slice(i, index);
|
||||
i = index - 1;
|
||||
break;
|
||||
|
||||
case "'":
|
||||
j = i + 1;
|
||||
index = ruleText.indexOf("'", j) + 1;
|
||||
if (!index) {
|
||||
throw "' is missing";
|
||||
}
|
||||
buffer += ruleText.slice(i, index);
|
||||
i = index - 1;
|
||||
break;
|
||||
|
||||
// Comment
|
||||
case "/":
|
||||
if (ruleText.charAt(i + 1) === "*") {
|
||||
i += 2;
|
||||
index = ruleText.indexOf("*/", i);
|
||||
if (index === -1) {
|
||||
throw new SyntaxError("Missing */");
|
||||
} else {
|
||||
i = index + 1;
|
||||
}
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case "{":
|
||||
if (state === "selector") {
|
||||
styleRule.selectorText = buffer.trim();
|
||||
buffer = "";
|
||||
state = "name";
|
||||
}
|
||||
break;
|
||||
|
||||
case ":":
|
||||
if (state === "name") {
|
||||
name = buffer.trim();
|
||||
buffer = "";
|
||||
state = "value";
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case "!":
|
||||
if (state === "value" && ruleText.indexOf("!important", i) === i) {
|
||||
priority = "important";
|
||||
i += "important".length;
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case ";":
|
||||
if (state === "value") {
|
||||
styleRule.style.setProperty(name, buffer.trim(), priority);
|
||||
priority = "";
|
||||
buffer = "";
|
||||
state = "name";
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case "}":
|
||||
if (state === "value") {
|
||||
styleRule.style.setProperty(name, buffer.trim(), priority);
|
||||
priority = "";
|
||||
buffer = "";
|
||||
} else if (state === "name") {
|
||||
break;
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
state = "selector";
|
||||
break;
|
||||
|
||||
default:
|
||||
buffer += character;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return styleRule;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSStyleRule = CSSOM.CSSStyleRule;
|
||||
///CommonJS
|
88
node_modules/cssstyle/node_modules/cssom/lib/CSSStyleSheet.js
generated
vendored
Normal file
88
node_modules/cssstyle/node_modules/cssom/lib/CSSStyleSheet.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
StyleSheet: require("./StyleSheet").StyleSheet,
|
||||
CSSStyleRule: require("./CSSStyleRule").CSSStyleRule
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet
|
||||
*/
|
||||
CSSOM.CSSStyleSheet = function CSSStyleSheet() {
|
||||
CSSOM.StyleSheet.call(this);
|
||||
this.cssRules = [];
|
||||
};
|
||||
|
||||
|
||||
CSSOM.CSSStyleSheet.prototype = new CSSOM.StyleSheet();
|
||||
CSSOM.CSSStyleSheet.prototype.constructor = CSSOM.CSSStyleSheet;
|
||||
|
||||
|
||||
/**
|
||||
* Used to insert a new rule into the style sheet. The new rule now becomes part of the cascade.
|
||||
*
|
||||
* sheet = new Sheet("body {margin: 0}")
|
||||
* sheet.toString()
|
||||
* -> "body{margin:0;}"
|
||||
* sheet.insertRule("img {border: none}", 0)
|
||||
* -> 0
|
||||
* sheet.toString()
|
||||
* -> "img{border:none;}body{margin:0;}"
|
||||
*
|
||||
* @param {string} rule
|
||||
* @param {number} index
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-insertRule
|
||||
* @return {number} The index within the style sheet's rule collection of the newly inserted rule.
|
||||
*/
|
||||
CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
||||
if (index < 0 || index > this.cssRules.length) {
|
||||
throw new RangeError("INDEX_SIZE_ERR");
|
||||
}
|
||||
var cssRule = CSSOM.parse(rule).cssRules[0];
|
||||
cssRule.parentStyleSheet = this;
|
||||
this.cssRules.splice(index, 0, cssRule);
|
||||
return index;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Used to delete a rule from the style sheet.
|
||||
*
|
||||
* sheet = new Sheet("img{border:none} body{margin:0}")
|
||||
* sheet.toString()
|
||||
* -> "img{border:none;}body{margin:0;}"
|
||||
* sheet.deleteRule(0)
|
||||
* sheet.toString()
|
||||
* -> "body{margin:0;}"
|
||||
*
|
||||
* @param {number} index within the style sheet's rule list of the rule to remove.
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-deleteRule
|
||||
*/
|
||||
CSSOM.CSSStyleSheet.prototype.deleteRule = function(index) {
|
||||
if (index < 0 || index >= this.cssRules.length) {
|
||||
throw new RangeError("INDEX_SIZE_ERR");
|
||||
}
|
||||
this.cssRules.splice(index, 1);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* NON-STANDARD
|
||||
* @return {string} serialize stylesheet
|
||||
*/
|
||||
CSSOM.CSSStyleSheet.prototype.toString = function() {
|
||||
var result = "";
|
||||
var rules = this.cssRules;
|
||||
for (var i=0; i<rules.length; i++) {
|
||||
result += rules[i].cssText + "\n";
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSStyleSheet = CSSOM.CSSStyleSheet;
|
||||
CSSOM.parse = require('./parse').parse; // Cannot be included sooner due to the mutual dependency between parse.js and CSSStyleSheet.js
|
||||
///CommonJS
|
36
node_modules/cssstyle/node_modules/cssom/lib/CSSSupportsRule.js
generated
vendored
Normal file
36
node_modules/cssstyle/node_modules/cssom/lib/CSSSupportsRule.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSRule: require("./CSSRule").CSSRule,
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface
|
||||
*/
|
||||
CSSOM.CSSSupportsRule = function CSSSupportsRule() {
|
||||
CSSOM.CSSRule.call(this);
|
||||
this.conditionText = '';
|
||||
this.cssRules = [];
|
||||
};
|
||||
|
||||
CSSOM.CSSSupportsRule.prototype = new CSSOM.CSSRule();
|
||||
CSSOM.CSSSupportsRule.prototype.constructor = CSSOM.CSSSupportsRule;
|
||||
CSSOM.CSSSupportsRule.prototype.type = 12;
|
||||
|
||||
Object.defineProperty(CSSOM.CSSSupportsRule.prototype, "cssText", {
|
||||
get: function() {
|
||||
var cssTexts = [];
|
||||
|
||||
for (var i = 0, length = this.cssRules.length; i < length; i++) {
|
||||
cssTexts.push(this.cssRules[i].cssText);
|
||||
}
|
||||
|
||||
return "@supports " + this.conditionText + " {" + cssTexts.join("") + "}";
|
||||
}
|
||||
});
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSSupportsRule = CSSOM.CSSSupportsRule;
|
||||
///CommonJS
|
43
node_modules/cssstyle/node_modules/cssom/lib/CSSValue.js
generated
vendored
Normal file
43
node_modules/cssstyle/node_modules/cssom/lib/CSSValue.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue
|
||||
*
|
||||
* TODO: add if needed
|
||||
*/
|
||||
CSSOM.CSSValue = function CSSValue() {
|
||||
};
|
||||
|
||||
CSSOM.CSSValue.prototype = {
|
||||
constructor: CSSOM.CSSValue,
|
||||
|
||||
// @see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue
|
||||
set cssText(text) {
|
||||
var name = this._getConstructorName();
|
||||
|
||||
throw new Error('DOMException: property "cssText" of "' + name + '" is readonly and can not be replaced with "' + text + '"!');
|
||||
},
|
||||
|
||||
get cssText() {
|
||||
var name = this._getConstructorName();
|
||||
|
||||
throw new Error('getter "cssText" of "' + name + '" is not implemented!');
|
||||
},
|
||||
|
||||
_getConstructorName: function() {
|
||||
var s = this.constructor.toString(),
|
||||
c = s.match(/function\s([^\(]+)/),
|
||||
name = c[1];
|
||||
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSValue = CSSOM.CSSValue;
|
||||
///CommonJS
|
344
node_modules/cssstyle/node_modules/cssom/lib/CSSValueExpression.js
generated
vendored
Normal file
344
node_modules/cssstyle/node_modules/cssom/lib/CSSValueExpression.js
generated
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSValue: require('./CSSValue').CSSValue
|
||||
};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://msdn.microsoft.com/en-us/library/ms537634(v=vs.85).aspx
|
||||
*
|
||||
*/
|
||||
CSSOM.CSSValueExpression = function CSSValueExpression(token, idx) {
|
||||
this._token = token;
|
||||
this._idx = idx;
|
||||
};
|
||||
|
||||
CSSOM.CSSValueExpression.prototype = new CSSOM.CSSValue();
|
||||
CSSOM.CSSValueExpression.prototype.constructor = CSSOM.CSSValueExpression;
|
||||
|
||||
/**
|
||||
* parse css expression() value
|
||||
*
|
||||
* @return {Object}
|
||||
* - error:
|
||||
* or
|
||||
* - idx:
|
||||
* - expression:
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* .selector {
|
||||
* zoom: expression(documentElement.clientWidth > 1000 ? '1000px' : 'auto');
|
||||
* }
|
||||
*/
|
||||
CSSOM.CSSValueExpression.prototype.parse = function() {
|
||||
var token = this._token,
|
||||
idx = this._idx;
|
||||
|
||||
var character = '',
|
||||
expression = '',
|
||||
error = '',
|
||||
info,
|
||||
paren = [];
|
||||
|
||||
|
||||
for (; ; ++idx) {
|
||||
character = token.charAt(idx);
|
||||
|
||||
// end of token
|
||||
if (character === '') {
|
||||
error = 'css expression error: unfinished expression!';
|
||||
break;
|
||||
}
|
||||
|
||||
switch(character) {
|
||||
case '(':
|
||||
paren.push(character);
|
||||
expression += character;
|
||||
break;
|
||||
|
||||
case ')':
|
||||
paren.pop(character);
|
||||
expression += character;
|
||||
break;
|
||||
|
||||
case '/':
|
||||
if ((info = this._parseJSComment(token, idx))) { // comment?
|
||||
if (info.error) {
|
||||
error = 'css expression error: unfinished comment in expression!';
|
||||
} else {
|
||||
idx = info.idx;
|
||||
// ignore the comment
|
||||
}
|
||||
} else if ((info = this._parseJSRexExp(token, idx))) { // regexp
|
||||
idx = info.idx;
|
||||
expression += info.text;
|
||||
} else { // other
|
||||
expression += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case "'":
|
||||
case '"':
|
||||
info = this._parseJSString(token, idx, character);
|
||||
if (info) { // string
|
||||
idx = info.idx;
|
||||
expression += info.text;
|
||||
} else {
|
||||
expression += character;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
expression += character;
|
||||
break;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
break;
|
||||
}
|
||||
|
||||
// end of expression
|
||||
if (paren.length === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var ret;
|
||||
if (error) {
|
||||
ret = {
|
||||
error: error
|
||||
};
|
||||
} else {
|
||||
ret = {
|
||||
idx: idx,
|
||||
expression: expression
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Object|false}
|
||||
* - idx:
|
||||
* - text:
|
||||
* or
|
||||
* - error:
|
||||
* or
|
||||
* false
|
||||
*
|
||||
*/
|
||||
CSSOM.CSSValueExpression.prototype._parseJSComment = function(token, idx) {
|
||||
var nextChar = token.charAt(idx + 1),
|
||||
text;
|
||||
|
||||
if (nextChar === '/' || nextChar === '*') {
|
||||
var startIdx = idx,
|
||||
endIdx,
|
||||
commentEndChar;
|
||||
|
||||
if (nextChar === '/') { // line comment
|
||||
commentEndChar = '\n';
|
||||
} else if (nextChar === '*') { // block comment
|
||||
commentEndChar = '*/';
|
||||
}
|
||||
|
||||
endIdx = token.indexOf(commentEndChar, startIdx + 1 + 1);
|
||||
if (endIdx !== -1) {
|
||||
endIdx = endIdx + commentEndChar.length - 1;
|
||||
text = token.substring(idx, endIdx + 1);
|
||||
return {
|
||||
idx: endIdx,
|
||||
text: text
|
||||
};
|
||||
} else {
|
||||
var error = 'css expression error: unfinished comment in expression!';
|
||||
return {
|
||||
error: error
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Object|false}
|
||||
* - idx:
|
||||
* - text:
|
||||
* or
|
||||
* false
|
||||
*
|
||||
*/
|
||||
CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx, sep) {
|
||||
var endIdx = this._findMatchedIdx(token, idx, sep),
|
||||
text;
|
||||
|
||||
if (endIdx === -1) {
|
||||
return false;
|
||||
} else {
|
||||
text = token.substring(idx, endIdx + sep.length);
|
||||
|
||||
return {
|
||||
idx: endIdx,
|
||||
text: text
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* parse regexp in css expression
|
||||
*
|
||||
* @return {Object|false}
|
||||
* - idx:
|
||||
* - regExp:
|
||||
* or
|
||||
* false
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
all legal RegExp
|
||||
|
||||
/a/
|
||||
(/a/)
|
||||
[/a/]
|
||||
[12, /a/]
|
||||
|
||||
!/a/
|
||||
|
||||
+/a/
|
||||
-/a/
|
||||
* /a/
|
||||
/ /a/
|
||||
%/a/
|
||||
|
||||
===/a/
|
||||
!==/a/
|
||||
==/a/
|
||||
!=/a/
|
||||
>/a/
|
||||
>=/a/
|
||||
</a/
|
||||
<=/a/
|
||||
|
||||
&/a/
|
||||
|/a/
|
||||
^/a/
|
||||
~/a/
|
||||
<</a/
|
||||
>>/a/
|
||||
>>>/a/
|
||||
|
||||
&&/a/
|
||||
||/a/
|
||||
?/a/
|
||||
=/a/
|
||||
,/a/
|
||||
|
||||
delete /a/
|
||||
in /a/
|
||||
instanceof /a/
|
||||
new /a/
|
||||
typeof /a/
|
||||
void /a/
|
||||
|
||||
*/
|
||||
CSSOM.CSSValueExpression.prototype._parseJSRexExp = function(token, idx) {
|
||||
var before = token.substring(0, idx).replace(/\s+$/, ""),
|
||||
legalRegx = [
|
||||
/^$/,
|
||||
/\($/,
|
||||
/\[$/,
|
||||
/\!$/,
|
||||
/\+$/,
|
||||
/\-$/,
|
||||
/\*$/,
|
||||
/\/\s+/,
|
||||
/\%$/,
|
||||
/\=$/,
|
||||
/\>$/,
|
||||
/<$/,
|
||||
/\&$/,
|
||||
/\|$/,
|
||||
/\^$/,
|
||||
/\~$/,
|
||||
/\?$/,
|
||||
/\,$/,
|
||||
/delete$/,
|
||||
/in$/,
|
||||
/instanceof$/,
|
||||
/new$/,
|
||||
/typeof$/,
|
||||
/void$/
|
||||
];
|
||||
|
||||
var isLegal = legalRegx.some(function(reg) {
|
||||
return reg.test(before);
|
||||
});
|
||||
|
||||
if (!isLegal) {
|
||||
return false;
|
||||
} else {
|
||||
var sep = '/';
|
||||
|
||||
// same logic as string
|
||||
return this._parseJSString(token, idx, sep);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* find next sep(same line) index in `token`
|
||||
*
|
||||
* @return {Number}
|
||||
*
|
||||
*/
|
||||
CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep) {
|
||||
var startIdx = idx,
|
||||
endIdx;
|
||||
|
||||
var NOT_FOUND = -1;
|
||||
|
||||
while(true) {
|
||||
endIdx = token.indexOf(sep, startIdx + 1);
|
||||
|
||||
if (endIdx === -1) { // not found
|
||||
endIdx = NOT_FOUND;
|
||||
break;
|
||||
} else {
|
||||
var text = token.substring(idx + 1, endIdx),
|
||||
matched = text.match(/\\+$/);
|
||||
if (!matched || matched[0] % 2 === 0) { // not escaped
|
||||
break;
|
||||
} else {
|
||||
startIdx = endIdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// boundary must be in the same line(js sting or regexp)
|
||||
var nextNewLineIdx = token.indexOf('\n', idx + 1);
|
||||
if (nextNewLineIdx < endIdx) {
|
||||
endIdx = NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
return endIdx;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.CSSValueExpression = CSSOM.CSSValueExpression;
|
||||
///CommonJS
|
62
node_modules/cssstyle/node_modules/cssom/lib/MatcherList.js
generated
vendored
Normal file
62
node_modules/cssstyle/node_modules/cssom/lib/MatcherList.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developer.mozilla.org/en/CSS/@-moz-document
|
||||
*/
|
||||
CSSOM.MatcherList = function MatcherList(){
|
||||
this.length = 0;
|
||||
};
|
||||
|
||||
CSSOM.MatcherList.prototype = {
|
||||
|
||||
constructor: CSSOM.MatcherList,
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
get matcherText() {
|
||||
return Array.prototype.join.call(this, ", ");
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
set matcherText(value) {
|
||||
// just a temporary solution, actually it may be wrong by just split the value with ',', because a url can include ','.
|
||||
var values = value.split(",");
|
||||
var length = this.length = values.length;
|
||||
for (var i=0; i<length; i++) {
|
||||
this[i] = values[i].trim();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} matcher
|
||||
*/
|
||||
appendMatcher: function(matcher) {
|
||||
if (Array.prototype.indexOf.call(this, matcher) === -1) {
|
||||
this[this.length] = matcher;
|
||||
this.length++;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} matcher
|
||||
*/
|
||||
deleteMatcher: function(matcher) {
|
||||
var index = Array.prototype.indexOf.call(this, matcher);
|
||||
if (index !== -1) {
|
||||
Array.prototype.splice.call(this, index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.MatcherList = CSSOM.MatcherList;
|
||||
///CommonJS
|
61
node_modules/cssstyle/node_modules/cssom/lib/MediaList.js
generated
vendored
Normal file
61
node_modules/cssstyle/node_modules/cssom/lib/MediaList.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://dev.w3.org/csswg/cssom/#the-medialist-interface
|
||||
*/
|
||||
CSSOM.MediaList = function MediaList(){
|
||||
this.length = 0;
|
||||
};
|
||||
|
||||
CSSOM.MediaList.prototype = {
|
||||
|
||||
constructor: CSSOM.MediaList,
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
get mediaText() {
|
||||
return Array.prototype.join.call(this, ", ");
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
set mediaText(value) {
|
||||
var values = value.split(",");
|
||||
var length = this.length = values.length;
|
||||
for (var i=0; i<length; i++) {
|
||||
this[i] = values[i].trim();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} medium
|
||||
*/
|
||||
appendMedium: function(medium) {
|
||||
if (Array.prototype.indexOf.call(this, medium) === -1) {
|
||||
this[this.length] = medium;
|
||||
this.length++;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} medium
|
||||
*/
|
||||
deleteMedium: function(medium) {
|
||||
var index = Array.prototype.indexOf.call(this, medium);
|
||||
if (index !== -1) {
|
||||
Array.prototype.splice.call(this, index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.MediaList = CSSOM.MediaList;
|
||||
///CommonJS
|
17
node_modules/cssstyle/node_modules/cssom/lib/StyleSheet.js
generated
vendored
Normal file
17
node_modules/cssstyle/node_modules/cssom/lib/StyleSheet.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @see http://dev.w3.org/csswg/cssom/#the-stylesheet-interface
|
||||
*/
|
||||
CSSOM.StyleSheet = function StyleSheet() {
|
||||
this.parentStyleSheet = null;
|
||||
};
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.StyleSheet = CSSOM.StyleSheet;
|
||||
///CommonJS
|
82
node_modules/cssstyle/node_modules/cssom/lib/clone.js
generated
vendored
Normal file
82
node_modules/cssstyle/node_modules/cssom/lib/clone.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {
|
||||
CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet,
|
||||
CSSStyleRule: require("./CSSStyleRule").CSSStyleRule,
|
||||
CSSMediaRule: require("./CSSMediaRule").CSSMediaRule,
|
||||
CSSSupportsRule: require("./CSSSupportsRule").CSSSupportsRule,
|
||||
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.clone = 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,
|
||||
12: CSSOM.CSSSupportsRule
|
||||
};
|
||||
|
||||
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 (rule.hasOwnProperty('keyText')) {
|
||||
ruleClone.keyText = rule.keyText;
|
||||
}
|
||||
|
||||
if (rule.hasOwnProperty('selectorText')) {
|
||||
ruleClone.selectorText = rule.selectorText;
|
||||
}
|
||||
|
||||
if (rule.hasOwnProperty('mediaText')) {
|
||||
ruleClone.mediaText = rule.mediaText;
|
||||
}
|
||||
|
||||
if (rule.hasOwnProperty('conditionText')) {
|
||||
ruleClone.conditionText = rule.conditionText;
|
||||
}
|
||||
|
||||
if (rule.hasOwnProperty('cssRules')) {
|
||||
ruleClone.cssRules = clone(rule).cssRules;
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
|
||||
};
|
||||
|
||||
//.CommonJS
|
||||
exports.clone = CSSOM.clone;
|
||||
///CommonJS
|
21
node_modules/cssstyle/node_modules/cssom/lib/index.js
generated
vendored
Normal file
21
node_modules/cssstyle/node_modules/cssom/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
exports.CSSStyleDeclaration = require('./CSSStyleDeclaration').CSSStyleDeclaration;
|
||||
exports.CSSRule = require('./CSSRule').CSSRule;
|
||||
exports.CSSStyleRule = require('./CSSStyleRule').CSSStyleRule;
|
||||
exports.MediaList = require('./MediaList').MediaList;
|
||||
exports.CSSMediaRule = require('./CSSMediaRule').CSSMediaRule;
|
||||
exports.CSSSupportsRule = require('./CSSSupportsRule').CSSSupportsRule;
|
||||
exports.CSSImportRule = require('./CSSImportRule').CSSImportRule;
|
||||
exports.CSSFontFaceRule = require('./CSSFontFaceRule').CSSFontFaceRule;
|
||||
exports.CSSHostRule = require('./CSSHostRule').CSSHostRule;
|
||||
exports.StyleSheet = require('./StyleSheet').StyleSheet;
|
||||
exports.CSSStyleSheet = require('./CSSStyleSheet').CSSStyleSheet;
|
||||
exports.CSSKeyframesRule = require('./CSSKeyframesRule').CSSKeyframesRule;
|
||||
exports.CSSKeyframeRule = require('./CSSKeyframeRule').CSSKeyframeRule;
|
||||
exports.MatcherList = require('./MatcherList').MatcherList;
|
||||
exports.CSSDocumentRule = require('./CSSDocumentRule').CSSDocumentRule;
|
||||
exports.CSSValue = require('./CSSValue').CSSValue;
|
||||
exports.CSSValueExpression = require('./CSSValueExpression').CSSValueExpression;
|
||||
exports.parse = require('./parse').parse;
|
||||
exports.clone = require('./clone').clone;
|
464
node_modules/cssstyle/node_modules/cssom/lib/parse.js
generated
vendored
Normal file
464
node_modules/cssstyle/node_modules/cssom/lib/parse.js
generated
vendored
Normal file
@@ -0,0 +1,464 @@
|
||||
//.CommonJS
|
||||
var CSSOM = {};
|
||||
///CommonJS
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} token
|
||||
*/
|
||||
CSSOM.parse = function parse(token) {
|
||||
|
||||
var i = 0;
|
||||
|
||||
/**
|
||||
"before-selector" or
|
||||
"selector" or
|
||||
"atRule" or
|
||||
"atBlock" or
|
||||
"conditionBlock" or
|
||||
"before-name" or
|
||||
"name" or
|
||||
"before-value" or
|
||||
"value"
|
||||
*/
|
||||
var state = "before-selector";
|
||||
|
||||
var index;
|
||||
var buffer = "";
|
||||
var valueParenthesisDepth = 0;
|
||||
|
||||
var SIGNIFICANT_WHITESPACE = {
|
||||
"selector": true,
|
||||
"value": true,
|
||||
"value-parenthesis": true,
|
||||
"atRule": true,
|
||||
"importRule-begin": true,
|
||||
"importRule": true,
|
||||
"atBlock": true,
|
||||
"conditionBlock": true,
|
||||
'documentRule-begin': true
|
||||
};
|
||||
|
||||
var styleSheet = new CSSOM.CSSStyleSheet();
|
||||
|
||||
// @type CSSStyleSheet|CSSMediaRule|CSSSupportsRule|CSSFontFaceRule|CSSKeyframesRule|CSSDocumentRule
|
||||
var currentScope = styleSheet;
|
||||
|
||||
// @type CSSMediaRule|CSSSupportsRule|CSSKeyframesRule|CSSDocumentRule
|
||||
var parentRule;
|
||||
|
||||
var ancestorRules = [];
|
||||
var hasAncestors = false;
|
||||
var prevScope;
|
||||
|
||||
var name, priority="", styleRule, mediaRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule;
|
||||
|
||||
var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g;
|
||||
|
||||
var parseError = function(message) {
|
||||
var lines = token.substring(0, i).split('\n');
|
||||
var lineCount = lines.length;
|
||||
var charCount = lines.pop().length + 1;
|
||||
var error = new Error(message + ' (line ' + lineCount + ', char ' + charCount + ')');
|
||||
error.line = lineCount;
|
||||
/* jshint sub : true */
|
||||
error['char'] = charCount;
|
||||
error.styleSheet = styleSheet;
|
||||
throw error;
|
||||
};
|
||||
|
||||
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 '"':
|
||||
index = i + 1;
|
||||
do {
|
||||
index = token.indexOf('"', index) + 1;
|
||||
if (!index) {
|
||||
parseError('Unmatched "');
|
||||
}
|
||||
} while (token[index - 2] === '\\');
|
||||
buffer += token.slice(i, index);
|
||||
i = index - 1;
|
||||
switch (state) {
|
||||
case 'before-value':
|
||||
state = 'value';
|
||||
break;
|
||||
case 'importRule-begin':
|
||||
state = 'importRule';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "'":
|
||||
index = i + 1;
|
||||
do {
|
||||
index = token.indexOf("'", index) + 1;
|
||||
if (!index) {
|
||||
parseError("Unmatched '");
|
||||
}
|
||||
} while (token[index - 2] === '\\');
|
||||
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) {
|
||||
parseError("Missing */");
|
||||
} else {
|
||||
i = index + 1;
|
||||
}
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
if (state === "importRule-begin") {
|
||||
buffer += " ";
|
||||
state = "importRule";
|
||||
}
|
||||
break;
|
||||
|
||||
// At-rule
|
||||
case "@":
|
||||
if (token.indexOf("@-moz-document", i) === i) {
|
||||
state = "documentRule-begin";
|
||||
documentRule = new CSSOM.CSSDocumentRule();
|
||||
documentRule.__starts = i;
|
||||
i += "-moz-document".length;
|
||||
buffer = "";
|
||||
break;
|
||||
} else if (token.indexOf("@media", i) === i) {
|
||||
state = "atBlock";
|
||||
mediaRule = new CSSOM.CSSMediaRule();
|
||||
mediaRule.__starts = i;
|
||||
i += "media".length;
|
||||
buffer = "";
|
||||
break;
|
||||
} else if (token.indexOf("@supports", i) === i) {
|
||||
state = "conditionBlock";
|
||||
supportsRule = new CSSOM.CSSSupportsRule();
|
||||
supportsRule.__starts = i;
|
||||
i += "supports".length;
|
||||
buffer = "";
|
||||
break;
|
||||
} else if (token.indexOf("@host", i) === i) {
|
||||
state = "hostRule-begin";
|
||||
i += "host".length;
|
||||
hostRule = new CSSOM.CSSHostRule();
|
||||
hostRule.__starts = i;
|
||||
buffer = "";
|
||||
break;
|
||||
} else if (token.indexOf("@import", i) === i) {
|
||||
state = "importRule-begin";
|
||||
i += "import".length;
|
||||
buffer += "@import";
|
||||
break;
|
||||
} else if (token.indexOf("@font-face", i) === i) {
|
||||
state = "fontFaceRule-begin";
|
||||
i += "font-face".length;
|
||||
fontFaceRule = new CSSOM.CSSFontFaceRule();
|
||||
fontFaceRule.__starts = i;
|
||||
buffer = "";
|
||||
break;
|
||||
} else {
|
||||
atKeyframesRegExp.lastIndex = i;
|
||||
var matchKeyframes = atKeyframesRegExp.exec(token);
|
||||
if (matchKeyframes && matchKeyframes.index === i) {
|
||||
state = "keyframesRule-begin";
|
||||
keyframesRule = new CSSOM.CSSKeyframesRule();
|
||||
keyframesRule.__starts = i;
|
||||
keyframesRule._vendorPrefix = matchKeyframes[1]; // Will come out as undefined if no prefix was found
|
||||
i += matchKeyframes[0].length - 1;
|
||||
buffer = "";
|
||||
break;
|
||||
} else if (state === "selector") {
|
||||
state = "atRule";
|
||||
}
|
||||
}
|
||||
buffer += character;
|
||||
break;
|
||||
|
||||
case "{":
|
||||
if (state === "selector" || state === "atRule") {
|
||||
styleRule.selectorText = buffer.trim();
|
||||
styleRule.style.__starts = i;
|
||||
buffer = "";
|
||||
state = "before-name";
|
||||
} else if (state === "atBlock") {
|
||||
mediaRule.media.mediaText = buffer.trim();
|
||||
|
||||
if (parentRule) {
|
||||
ancestorRules.push(parentRule);
|
||||
}
|
||||
|
||||
currentScope = parentRule = mediaRule;
|
||||
mediaRule.parentStyleSheet = styleSheet;
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
} else if (state === "conditionBlock") {
|
||||
supportsRule.conditionText = buffer.trim();
|
||||
|
||||
if (parentRule) {
|
||||
ancestorRules.push(parentRule);
|
||||
}
|
||||
|
||||
currentScope = parentRule = supportsRule;
|
||||
supportsRule.parentStyleSheet = styleSheet;
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
} else if (state === "hostRule-begin") {
|
||||
if (parentRule) {
|
||||
ancestorRules.push(parentRule);
|
||||
}
|
||||
|
||||
currentScope = parentRule = hostRule;
|
||||
hostRule.parentStyleSheet = styleSheet;
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
} else if (state === "fontFaceRule-begin") {
|
||||
if (parentRule) {
|
||||
ancestorRules.push(parentRule);
|
||||
fontFaceRule.parentRule = parentRule;
|
||||
}
|
||||
fontFaceRule.parentStyleSheet = styleSheet;
|
||||
styleRule = fontFaceRule;
|
||||
buffer = "";
|
||||
state = "before-name";
|
||||
} else if (state === "keyframesRule-begin") {
|
||||
keyframesRule.name = buffer.trim();
|
||||
if (parentRule) {
|
||||
ancestorRules.push(parentRule);
|
||||
keyframesRule.parentRule = parentRule;
|
||||
}
|
||||
keyframesRule.parentStyleSheet = styleSheet;
|
||||
currentScope = parentRule = keyframesRule;
|
||||
buffer = "";
|
||||
state = "keyframeRule-begin";
|
||||
} else if (state === "keyframeRule-begin") {
|
||||
styleRule = new CSSOM.CSSKeyframeRule();
|
||||
styleRule.keyText = buffer.trim();
|
||||
styleRule.__starts = i;
|
||||
buffer = "";
|
||||
state = "before-name";
|
||||
} else if (state === "documentRule-begin") {
|
||||
// FIXME: what if this '{' is in the url text of the match function?
|
||||
documentRule.matcher.matcherText = buffer.trim();
|
||||
if (parentRule) {
|
||||
ancestorRules.push(parentRule);
|
||||
documentRule.parentRule = parentRule;
|
||||
}
|
||||
currentScope = parentRule = documentRule;
|
||||
documentRule.parentStyleSheet = styleSheet;
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
}
|
||||
break;
|
||||
|
||||
case ":":
|
||||
if (state === "name") {
|
||||
name = buffer.trim();
|
||||
buffer = "";
|
||||
state = "before-value";
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case "(":
|
||||
if (state === 'value') {
|
||||
// ie css expression mode
|
||||
if (buffer.trim() === 'expression') {
|
||||
var info = (new CSSOM.CSSValueExpression(token, i)).parse();
|
||||
|
||||
if (info.error) {
|
||||
parseError(info.error);
|
||||
} else {
|
||||
buffer += info.expression;
|
||||
i = info.idx;
|
||||
}
|
||||
} else {
|
||||
state = 'value-parenthesis';
|
||||
//always ensure this is reset to 1 on transition
|
||||
//from value to value-parenthesis
|
||||
valueParenthesisDepth = 1;
|
||||
buffer += character;
|
||||
}
|
||||
} else if (state === 'value-parenthesis') {
|
||||
valueParenthesisDepth++;
|
||||
buffer += character;
|
||||
} else {
|
||||
buffer += character;
|
||||
}
|
||||
break;
|
||||
|
||||
case ")":
|
||||
if (state === 'value-parenthesis') {
|
||||
valueParenthesisDepth--;
|
||||
if (valueParenthesisDepth === 0) state = 'value';
|
||||
}
|
||||
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":
|
||||
styleRule.style.setProperty(name, buffer.trim(), priority);
|
||||
priority = "";
|
||||
buffer = "";
|
||||
state = "before-name";
|
||||
break;
|
||||
case "atRule":
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
break;
|
||||
case "importRule":
|
||||
importRule = new CSSOM.CSSImportRule();
|
||||
importRule.parentStyleSheet = importRule.styleSheet.parentStyleSheet = styleSheet;
|
||||
importRule.cssText = buffer + character;
|
||||
styleSheet.cssRules.push(importRule);
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
break;
|
||||
default:
|
||||
buffer += character;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "}":
|
||||
switch (state) {
|
||||
case "value":
|
||||
styleRule.style.setProperty(name, buffer.trim(), priority);
|
||||
priority = "";
|
||||
/* falls through */
|
||||
case "before-name":
|
||||
case "name":
|
||||
styleRule.__ends = i + 1;
|
||||
if (parentRule) {
|
||||
styleRule.parentRule = parentRule;
|
||||
}
|
||||
styleRule.parentStyleSheet = styleSheet;
|
||||
currentScope.cssRules.push(styleRule);
|
||||
buffer = "";
|
||||
if (currentScope.constructor === CSSOM.CSSKeyframesRule) {
|
||||
state = "keyframeRule-begin";
|
||||
} else {
|
||||
state = "before-selector";
|
||||
}
|
||||
break;
|
||||
case "keyframeRule-begin":
|
||||
case "before-selector":
|
||||
case "selector":
|
||||
// End of media/supports/document rule.
|
||||
if (!parentRule) {
|
||||
parseError("Unexpected }");
|
||||
}
|
||||
|
||||
// Handle rules nested in @media or @supports
|
||||
hasAncestors = ancestorRules.length > 0;
|
||||
|
||||
while (ancestorRules.length > 0) {
|
||||
parentRule = ancestorRules.pop();
|
||||
|
||||
if (
|
||||
parentRule.constructor.name === "CSSMediaRule"
|
||||
|| parentRule.constructor.name === "CSSSupportsRule"
|
||||
) {
|
||||
prevScope = currentScope;
|
||||
currentScope = parentRule;
|
||||
currentScope.cssRules.push(prevScope);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ancestorRules.length === 0) {
|
||||
hasAncestors = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAncestors) {
|
||||
currentScope.__ends = i + 1;
|
||||
styleSheet.cssRules.push(currentScope);
|
||||
currentScope = styleSheet;
|
||||
parentRule = null;
|
||||
}
|
||||
|
||||
buffer = "";
|
||||
state = "before-selector";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (state) {
|
||||
case "before-selector":
|
||||
state = "selector";
|
||||
styleRule = new CSSOM.CSSStyleRule();
|
||||
styleRule.__starts = i;
|
||||
break;
|
||||
case "before-name":
|
||||
state = "name";
|
||||
break;
|
||||
case "before-value":
|
||||
state = "value";
|
||||
break;
|
||||
case "importRule-begin":
|
||||
state = "importRule";
|
||||
break;
|
||||
}
|
||||
buffer += character;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return styleSheet;
|
||||
};
|
||||
|
||||
|
||||
//.CommonJS
|
||||
exports.parse = CSSOM.parse;
|
||||
// The following modules cannot be included sooner due to the mutual dependency with parse.js
|
||||
CSSOM.CSSStyleSheet = require("./CSSStyleSheet").CSSStyleSheet;
|
||||
CSSOM.CSSStyleRule = require("./CSSStyleRule").CSSStyleRule;
|
||||
CSSOM.CSSImportRule = require("./CSSImportRule").CSSImportRule;
|
||||
CSSOM.CSSMediaRule = require("./CSSMediaRule").CSSMediaRule;
|
||||
CSSOM.CSSSupportsRule = require("./CSSSupportsRule").CSSSupportsRule;
|
||||
CSSOM.CSSFontFaceRule = require("./CSSFontFaceRule").CSSFontFaceRule;
|
||||
CSSOM.CSSHostRule = require("./CSSHostRule").CSSHostRule;
|
||||
CSSOM.CSSStyleDeclaration = require('./CSSStyleDeclaration').CSSStyleDeclaration;
|
||||
CSSOM.CSSKeyframeRule = require('./CSSKeyframeRule').CSSKeyframeRule;
|
||||
CSSOM.CSSKeyframesRule = require('./CSSKeyframesRule').CSSKeyframesRule;
|
||||
CSSOM.CSSValueExpression = require('./CSSValueExpression').CSSValueExpression;
|
||||
CSSOM.CSSDocumentRule = require('./CSSDocumentRule').CSSDocumentRule;
|
||||
///CommonJS
|
53
node_modules/cssstyle/node_modules/cssom/package.json
generated
vendored
Normal file
53
node_modules/cssstyle/node_modules/cssom/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"_from": "cssom@~0.3.6",
|
||||
"_id": "cssom@0.3.8",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==",
|
||||
"_location": "/cssstyle/cssom",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cssom@~0.3.6",
|
||||
"name": "cssom",
|
||||
"escapedName": "cssom",
|
||||
"rawSpec": "~0.3.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.3.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cssstyle"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz",
|
||||
"_shasum": "9f1276f5b2b463f2114d3f2c75250af8c1a36f4a",
|
||||
"_spec": "cssom@~0.3.6",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\cssstyle",
|
||||
"author": {
|
||||
"name": "Nikita Vasilyev",
|
||||
"email": "me@elv1s.ru"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/NV/CSSOM/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "CSS Object Model implementation and CSS parser",
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"homepage": "https://github.com/NV/CSSOM#readme",
|
||||
"keywords": [
|
||||
"CSS",
|
||||
"CSSOM",
|
||||
"parser",
|
||||
"styleSheet"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"name": "cssom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/NV/CSSOM.git"
|
||||
},
|
||||
"version": "0.3.8"
|
||||
}
|
75
node_modules/cssstyle/package.json
generated
vendored
75
node_modules/cssstyle/package.json
generated
vendored
@@ -1,29 +1,29 @@
|
||||
{
|
||||
"_from": "cssstyle@^1.1.1",
|
||||
"_id": "cssstyle@1.4.0",
|
||||
"_from": "cssstyle@^2.2.0",
|
||||
"_id": "cssstyle@2.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==",
|
||||
"_integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==",
|
||||
"_location": "/cssstyle",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cssstyle@^1.1.1",
|
||||
"raw": "cssstyle@^2.2.0",
|
||||
"name": "cssstyle",
|
||||
"escapedName": "cssstyle",
|
||||
"rawSpec": "^1.1.1",
|
||||
"rawSpec": "^2.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.1"
|
||||
"fetchSpec": "^2.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsdom"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz",
|
||||
"_shasum": "9d31328229d3c565c61e586b02041a28fccdccf1",
|
||||
"_spec": "cssstyle@^1.1.1",
|
||||
"_where": "F:\\projects\\p\\minifyfromhtml\\node_modules\\jsdom",
|
||||
"_resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz",
|
||||
"_shasum": "ff665a0ddbdc31864b09647f34163443d90b0852",
|
||||
"_spec": "cssstyle@^2.2.0",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\jsdom",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jsakas/CSSStyleDeclaration/issues"
|
||||
"url": "https://github.com/jsdom/cssstyle/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
@@ -31,25 +31,10 @@
|
||||
"name": "Chad Walker",
|
||||
"email": "chad@chad-cat-lore-eddie.com",
|
||||
"url": "https://github.com/chad3814"
|
||||
},
|
||||
{
|
||||
"name": "Rafał Ruciński",
|
||||
"email": "fatfisz@gmail.com",
|
||||
"url": "https://fatfisz.com"
|
||||
},
|
||||
{
|
||||
"name": "Nikita Vasilyev",
|
||||
"email": "me@elv1s.ru"
|
||||
},
|
||||
{
|
||||
"name": "Davide P. Cervone"
|
||||
},
|
||||
{
|
||||
"name": "Forbes Lindesay"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"cssom": "0.3.x"
|
||||
"cssom": "~0.3.6"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "CSSStyleDeclaration Object Model implementation",
|
||||
@@ -58,19 +43,25 @@
|
||||
"babel-traverse": "~6.26.0",
|
||||
"babel-types": "~6.26.0",
|
||||
"babylon": "~6.18.0",
|
||||
"eslint": "5.13.0",
|
||||
"eslint-config-prettier": "4.0.0",
|
||||
"eslint-plugin-prettier": "3.0.1",
|
||||
"nodeunit": "~0.11.3",
|
||||
"eslint": "~6.0.0",
|
||||
"eslint-config-prettier": "~6.0.0",
|
||||
"eslint-plugin-prettier": "~3.1.0",
|
||||
"jest": "^24.8.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "1.16.4",
|
||||
"prettier": "~1.18.0",
|
||||
"request": "^2.88.0",
|
||||
"resolve": "~1.8.1"
|
||||
"resolve": "~1.11.1"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"homepage": "https://github.com/jsakas/CSSStyleDeclaration",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"homepage": "https://github.com/jsdom/cssstyle",
|
||||
"keywords": [
|
||||
"CSS",
|
||||
"CSSStyleDeclaration",
|
||||
@@ -83,12 +74,17 @@
|
||||
"name": "Jon Sakas",
|
||||
"email": "jon.sakas@gmail.com",
|
||||
"url": "https://jon.sakas.co/"
|
||||
},
|
||||
{
|
||||
"name": "Rafał Ruciński",
|
||||
"email": "fatfisz@gmail.com",
|
||||
"url": "https://fatfisz.com"
|
||||
}
|
||||
],
|
||||
"name": "cssstyle",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jsakas/CSSStyleDeclaration.git"
|
||||
"url": "git+https://github.com/jsdom/cssstyle.git"
|
||||
},
|
||||
"scripts": {
|
||||
"download": "node ./scripts/download_latest_properties.js && eslint lib/allProperties.js --fix",
|
||||
@@ -97,9 +93,10 @@
|
||||
"generate:properties": "node ./scripts/generate_properties.js",
|
||||
"lint": "npm run generate && eslint . --max-warnings 0",
|
||||
"lint:fix": "eslint . --fix --max-warnings 0",
|
||||
"prepublishOnly": "npm run test-ci",
|
||||
"test": "npm run generate && nodeunit tests",
|
||||
"test-ci": "npm run lint && npm run test"
|
||||
"prepublishOnly": "npm run lint && npm run test",
|
||||
"test": "npm run generate && jest",
|
||||
"test-ci": "npm run lint && npm run test && codecov",
|
||||
"update-authors": "git log --format=\"%aN <%aE>\" | sort -f | uniq > AUTHORS"
|
||||
},
|
||||
"version": "1.4.0"
|
||||
"version": "2.3.0"
|
||||
}
|
||||
|
88
node_modules/cssstyle/scripts/download_latest_properties.js
generated
vendored
88
node_modules/cssstyle/scripts/download_latest_properties.js
generated
vendored
@@ -1,88 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* W3C provides JSON list of all CSS properties and their status in the standard
|
||||
*
|
||||
* documentation: https://www.w3.org/Style/CSS/all-properties.en.html
|
||||
* JSON url: ( https://www.w3.org/Style/CSS/all-properties.en.json )
|
||||
*
|
||||
* Download that file, filter out duplicates and filter the properties based on the wanted standard level
|
||||
*
|
||||
* ED - Editors' Draft (not a W3C Technical Report)
|
||||
* FPWD - First Public Working Draft
|
||||
* WD - Working Draft
|
||||
* LC - Last Call Working Draft
|
||||
* CR - Candidate Recommendation
|
||||
* PR - Proposed Recommendation
|
||||
* REC - Recommendation
|
||||
* NOTE - Working Group Note
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var request = require('request');
|
||||
|
||||
const { camelToDashed } = require('../lib/parsers');
|
||||
|
||||
var url = 'https://www.w3.org/Style/CSS/all-properties.en.json';
|
||||
|
||||
console.log('Downloading CSS properties...');
|
||||
|
||||
function toCamelCase(propName) {
|
||||
return propName.replace(/-([a-z])/g, function(g) {
|
||||
return g[1].toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
request(url, function(error, response, body) {
|
||||
if (!error && response.statusCode === 200) {
|
||||
var allCSSProperties = JSON.parse(body);
|
||||
|
||||
// Filter out all properties newer than Working Draft
|
||||
var workingDraftAndOlderProperties = allCSSProperties.filter(function(cssProp) {
|
||||
// TODO: --* css Needs additional logic to this module, so filter it out for now
|
||||
return cssProp.status !== 'ED' && cssProp.status !== 'FPWD' && cssProp.property !== '--*';
|
||||
});
|
||||
|
||||
// Remove duplicates, there can be many properties in different states of standard
|
||||
// and add only property names to the list
|
||||
var CSSpropertyNames = [];
|
||||
workingDraftAndOlderProperties.forEach(function(cssProp) {
|
||||
const camelCaseName = toCamelCase(cssProp.property);
|
||||
|
||||
if (CSSpropertyNames.indexOf(camelCaseName) === -1) {
|
||||
CSSpropertyNames.push(camelCaseName);
|
||||
}
|
||||
});
|
||||
|
||||
var out_file = fs.createWriteStream(path.resolve(__dirname, './../lib/allProperties.js'), {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
|
||||
var date_today = new Date();
|
||||
out_file.write(
|
||||
"'use strict';\n\n// autogenerated - " +
|
||||
(date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
|
||||
'\n\n'
|
||||
);
|
||||
out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
|
||||
|
||||
out_file.write('var allProperties = new Set();\n');
|
||||
out_file.write('module.exports = allProperties;\n');
|
||||
|
||||
CSSpropertyNames.forEach(function(property) {
|
||||
out_file.write('allProperties.add(' + JSON.stringify(camelToDashed(property)) + ');\n');
|
||||
});
|
||||
|
||||
out_file.end(function(err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
console.log('Generated ' + Object.keys(CSSpropertyNames).length + ' properties.');
|
||||
});
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
});
|
61
node_modules/cssstyle/scripts/generate_implemented_properties.js
generated
vendored
61
node_modules/cssstyle/scripts/generate_implemented_properties.js
generated
vendored
@@ -1,61 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const t = require('babel-types');
|
||||
const generate = require('babel-generator').default;
|
||||
const camelToDashed = require('../lib/parsers').camelToDashed;
|
||||
|
||||
const dashedProperties = fs
|
||||
.readdirSync(path.resolve(__dirname, '../lib/properties'))
|
||||
.filter(propertyFile => propertyFile.substr(-3) === '.js')
|
||||
.map(propertyFile => camelToDashed(propertyFile.replace('.js', '')));
|
||||
|
||||
const out_file = fs.createWriteStream(path.resolve(__dirname, '../lib/implementedProperties.js'), {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
var date_today = new Date();
|
||||
out_file.write(
|
||||
"'use strict';\n\n// autogenerated - " +
|
||||
(date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
|
||||
'\n\n'
|
||||
);
|
||||
out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
|
||||
|
||||
const statements = [];
|
||||
statements.push(
|
||||
t.variableDeclaration('var', [
|
||||
t.variableDeclarator(
|
||||
t.identifier('implementedProperties'),
|
||||
t.newExpression(t.identifier('Set'), [])
|
||||
),
|
||||
])
|
||||
);
|
||||
|
||||
dashedProperties.forEach(property => {
|
||||
statements.push(
|
||||
t.expressionStatement(
|
||||
t.callExpression(
|
||||
t.memberExpression(t.identifier('implementedProperties'), t.identifier('add')),
|
||||
[t.stringLiteral(property)]
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
statements.push(
|
||||
t.expressionStatement(
|
||||
t.assignmentExpression(
|
||||
'=',
|
||||
t.memberExpression(t.identifier('module'), t.identifier('exports')),
|
||||
t.identifier('implementedProperties')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
out_file.write(generate(t.program(statements)).code + '\n');
|
||||
out_file.end(function(err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
292
node_modules/cssstyle/scripts/generate_properties.js
generated
vendored
292
node_modules/cssstyle/scripts/generate_properties.js
generated
vendored
@@ -1,292 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var babylon = require('babylon');
|
||||
var t = require('babel-types');
|
||||
var generate = require('babel-generator').default;
|
||||
var traverse = require('babel-traverse').default;
|
||||
var resolve = require('resolve');
|
||||
|
||||
var camelToDashed = require('../lib/parsers').camelToDashed;
|
||||
|
||||
var basename = path.basename;
|
||||
var dirname = path.dirname;
|
||||
|
||||
var uniqueIndex = 0;
|
||||
function getUniqueIndex() {
|
||||
return uniqueIndex++;
|
||||
}
|
||||
|
||||
var property_files = fs
|
||||
.readdirSync(path.resolve(__dirname, '../lib/properties'))
|
||||
.filter(function(property) {
|
||||
return property.substr(-3) === '.js';
|
||||
});
|
||||
var out_file = fs.createWriteStream(path.resolve(__dirname, '../lib/properties.js'), {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
var date_today = new Date();
|
||||
out_file.write(
|
||||
"'use strict';\n\n// autogenerated - " +
|
||||
(date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
|
||||
'\n\n'
|
||||
);
|
||||
out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
|
||||
|
||||
function isModuleDotExports(node) {
|
||||
return (
|
||||
t.isMemberExpression(node, { computed: false }) &&
|
||||
t.isIdentifier(node.object, { name: 'module' }) &&
|
||||
t.isIdentifier(node.property, { name: 'exports' })
|
||||
);
|
||||
}
|
||||
function isRequire(node, filename) {
|
||||
if (
|
||||
t.isCallExpression(node) &&
|
||||
t.isIdentifier(node.callee, { name: 'require' }) &&
|
||||
node.arguments.length === 1 &&
|
||||
t.isStringLiteral(node.arguments[0])
|
||||
) {
|
||||
var relative = node.arguments[0].value;
|
||||
var fullPath = resolve.sync(relative, { basedir: dirname(filename) });
|
||||
return { relative: relative, fullPath: fullPath };
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// step 1: parse all files and figure out their dependencies
|
||||
var parsedFilesByPath = {};
|
||||
property_files.map(function(property) {
|
||||
var filename = path.resolve(__dirname, '../lib/properties/' + property);
|
||||
var src = fs.readFileSync(filename, 'utf8');
|
||||
property = basename(property, '.js');
|
||||
var ast = babylon.parse(src);
|
||||
var dependencies = [];
|
||||
traverse(ast, {
|
||||
enter(path) {
|
||||
var r;
|
||||
if ((r = isRequire(path.node, filename))) {
|
||||
dependencies.push(r.fullPath);
|
||||
}
|
||||
},
|
||||
});
|
||||
parsedFilesByPath[filename] = {
|
||||
filename: filename,
|
||||
property: property,
|
||||
ast: ast,
|
||||
dependencies: dependencies,
|
||||
};
|
||||
});
|
||||
|
||||
// step 2: serialize the files in an order where dependencies are always above
|
||||
// the files they depend on
|
||||
var externalDependencies = [];
|
||||
var parsedFiles = [];
|
||||
var addedFiles = {};
|
||||
function addFile(filename, dependencyPath) {
|
||||
if (dependencyPath.indexOf(filename) !== -1) {
|
||||
throw new Error(
|
||||
'Circular dependency: ' +
|
||||
dependencyPath
|
||||
.slice(dependencyPath.indexOf(filename))
|
||||
.concat([filename])
|
||||
.join(' -> ')
|
||||
);
|
||||
}
|
||||
var file = parsedFilesByPath[filename];
|
||||
if (addedFiles[filename]) {
|
||||
return;
|
||||
}
|
||||
if (!file) {
|
||||
externalDependencies.push(filename);
|
||||
} else {
|
||||
file.dependencies.forEach(function(dependency) {
|
||||
addFile(dependency, dependencyPath.concat([filename]));
|
||||
});
|
||||
parsedFiles.push(parsedFilesByPath[filename]);
|
||||
}
|
||||
addedFiles[filename] = true;
|
||||
}
|
||||
Object.keys(parsedFilesByPath).forEach(function(filename) {
|
||||
addFile(filename, []);
|
||||
});
|
||||
// Step 3: add files to output
|
||||
// renaming exports to local variables `moduleName_export_exportName`
|
||||
// and updating require calls as appropriate
|
||||
var moduleExportsByPath = {};
|
||||
var statements = [];
|
||||
externalDependencies.forEach(function(filename, i) {
|
||||
var id = t.identifier(
|
||||
'external_dependency_' + basename(filename, '.js').replace(/[^A-Za-z]/g, '') + '_' + i
|
||||
);
|
||||
moduleExportsByPath[filename] = { defaultExports: id };
|
||||
var relativePath = path.relative(path.resolve(__dirname + '/../lib'), filename);
|
||||
if (relativePath[0] !== '.') {
|
||||
relativePath = './' + relativePath;
|
||||
}
|
||||
statements.push(
|
||||
t.variableDeclaration('var', [
|
||||
t.variableDeclarator(
|
||||
id,
|
||||
t.callExpression(t.identifier('require'), [t.stringLiteral(relativePath)])
|
||||
),
|
||||
])
|
||||
);
|
||||
});
|
||||
function getRequireValue(node, file) {
|
||||
var r, e;
|
||||
// replace require("./foo").bar with the named export from foo
|
||||
if (
|
||||
t.isMemberExpression(node, { computed: false }) &&
|
||||
(r = isRequire(node.object, file.filename))
|
||||
) {
|
||||
e = moduleExportsByPath[r.fullPath];
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
if (!e.namedExports) {
|
||||
return t.memberExpression(e.defaultExports, node.property);
|
||||
}
|
||||
if (!e.namedExports[node.property.name]) {
|
||||
throw new Error(r.relative + ' does not export ' + node.property.name);
|
||||
}
|
||||
return e.namedExports[node.property.name];
|
||||
|
||||
// replace require("./foo") with the default export of foo
|
||||
} else if ((r = isRequire(node, file.filename))) {
|
||||
e = moduleExportsByPath[r.fullPath];
|
||||
if (!e) {
|
||||
if (/^\.\.\//.test(r.relative)) {
|
||||
node.arguments[0].value = r.relative.substr(1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return e.defaultExports;
|
||||
}
|
||||
}
|
||||
parsedFiles.forEach(function(file) {
|
||||
var namedExports = {};
|
||||
var localVariableMap = {};
|
||||
|
||||
traverse(file.ast, {
|
||||
enter(path) {
|
||||
// replace require calls with the corresponding value
|
||||
var r;
|
||||
if ((r = getRequireValue(path.node, file))) {
|
||||
path.replaceWith(r);
|
||||
return;
|
||||
}
|
||||
|
||||
// if we see `var foo = require('bar')` we can just inline the variable
|
||||
// representing `require('bar')` wherever `foo` was used.
|
||||
if (
|
||||
t.isVariableDeclaration(path.node) &&
|
||||
path.node.declarations.length === 1 &&
|
||||
t.isIdentifier(path.node.declarations[0].id) &&
|
||||
(r = getRequireValue(path.node.declarations[0].init, file))
|
||||
) {
|
||||
var newName = 'compiled_local_variable_reference_' + getUniqueIndex();
|
||||
path.scope.rename(path.node.declarations[0].id.name, newName);
|
||||
localVariableMap[newName] = r;
|
||||
path.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// rename all top level functions to keep them local to the module
|
||||
if (t.isFunctionDeclaration(path.node) && t.isProgram(path.parent)) {
|
||||
path.scope.rename(path.node.id.name, file.property + '_local_fn_' + path.node.id.name);
|
||||
return;
|
||||
}
|
||||
|
||||
// rename all top level variables to keep them local to the module
|
||||
if (t.isVariableDeclaration(path.node) && t.isProgram(path.parent)) {
|
||||
path.node.declarations.forEach(function(declaration) {
|
||||
path.scope.rename(
|
||||
declaration.id.name,
|
||||
file.property + '_local_var_' + declaration.id.name
|
||||
);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// replace module.exports.bar with a variable for the named export
|
||||
if (
|
||||
t.isMemberExpression(path.node, { computed: false }) &&
|
||||
isModuleDotExports(path.node.object)
|
||||
) {
|
||||
var name = path.node.property.name;
|
||||
var identifier = t.identifier(file.property + '_export_' + name);
|
||||
path.replaceWith(identifier);
|
||||
namedExports[name] = identifier;
|
||||
}
|
||||
},
|
||||
});
|
||||
traverse(file.ast, {
|
||||
enter(path) {
|
||||
if (
|
||||
t.isIdentifier(path.node) &&
|
||||
Object.prototype.hasOwnProperty.call(localVariableMap, path.node.name)
|
||||
) {
|
||||
path.replaceWith(localVariableMap[path.node.name]);
|
||||
}
|
||||
},
|
||||
});
|
||||
var defaultExports = t.objectExpression(
|
||||
Object.keys(namedExports).map(function(name) {
|
||||
return t.objectProperty(t.identifier(name), namedExports[name]);
|
||||
})
|
||||
);
|
||||
moduleExportsByPath[file.filename] = {
|
||||
namedExports: namedExports,
|
||||
defaultExports: defaultExports,
|
||||
};
|
||||
statements.push(
|
||||
t.variableDeclaration(
|
||||
'var',
|
||||
Object.keys(namedExports).map(function(name) {
|
||||
return t.variableDeclarator(namedExports[name]);
|
||||
})
|
||||
)
|
||||
);
|
||||
statements.push.apply(statements, file.ast.program.body);
|
||||
});
|
||||
var propertyDefinitions = [];
|
||||
parsedFiles.forEach(function(file) {
|
||||
var dashed = camelToDashed(file.property);
|
||||
propertyDefinitions.push(
|
||||
t.objectProperty(
|
||||
t.identifier(file.property),
|
||||
t.identifier(file.property + '_export_definition')
|
||||
)
|
||||
);
|
||||
if (file.property !== dashed) {
|
||||
propertyDefinitions.push(
|
||||
t.objectProperty(t.stringLiteral(dashed), t.identifier(file.property + '_export_definition'))
|
||||
);
|
||||
}
|
||||
});
|
||||
var definePropertiesCall = t.callExpression(
|
||||
t.memberExpression(t.identifier('Object'), t.identifier('defineProperties')),
|
||||
[t.identifier('prototype'), t.objectExpression(propertyDefinitions)]
|
||||
);
|
||||
statements.push(
|
||||
t.expressionStatement(
|
||||
t.assignmentExpression(
|
||||
'=',
|
||||
t.memberExpression(t.identifier('module'), t.identifier('exports')),
|
||||
t.functionExpression(
|
||||
null,
|
||||
[t.identifier('prototype')],
|
||||
t.blockStatement([t.expressionStatement(definePropertiesCall)])
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
out_file.write(generate(t.program(statements)).code + '\n');
|
||||
out_file.end(function(err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
669
node_modules/cssstyle/tests/tests.js
generated
vendored
669
node_modules/cssstyle/tests/tests.js
generated
vendored
@@ -1,669 +0,0 @@
|
||||
'use strict';
|
||||
var cssstyle = require('../lib/CSSStyleDeclaration');
|
||||
|
||||
var { dashedToCamelCase } = require('../lib/parsers');
|
||||
|
||||
var dashedProperties = [
|
||||
...require('../lib/allProperties'),
|
||||
...require('../lib/allExtraProperties'),
|
||||
];
|
||||
var allowedProperties = dashedProperties.map(dashedToCamelCase);
|
||||
var implementedProperties = Array.from(require('../lib/implementedProperties')).map(
|
||||
dashedToCamelCase
|
||||
);
|
||||
var invalidProperties = implementedProperties.filter(function(property) {
|
||||
return !allowedProperties.includes(property);
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
'Verify Has Only Valid Properties Implemented': function(test) {
|
||||
test.expect(1);
|
||||
test.ok(
|
||||
invalidProperties.length === 0,
|
||||
invalidProperties.length +
|
||||
' invalid properties implemented: ' +
|
||||
Array.from(invalidProperties).join(', ')
|
||||
);
|
||||
test.done();
|
||||
},
|
||||
'Verify Has All Properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(allowedProperties.length * 2);
|
||||
allowedProperties.forEach(function(property) {
|
||||
test.ok(style.__lookupGetter__(property), 'missing ' + property + ' property');
|
||||
test.ok(style.__lookupSetter__(property), 'missing ' + property + ' property');
|
||||
});
|
||||
test.done();
|
||||
},
|
||||
'Verify Has All Dashed Properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(dashedProperties.length * 2);
|
||||
dashedProperties.forEach(function(property) {
|
||||
test.ok(style.__lookupGetter__(property), 'missing ' + property + ' property');
|
||||
test.ok(style.__lookupSetter__(property), 'missing ' + property + ' property');
|
||||
});
|
||||
test.done();
|
||||
},
|
||||
'Verify Has Functions': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(6);
|
||||
test.ok(typeof style.getPropertyValue === 'function', 'missing getPropertyValue()');
|
||||
test.ok(typeof style.getPropertyCSSValue === 'function', 'missing getPropertyCSSValue()');
|
||||
test.ok(typeof style.removeProperty === 'function', 'missing removeProperty()');
|
||||
test.ok(typeof style.getPropertyPriority === 'function', 'missing getPropertyPriority()');
|
||||
test.ok(typeof style.setProperty === 'function', 'missing setProperty()');
|
||||
test.ok(typeof style.item === 'function', 'missing item()');
|
||||
test.done();
|
||||
},
|
||||
'Verify Has Special Properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(5);
|
||||
test.ok(style.__lookupGetter__('cssText'), 'missing cssText getter');
|
||||
test.ok(style.__lookupSetter__('cssText'), 'missing cssText setter');
|
||||
test.ok(style.__lookupGetter__('length'), 'missing length getter');
|
||||
test.ok(style.__lookupSetter__('length'), 'missing length setter');
|
||||
test.ok(style.__lookupGetter__('parentRule'), 'missing parentRule getter');
|
||||
test.done();
|
||||
},
|
||||
'Test From Style String': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(8);
|
||||
style.cssText = 'color: blue; background-color: red; width: 78%; height: 50vh;';
|
||||
test.ok(4 === style.length, 'length is not 4');
|
||||
test.ok(
|
||||
'color: blue; background-color: red; width: 78%; height: 50vh;' === style.cssText,
|
||||
'cssText is wrong'
|
||||
);
|
||||
test.ok('blue' === style.getPropertyValue('color'), "getPropertyValue('color') failed");
|
||||
test.ok('color' === style.item(0), 'item(0) failed');
|
||||
test.ok('background-color' === style[1], 'style[1] failed');
|
||||
test.ok(
|
||||
'red' === style.backgroundColor,
|
||||
'style.backgroundColor failed with "' + style.backgroundColor + '"'
|
||||
);
|
||||
style.cssText = '';
|
||||
test.ok('' === style.cssText, 'cssText is not empty');
|
||||
test.ok(0 === style.length, 'length is not 0');
|
||||
test.done();
|
||||
},
|
||||
'Test From Properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(11);
|
||||
style.color = 'blue';
|
||||
test.ok(1 === style.length, 'length is not 1');
|
||||
test.ok('color' === style[0], 'style[0] is not color');
|
||||
test.ok('color: blue;' === style.cssText, 'cssText is wrong');
|
||||
test.ok('color' === style.item(0), 'item(0) is not color');
|
||||
test.ok('blue' === style.color, 'color is not blue');
|
||||
style.backgroundColor = 'red';
|
||||
test.ok(2 === style.length, 'length is not 2');
|
||||
test.ok('color' === style[0], 'style[0] is not color');
|
||||
test.ok('background-color' === style[1], 'style[1] is not background-color');
|
||||
test.ok('color: blue; background-color: red;' === style.cssText, 'cssText is wrong');
|
||||
test.ok('red' === style.backgroundColor, 'backgroundColor is not red');
|
||||
style.removeProperty('color');
|
||||
test.ok('background-color' === style[0], 'style[0] is not background-color');
|
||||
test.done();
|
||||
},
|
||||
'Test Shorthand Properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(11);
|
||||
style.background = 'blue url(http://www.example.com/some_img.jpg)';
|
||||
test.ok('blue' === style.backgroundColor, 'backgroundColor is not blue');
|
||||
test.ok(
|
||||
'url(http://www.example.com/some_img.jpg)' === style.backgroundImage,
|
||||
'backgroundImage is wrong'
|
||||
);
|
||||
test.ok(
|
||||
'blue url(http://www.example.com/some_img.jpg)' === style.background,
|
||||
'background is different'
|
||||
);
|
||||
style.border = '0 solid black';
|
||||
test.ok('0px' === style.borderWidth, 'borderWidth is not 0px');
|
||||
test.ok('solid' === style.borderStyle, 'borderStyle is not solid');
|
||||
test.ok('black' === style.borderColor, 'borderColor is not black');
|
||||
test.ok('0px' === style.borderTopWidth, 'borderTopWidth is not 0px');
|
||||
test.ok('solid' === style.borderLeftStyle, 'borderLeftStyle is not solid');
|
||||
test.ok('black' === style.borderBottomColor, 'borderBottomColor is not black');
|
||||
style.font = '12em monospace';
|
||||
test.ok('12em' === style.fontSize, 'fontSize is not 12em');
|
||||
test.ok('monospace' === style.fontFamily, 'fontFamily is not monospace');
|
||||
test.done();
|
||||
},
|
||||
'Test width and height Properties and null and empty strings': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(9);
|
||||
style.height = 6;
|
||||
test.ok('' === style.height, 'height does not remain unset');
|
||||
style.width = 0;
|
||||
test.ok('0px' === style.width, 'width is not 0px');
|
||||
style.height = '34%';
|
||||
test.ok('34%' === style.height, 'height is not 34%');
|
||||
style.height = '100vh';
|
||||
test.ok('100vh' === style.height, 'height is not 100vh');
|
||||
style.height = '100vw';
|
||||
test.ok('100vw' === style.height, 'height is not 100vw');
|
||||
style.height = '';
|
||||
test.ok(style.length === 1, 'length is not 1');
|
||||
test.ok('width: 0px;' === style.cssText, 'cssText is not "width: 0px;"');
|
||||
style.width = null;
|
||||
test.ok(style.length === 0, 'length is not 0');
|
||||
test.ok('' === style.cssText, 'cssText is not empty string');
|
||||
test.done();
|
||||
},
|
||||
'Test Implicit Properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(7);
|
||||
style.borderWidth = 0;
|
||||
test.ok(1 === style.length, 'length is not 1');
|
||||
test.ok('0px' === style.borderWidth, 'borderWidth is not 0px');
|
||||
test.ok('0px' === style.borderTopWidth, 'borderTopWidth is not 0px');
|
||||
test.ok('0px' === style.borderBottomWidth, 'borderBottomWidth is not 0px');
|
||||
test.ok('0px' === style.borderLeftWidth, 'borderLeftWidth is not 0px');
|
||||
test.ok('0px' === style.borderRightWidth, 'borderRightWidth is not 0px');
|
||||
test.ok(
|
||||
'border-width: 0px;' === style.cssText,
|
||||
'cssText is not "border-width: 0px", "' + style.cssText + '"'
|
||||
);
|
||||
test.done();
|
||||
},
|
||||
'Test Top, Left, Right, Bottom Properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(6);
|
||||
style.top = 0;
|
||||
style.left = '0%';
|
||||
style.right = '5em';
|
||||
style.bottom = '12pt';
|
||||
test.ok('0px' === style.top, 'top is not 0px');
|
||||
test.ok('0%' === style.left, 'left is not 0%');
|
||||
test.ok('5em' === style.right, 'right is not 5em');
|
||||
test.ok('12pt' === style.bottom, 'bottom is not 12pt');
|
||||
test.ok(4 === style.length, 'length is not 4');
|
||||
test.ok(
|
||||
'top: 0px; left: 0%; right: 5em; bottom: 12pt;' === style.cssText,
|
||||
'text is not "top: 0px; left: 0%; right: 5em; bottom: 12pt;"'
|
||||
);
|
||||
test.done();
|
||||
},
|
||||
'Test Clear and Clip Properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(10);
|
||||
style.clear = 'none';
|
||||
test.ok('none' === style.clear, 'clear is not none');
|
||||
style.clear = 'lfet'; // intentionally wrong
|
||||
test.ok('none' === style.clear, 'clear is not still none');
|
||||
style.clear = 'left';
|
||||
test.ok('left' === style.clear, 'clear is not left');
|
||||
style.clear = 'right';
|
||||
test.ok('right' === style.clear, 'clear is not right');
|
||||
style.clear = 'both';
|
||||
test.ok('both' === style.clear, 'clear is not both');
|
||||
style.clip = 'elipse(5px, 10px)';
|
||||
test.ok('' === style.clip, 'clip should not be set');
|
||||
test.ok(1 === style.length, 'length is not 1');
|
||||
style.clip = 'rect(0, 3Em, 2pt, 50%)';
|
||||
test.ok(
|
||||
'rect(0px, 3em, 2pt, 50%)' === style.clip,
|
||||
'clip is not "rect(0px, 3em, 2pt, 50%)", "' + style.clip + '"'
|
||||
);
|
||||
test.ok(2 === style.length, 'length is not 2');
|
||||
test.ok(
|
||||
'clear: both; clip: rect(0px, 3em, 2pt, 50%);' === style.cssText,
|
||||
'cssText is not "clear: both; clip: rect(0px, 3em, 2pt, 50%);"'
|
||||
);
|
||||
test.done();
|
||||
},
|
||||
'Test colors': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(9);
|
||||
style.color = 'rgba(0,0,0,0)';
|
||||
test.ok('rgba(0, 0, 0, 0)' === style.color, 'color is not rgba(0, 0, 0, 0)');
|
||||
style.color = 'rgba(5%, 10%, 20%, 0.4)';
|
||||
test.ok('rgba(12, 25, 51, 0.4)' === style.color, 'color is not rgba(12, 25, 51, 0.4)');
|
||||
style.color = 'rgb(33%, 34%, 33%)';
|
||||
test.ok('rgb(84, 86, 84)' === style.color, 'color is not rgb(84, 86, 84)');
|
||||
style.color = 'rgba(300, 200, 100, 1.5)';
|
||||
test.ok('rgb(255, 200, 100)' === style.color, 'color is not rgb(255, 200, 100) ' + style.color);
|
||||
style.color = 'hsla(0, 1%, 2%, 0.5)';
|
||||
test.ok(
|
||||
'hsla(0, 1%, 2%, 0.5)' === style.color,
|
||||
'color is not hsla(0, 1%, 2%, 0.5) ' + style.color
|
||||
);
|
||||
style.color = 'hsl(0, 1%, 2%)';
|
||||
test.ok('hsl(0, 1%, 2%)' === style.color, 'color is not hsl(0, 1%, 2%) ' + style.color);
|
||||
style.color = 'rebeccapurple';
|
||||
test.ok('rebeccapurple' === style.color, 'color is not rebeccapurple ' + style.color);
|
||||
style.color = 'transparent';
|
||||
test.ok('transparent' === style.color, 'color is not transparent ' + style.color);
|
||||
style.color = 'currentcolor';
|
||||
test.ok('currentcolor' === style.color, 'color is not currentcolor ' + style.color);
|
||||
test.done();
|
||||
},
|
||||
'Test short hand properties with embedded spaces': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(4);
|
||||
style.background = 'rgb(0, 0, 0) url(/something/somewhere.jpg)';
|
||||
test.ok(
|
||||
'rgb(0, 0, 0)' === style.backgroundColor,
|
||||
'backgroundColor is not rgb(0, 0, 0): ' + style.backgroundColor
|
||||
);
|
||||
test.ok(
|
||||
'url(/something/somewhere.jpg)' === style.backgroundImage,
|
||||
'backgroundImage is not url(/something/somewhere.jpg): ' + style.backgroundImage
|
||||
);
|
||||
test.ok(
|
||||
'background: rgb(0, 0, 0) url(/something/somewhere.jpg);' === style.cssText,
|
||||
'cssText is not correct: ' + style.cssText
|
||||
);
|
||||
style = new cssstyle.CSSStyleDeclaration();
|
||||
style.border = ' 1px solid black ';
|
||||
test.ok(
|
||||
'1px solid black' === style.border,
|
||||
'multiple spaces not properly parsed: ' + style.border
|
||||
);
|
||||
test.done();
|
||||
},
|
||||
'Setting shorthand properties to an empty string should clear all dependent properties': function(
|
||||
test
|
||||
) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.borderWidth = '1px';
|
||||
test.ok(
|
||||
'border-width: 1px;' === style.cssText,
|
||||
'cssText is not "border-width: 1px;": ' + style.cssText
|
||||
);
|
||||
style.border = '';
|
||||
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
||||
test.done();
|
||||
},
|
||||
'Setting implicit properties to an empty string should clear all dependent properties': function(
|
||||
test
|
||||
) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.borderTopWidth = '1px';
|
||||
test.ok(
|
||||
'border-top-width: 1px;' === style.cssText,
|
||||
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
||||
);
|
||||
style.borderWidth = '';
|
||||
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
||||
test.done();
|
||||
},
|
||||
'Setting a shorthand property, whose shorthands are implicit properties, to an empty string should clear all dependent properties': function(
|
||||
test
|
||||
) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(4);
|
||||
style.borderTopWidth = '1px';
|
||||
test.ok(
|
||||
'border-top-width: 1px;' === style.cssText,
|
||||
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
||||
);
|
||||
style.border = '';
|
||||
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
||||
style.borderTop = '1px solid black';
|
||||
test.ok(
|
||||
'border-top: 1px solid black;' === style.cssText,
|
||||
'cssText is not "border-top: 1px solid black;": ' + style.cssText
|
||||
);
|
||||
style.border = '';
|
||||
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
||||
test.done();
|
||||
},
|
||||
'Setting border values to "none" should clear dependent values': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(8);
|
||||
style.borderTopWidth = '1px';
|
||||
test.ok(
|
||||
'border-top-width: 1px;' === style.cssText,
|
||||
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
||||
);
|
||||
style.border = 'none';
|
||||
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
||||
style.borderTopWidth = '1px';
|
||||
test.ok(
|
||||
'border-top-width: 1px;' === style.cssText,
|
||||
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
||||
);
|
||||
style.borderTopStyle = 'none';
|
||||
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
||||
style.borderTopWidth = '1px';
|
||||
test.ok(
|
||||
'border-top-width: 1px;' === style.cssText,
|
||||
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
||||
);
|
||||
style.borderTop = 'none';
|
||||
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
||||
style.borderTopWidth = '1px';
|
||||
style.borderLeftWidth = '1px';
|
||||
test.ok(
|
||||
'border-top-width: 1px; border-left-width: 1px;' === style.cssText,
|
||||
'cssText is not "border-top-width: 1px; border-left-width: 1px;": ' + style.cssText
|
||||
);
|
||||
style.borderTop = 'none';
|
||||
test.ok(
|
||||
'border-left-width: 1px;' === style.cssText,
|
||||
'cssText is not "border-left-width: 1px;": ' + style.cssText
|
||||
);
|
||||
test.done();
|
||||
},
|
||||
'Setting border to 0 should be okay': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(1);
|
||||
style.border = 0;
|
||||
test.ok('border: 0px;' === style.cssText, 'cssText is not "border: 0px;": ' + style.cssText);
|
||||
test.done();
|
||||
},
|
||||
'Setting values implicit and shorthand properties via cssText and setProperty should propagate to dependent properties': function(
|
||||
test
|
||||
) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(4);
|
||||
style.cssText = 'border: 1px solid black;';
|
||||
test.ok(
|
||||
'border: 1px solid black;' === style.cssText,
|
||||
'cssText is not "border: 1px solid black;": ' + style.cssText
|
||||
);
|
||||
test.ok(
|
||||
'1px solid black' === style.borderTop,
|
||||
'borderTop is not "1px solid black": ' + style.borderTop
|
||||
);
|
||||
style.border = '';
|
||||
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
||||
style.setProperty('border', '1px solid black');
|
||||
test.ok(
|
||||
'border: 1px solid black;' === style.cssText,
|
||||
'cssText is not "border: 1px solid black;": ' + style.cssText
|
||||
);
|
||||
test.done();
|
||||
},
|
||||
'Setting opacity should work': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(3);
|
||||
style.setProperty('opacity', 0.75);
|
||||
test.ok(
|
||||
'opacity: 0.75;' === style.cssText,
|
||||
'cssText is not "opacity: 0.75;": ' + style.cssText
|
||||
);
|
||||
style.opacity = '0.50';
|
||||
test.ok('opacity: 0.5;' === style.cssText, 'cssText is not "opacity: 0.5;": ' + style.cssText);
|
||||
style.opacity = 1.0;
|
||||
test.ok('opacity: 1;' === style.cssText, 'cssText is not "opacity: 1;": ' + style.cssText);
|
||||
test.done();
|
||||
},
|
||||
'Width and height of auto should work': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(4);
|
||||
style.width = 'auto';
|
||||
test.equal(style.cssText, 'width: auto;', 'cssText is not "width: auto;": ' + style.cssText);
|
||||
test.equal(style.width, 'auto', 'width is not "auto": ' + style.width);
|
||||
style = new cssstyle.CSSStyleDeclaration();
|
||||
style.height = 'auto';
|
||||
test.equal(style.cssText, 'height: auto;', 'cssText is not "height: auto;": ' + style.cssText);
|
||||
test.equal(style.height, 'auto', 'height is not "auto": ' + style.height);
|
||||
test.done();
|
||||
},
|
||||
'Padding and margin should set/clear shorthand properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
var parts = ['Top', 'Right', 'Bottom', 'Left'];
|
||||
var testParts = function(name, v, V) {
|
||||
style[name] = v;
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var part = name + parts[i];
|
||||
test.equal(V[i], style[part], part + ' is not "' + V[i] + '": "' + style[part] + '"');
|
||||
}
|
||||
test.equal(v, style[name], name + ' is not "' + v + '": "' + style[name] + '"');
|
||||
style[name] = '';
|
||||
};
|
||||
test.expect(50);
|
||||
testParts('padding', '1px', ['1px', '1px', '1px', '1px']);
|
||||
testParts('padding', '1px 2%', ['1px', '2%', '1px', '2%']);
|
||||
testParts('padding', '1px 2px 3px', ['1px', '2px', '3px', '2px']);
|
||||
testParts('padding', '1px 2px 3px 4px', ['1px', '2px', '3px', '4px']);
|
||||
style.paddingTop = style.paddingRight = style.paddingBottom = style.paddingLeft = '1px';
|
||||
testParts('padding', '', ['', '', '', '']);
|
||||
testParts('margin', '1px', ['1px', '1px', '1px', '1px']);
|
||||
testParts('margin', '1px auto', ['1px', 'auto', '1px', 'auto']);
|
||||
testParts('margin', '1px 2% 3px', ['1px', '2%', '3px', '2%']);
|
||||
testParts('margin', '1px 2px 3px 4px', ['1px', '2px', '3px', '4px']);
|
||||
style.marginTop = style.marginRight = style.marginBottom = style.marginLeft = '1px';
|
||||
testParts('margin', '', ['', '', '', '']);
|
||||
test.done();
|
||||
},
|
||||
'Padding and margin shorthands should set main properties': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
var parts = ['Top', 'Right', 'Bottom', 'Left'];
|
||||
var testParts = function(name, v, V) {
|
||||
var expect;
|
||||
for (var i = 0; i < 4; i++) {
|
||||
style[name] = v;
|
||||
style[name + parts[i]] = V;
|
||||
expect = v.split(/ /);
|
||||
expect[i] = V;
|
||||
expect = expect.join(' ');
|
||||
test.equal(expect, style[name], name + ' is not "' + expect + '": "' + style[name] + '"');
|
||||
}
|
||||
};
|
||||
test.expect(12);
|
||||
testParts('padding', '1px 2px 3px 4px', '10px');
|
||||
testParts('margin', '1px 2px 3px 4px', '10px');
|
||||
testParts('margin', '1px 2px 3px 4px', 'auto');
|
||||
test.done();
|
||||
},
|
||||
'Setting a value to 0 should return the string value': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(1);
|
||||
style.setProperty('fill-opacity', 0);
|
||||
test.ok('0' === style.fillOpacity, 'fillOpacity is not "0": ' + style.fillOpacity);
|
||||
test.done();
|
||||
},
|
||||
'onChange callback should be called when the cssText changes': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration(function(cssText) {
|
||||
test.ok('opacity: 0;' === cssText, 'cssText is not "opacity: 0;": ' + cssText);
|
||||
test.done();
|
||||
});
|
||||
test.expect(1);
|
||||
style.setProperty('opacity', 0);
|
||||
},
|
||||
'Setting float should work the same as cssFloat': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(1);
|
||||
style.float = 'left';
|
||||
test.ok('left' === style.cssFloat, 'cssFloat is not "left": ' + style.cssFloat);
|
||||
test.done();
|
||||
},
|
||||
'Setting improper css to cssText should not throw': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.cssText = 'color: ';
|
||||
test.ok('' === style.cssText, "cssText wasn't cleared: " + style.cssText);
|
||||
style.color = 'black';
|
||||
style.cssText = 'float: ';
|
||||
test.ok('' === style.cssText, "cssText wasn't cleared: " + style.cssText);
|
||||
test.done();
|
||||
},
|
||||
'Make sure url parsing works with quotes': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(3);
|
||||
style.backgroundImage = 'url(http://some/url/here1.png)';
|
||||
test.ok(
|
||||
'url(http://some/url/here1.png)' === style.backgroundImage,
|
||||
"background-image wasn't url(http://some/url/here1.png): " + style.backgroundImage
|
||||
);
|
||||
style.backgroundImage = "url('http://some/url/here2.png')";
|
||||
test.ok(
|
||||
'url(http://some/url/here2.png)' === style.backgroundImage,
|
||||
"background-image wasn't url(http://some/url/here2.png): " + style.backgroundImage
|
||||
);
|
||||
style.backgroundImage = 'url("http://some/url/here3.png")';
|
||||
test.ok(
|
||||
'url(http://some/url/here3.png)' === style.backgroundImage,
|
||||
"background-image wasn't url(http://some/url/here3.png): " + style.backgroundImage
|
||||
);
|
||||
test.done();
|
||||
},
|
||||
'Make sure setting 0 to a padding or margin works': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.padding = 0;
|
||||
test.equal(style.cssText, 'padding: 0px;', 'padding is not 0px');
|
||||
style.margin = '1em';
|
||||
style.marginTop = '0';
|
||||
test.equal(style.marginTop, '0px', 'margin-top is not 0px');
|
||||
test.done();
|
||||
},
|
||||
'Make sure setting ex units to a padding or margin works': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.padding = '1ex';
|
||||
test.equal(style.cssText, 'padding: 1ex;', 'padding is not 1ex');
|
||||
style.margin = '1em';
|
||||
style.marginTop = '0.5ex';
|
||||
test.equal(style.marginTop, '0.5ex', 'margin-top is not 0.5ex');
|
||||
test.done();
|
||||
},
|
||||
'Make sure setting null to background works': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.background = 'red';
|
||||
test.equal(style.cssText, 'background: red;', 'background is not red');
|
||||
style.background = null;
|
||||
test.equal(style.cssText, '', 'cssText is not empty');
|
||||
test.done();
|
||||
},
|
||||
'Flex properties should keep their values': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.flexDirection = 'column';
|
||||
test.equal(style.cssText, 'flex-direction: column;', 'flex-direction is not column');
|
||||
style.flexDirection = 'row';
|
||||
test.equal(style.cssText, 'flex-direction: row;', 'flex-direction is not column');
|
||||
test.done();
|
||||
},
|
||||
'Make sure camelCase properties are not assigned with `.setProperty()`': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(1);
|
||||
style.setProperty('fontSize', '12px');
|
||||
test.equal(style.cssText, '', 'cssText is not empty');
|
||||
test.done();
|
||||
},
|
||||
'Make sure casing is ignored in `.setProperty()`': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.setProperty('FoNt-SiZe', '12px');
|
||||
test.equal(style.fontSize, '12px', 'font-size: 12px');
|
||||
test.equal(style.getPropertyValue('font-size'), '12px', 'font-size: 12px');
|
||||
test.done();
|
||||
},
|
||||
'Support non string entries in border-spacing': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(1);
|
||||
style.borderSpacing = 0;
|
||||
test.equal(style.cssText, 'border-spacing: 0px;', 'border-spacing is not 0');
|
||||
test.done();
|
||||
},
|
||||
'Float should be valid property for `.setProperty()`': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.setProperty('float', 'left');
|
||||
test.equal(style.float, 'left');
|
||||
test.equal(style.getPropertyValue('float'), 'left', 'float: left');
|
||||
test.done();
|
||||
},
|
||||
'Make sure flex-shrink works': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(3);
|
||||
style.setProperty('flex-shrink', 0);
|
||||
test.equal(style.getPropertyValue('flex-shrink'), '0', 'flex-shrink is not 0');
|
||||
style.setProperty('flex-shrink', 1);
|
||||
test.equal(style.getPropertyValue('flex-shrink'), '1', 'flex-shrink is not 1');
|
||||
test.equal(style.cssText, 'flex-shrink: 1;', 'flex-shrink cssText is incorrect');
|
||||
test.done();
|
||||
},
|
||||
'Make sure flex-grow works': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(2);
|
||||
style.setProperty('flex-grow', 2);
|
||||
test.equal(style.getPropertyValue('flex-grow'), '2', 'flex-grow is not 2');
|
||||
test.equal(style.cssText, 'flex-grow: 2;', 'flex-grow cssText is incorrect');
|
||||
test.done();
|
||||
},
|
||||
'Make sure flex-basis works': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(5);
|
||||
|
||||
style.setProperty('flex-basis', 0);
|
||||
test.equal(style.getPropertyValue('flex-basis'), '0px', 'flex-basis is not 0px');
|
||||
|
||||
style.setProperty('flex-basis', '250px');
|
||||
test.equal(style.getPropertyValue('flex-basis'), '250px', 'flex-basis is not 250px');
|
||||
|
||||
style.setProperty('flex-basis', '10em');
|
||||
test.equal(style.getPropertyValue('flex-basis'), '10em', 'flex-basis is not 10em');
|
||||
|
||||
style.setProperty('flex-basis', '30%');
|
||||
test.equal(style.getPropertyValue('flex-basis'), '30%', 'flex-basis is not 30%');
|
||||
|
||||
test.equal(style.cssText, 'flex-basis: 30%;', 'flex-basis cssText is incorrect');
|
||||
|
||||
test.done();
|
||||
},
|
||||
'Make sure shorthand flex works': function(test) {
|
||||
var style = new cssstyle.CSSStyleDeclaration();
|
||||
test.expect(19);
|
||||
|
||||
style.setProperty('flex', 'none');
|
||||
test.equal(style.getPropertyValue('flex-grow'), '0', 'flex-grow is not 0 if flex: none;');
|
||||
test.equal(style.getPropertyValue('flex-shrink'), '0', 'flex-shrink is not 0 if flex: none;');
|
||||
test.equal(
|
||||
style.getPropertyValue('flex-basis'),
|
||||
'auto',
|
||||
'flex-basis is not `auto` if flex: none;'
|
||||
);
|
||||
style.removeProperty('flex');
|
||||
style.removeProperty('flex-basis');
|
||||
|
||||
style.setProperty('flex', 'auto');
|
||||
test.equal(style.getPropertyValue('flex-grow'), '', 'flex-grow is not empty if flex: auto;');
|
||||
test.equal(
|
||||
style.getPropertyValue('flex-shrink'),
|
||||
'',
|
||||
'flex-shrink is not empty if flex: auto;'
|
||||
);
|
||||
test.equal(
|
||||
style.getPropertyValue('flex-basis'),
|
||||
'auto',
|
||||
'flex-basis is not `auto` if flex: auto;'
|
||||
);
|
||||
style.removeProperty('flex');
|
||||
|
||||
style.setProperty('flex', '0 1 250px');
|
||||
test.equal(style.getPropertyValue('flex'), '0 1 250px', 'flex value is not `0 1 250px`');
|
||||
test.equal(style.getPropertyValue('flex-grow'), '0', 'flex-grow is not 0');
|
||||
test.equal(style.getPropertyValue('flex-shrink'), '1', 'flex-shrink is not 1');
|
||||
test.equal(style.getPropertyValue('flex-basis'), '250px', 'flex-basis is not 250px');
|
||||
style.removeProperty('flex');
|
||||
|
||||
style.setProperty('flex', '2');
|
||||
test.equal(style.getPropertyValue('flex-grow'), '2', 'flex-grow is not 2');
|
||||
test.equal(style.getPropertyValue('flex-shrink'), '', 'flex-shrink is not empty');
|
||||
test.equal(style.getPropertyValue('flex-basis'), '', 'flex-basis is not empty');
|
||||
style.removeProperty('flex');
|
||||
|
||||
style.setProperty('flex', '20%');
|
||||
test.equal(style.getPropertyValue('flex-grow'), '', 'flex-grow is not empty');
|
||||
test.equal(style.getPropertyValue('flex-shrink'), '', 'flex-shrink is not empty');
|
||||
test.equal(style.getPropertyValue('flex-basis'), '20%', 'flex-basis is not 20%');
|
||||
style.removeProperty('flex');
|
||||
|
||||
style.setProperty('flex', '2 2');
|
||||
test.equal(style.getPropertyValue('flex-grow'), '2', 'flex-grow is not 2');
|
||||
test.equal(style.getPropertyValue('flex-shrink'), '2', 'flex-shrink is not 2');
|
||||
test.equal(style.getPropertyValue('flex-basis'), '', 'flex-basis is not empty');
|
||||
style.removeProperty('flex');
|
||||
|
||||
test.done();
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user