Skip to content

Commit a3413ab

Browse files
authored
Refactor to prepare for addressing shorthand property issues
Introduce a mechanism to auto-generate CSS property definitions in propertyDefinitions.js, and refactor the codebase to use these generated definitions. This will be used eventually in jsdom to replace propertiesWithResolvedValueImplemented in jsdom's lib/jsdom/living/helpers/style-rules.js, allowing jsdom to delegate property metadata management entirely to cssstyle. Refactor normalize.js into smaller functions with clearer roles. Replace string literals with constants where possible. This work is mostly preparatory, but it does fix web-platform-tests/to-upstream/css/cssom/style-border-shorthand-var.html. Follow-up work will implement the complex logic for expanding shorthands into longhands.
1 parent 0a71683 commit a3413ab

5 files changed

Lines changed: 1288 additions & 1097 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
npm-debug.log
33
lib/generated/implementedProperties.js
44
lib/generated/properties.js
5+
lib/generated/propertyDefinitions.js

lib/CSSStyleDeclaration.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const generatedProperties = require("./generated/properties");
1010
const {
1111
borderProperties,
1212
getPositionValue,
13-
normalizeBorderProperties,
13+
normalizeProperties,
1414
prepareBorderProperties,
1515
prepareProperties,
1616
shorthandProperties
@@ -150,7 +150,7 @@ class CSSStyleDeclaration {
150150
}
151151
properties.set(property, { property, value, priority });
152152
}
153-
const normalizedProperties = normalizeBorderProperties(properties);
153+
const normalizedProperties = normalizeProperties(properties);
154154
const parts = [];
155155
for (const { property, value, priority } of normalizedProperties.values()) {
156156
if (priority) {

0 commit comments

Comments
 (0)