Skip to content

Commit

Permalink
Update dependencies and dev dependencies
Browse files Browse the repository at this point in the history
This includes:

* A replacement of cssom with rrweb-cssom, matching jsdom/jsdom#3497. Closes #153.

* An update to the download_latest_properties.js script to stop using request.

* A regeneration of the list of properties. Closes #150.

* Some style updates to most generated files, for unclear reasons.
  • Loading branch information
domenic committed Jan 22, 2023
1 parent 29ae19b commit 054d456
Show file tree
Hide file tree
Showing 85 changed files with 11,565 additions and 5,350 deletions.
36 changes: 18 additions & 18 deletions lib/CSSStyleDeclaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/NV/CSSOM
********************************************************************/
'use strict';
var CSSOM = require('cssom');
var CSSOM = require('rrweb-cssom');
var allProperties = require('./allProperties');
var allExtraProperties = require('./allExtraProperties');
var implementedProperties = require('./implementedProperties');
Expand All @@ -20,7 +20,7 @@ var CSSStyleDeclaration = function CSSStyleDeclaration(onChangeCallback) {
this._length = 0;
this._onChange =
onChangeCallback ||
function() {
function () {
return;
};
};
Expand All @@ -34,7 +34,7 @@ CSSStyleDeclaration.prototype = {
* @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) {
getPropertyValue: function (name) {
if (!this._values.hasOwnProperty(name)) {
return '';
}
Expand All @@ -48,7 +48,7 @@ CSSStyleDeclaration.prototype = {
* @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) {
setProperty: function (name, value, priority) {
if (value === undefined) {
return;
}
Expand All @@ -69,7 +69,7 @@ CSSStyleDeclaration.prototype = {
this[lowercaseName] = value;
this._importants[lowercaseName] = priority;
},
_setProperty: function(name, value, priority) {
_setProperty: function (name, value, priority) {
if (value === undefined) {
return;
}
Expand Down Expand Up @@ -101,7 +101,7 @@ CSSStyleDeclaration.prototype = {
* @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) {
removeProperty: function (name) {
if (!this._values.hasOwnProperty(name)) {
return '';
}
Expand Down Expand Up @@ -129,11 +129,11 @@ CSSStyleDeclaration.prototype = {
*
* @param {String} name
*/
getPropertyPriority: function(name) {
getPropertyPriority: function (name) {
return this._importants[name] || '';
},

getPropertyCSSValue: function() {
getPropertyCSSValue: function () {
//FIXME
return;
},
Expand All @@ -143,20 +143,20 @@ CSSStyleDeclaration.prototype = {
* element.style.getPropertyShorthand("overflow-x")
* -> "overflow"
*/
getPropertyShorthand: function() {
getPropertyShorthand: function () {
//FIXME
return;
},

isPropertyImplicit: function() {
isPropertyImplicit: function () {
//FIXME
return;
},

/**
* http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-item
*/
item: function(index) {
item: function (index) {
index = parseInt(index, 10);
if (index < 0 || index >= this._length) {
return '';
Expand All @@ -167,7 +167,7 @@ CSSStyleDeclaration.prototype = {

Object.defineProperties(CSSStyleDeclaration.prototype, {
cssText: {
get: function() {
get: function () {
var properties = [];
var i;
var name;
Expand All @@ -184,7 +184,7 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {
}
return properties.join(' ');
},
set: function(value) {
set: function (value) {
var i;
this._values = {};
Array.prototype.splice.call(this, 0, this._length);
Expand Down Expand Up @@ -212,22 +212,22 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {
configurable: true,
},
parentRule: {
get: function() {
get: function () {
return null;
},
enumerable: true,
configurable: true,
},
length: {
get: function() {
get: function () {
return this._length;
},
/**
* This deletes indices if the new length is less then the current
* length. If the new length is more, it does nothing, the new indices
* will be undefined until set.
**/
set: function(value) {
set: function (value) {
var i;
for (i = value; i < this._length; i++) {
delete this[i];
Expand All @@ -241,15 +241,15 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {

require('./properties')(CSSStyleDeclaration.prototype);

allProperties.forEach(function(property) {
allProperties.forEach(function (property) {
if (!implementedProperties.has(property)) {
var declaration = getBasicPropertyDescriptor(property);
Object.defineProperty(CSSStyleDeclaration.prototype, property, declaration);
Object.defineProperty(CSSStyleDeclaration.prototype, dashedToCamelCase(property), declaration);
}
});

allExtraProperties.forEach(function(property) {
allExtraProperties.forEach(function (property) {
if (!implementedProperties.has(property)) {
var declaration = getBasicPropertyDescriptor(property);
Object.defineProperty(CSSStyleDeclaration.prototype, property, declaration);
Expand Down
12 changes: 6 additions & 6 deletions lib/CSSStyleDeclaration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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));
var invalidProperties = implementedProperties.filter((prop) => !allowedProperties.includes(prop));

describe('CSSStyleDeclaration', () => {
test('has only valid properties implemented', () => {
Expand All @@ -19,15 +19,15 @@ describe('CSSStyleDeclaration', () => {

test('has all properties', () => {
var style = new CSSStyleDeclaration();
allProperties.forEach(property => {
allProperties.forEach((property) => {
expect(style.__lookupGetter__(property)).toBeTruthy();
expect(style.__lookupSetter__(property)).toBeTruthy();
});
});

test('has dashed properties', () => {
var style = new CSSStyleDeclaration();
dashedProperties.forEach(property => {
dashedProperties.forEach((property) => {
expect(style.__lookupGetter__(property)).toBeTruthy();
expect(style.__lookupSetter__(property)).toBeTruthy();
});
Expand Down Expand Up @@ -302,7 +302,7 @@ describe('CSSStyleDeclaration', () => {
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) {
var testParts = function (name, v, V) {
style[name] = v;
for (var i = 0; i < 4; i++) {
var part = name + parts[i];
Expand All @@ -329,7 +329,7 @@ describe('CSSStyleDeclaration', () => {
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 testParts = function (name, v, V) {
var expected;
for (var i = 0; i < 4; i++) {
style[name] = v;
Expand All @@ -353,7 +353,7 @@ describe('CSSStyleDeclaration', () => {
});

test('onchange callback should be called when the csstext changes', () => {
var style = new CSSStyleDeclaration(function(cssText) {
var style = new CSSStyleDeclaration(function (cssText) {
expect(cssText).toEqual('opacity: 0;');
});
style.setProperty('opacity', 0);
Expand Down
Loading

0 comments on commit 054d456

Please sign in to comment.