Skip to content

Commit c11d5c0

Browse files
committed
Minor things
The change in `parseBackground()` is an oversight in 7b0acf5 and fixes a global variable declaration that did not throw an error before, because Jest runs tests in non-strict mode, even if the implementation is written with ES modules (which are interpreted in strict mode by default).
1 parent b5f0169 commit c11d5c0

File tree

5 files changed

+8
-17
lines changed

5 files changed

+8
-17
lines changed

lib/parse/postprocess.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as dimensions from '../values/dimensions.js'
55
import * as pseudos from '../values/pseudos.js'
66
import { add as addTypes, dimensionTypes, getCalculationType, matchNumericType } from './types.js'
77
import { angle, filter, keyword, list, map, number, omitted, string } from '../values/value.js'
8+
import { auto, notAll } from '../values/defaults.js'
89
import { findFunction, findSibling, getDeclaration, getDeclarationName, getFunctionName, getRule, getRuleName, isDeclaredBy, isProducedBy } from '../utils/context.js'
910
import { getDeclarationDefinition, parseDeclarationValue, parseGrammar } from './parser.js'
1011
import { isBlock, isCalculation, isComputationallyIndependent, isFailure, isFunction, isList, isOmitted, isWhitespace } from '../utils/value.js'
@@ -14,7 +15,6 @@ import { create as createError } from '../error.js'
1415
import { keywords as cssWideKeywords } from '../values/substitutions.js'
1516
import descriptors from '../descriptors/definitions.js'
1617
import features from '../values/features.js'
17-
import { notAll } from '../values/defaults.js'
1818
import { serializeComponentValue } from '../serialize.js'
1919
import { simplifyCalculation } from './simplify.js'
2020
import types from '../values/definitions.js'
@@ -1575,7 +1575,7 @@ function postParseRadialSize(size, node) {
15751575
*/
15761576
function postParseRandom({ value: [options,, min,, max,, step], ...props }) {
15771577
if (isOmitted(options)) {
1578-
options = list([keyword('auto'), omitted], ' ', ['<random-value-sharing>'])
1578+
options = list([auto, omitted], ' ', ['<random-value-sharing>'])
15791579
}
15801580
return { ...props, value: list([options, min, max, step], ',') }
15811581
}

lib/parse/shorthand.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function parseAnimationRangeValue(boundaries, endType) {
121121
}
122122

123123
/**
124-
* @param {object[][]} layers
124+
* @param {object[][]} backgrounds
125125
* @param {string[]} longhands
126126
* @param {string[]} resetOnly
127127
* @returns {Map}
@@ -130,8 +130,8 @@ function parseAnimationRangeValue(boundaries, endType) {
130130
* It assigns each background layer value to the corresponding longhand values,
131131
* setting an omitted `background-clip` value to the `background-origin` value.
132132
*/
133-
function parseBackground(layers, longhands, resetOnly) {
134-
[layers,, final] = layers
133+
function parseBackground(backgrounds, longhands, resetOnly) {
134+
let [layers,, final] = backgrounds
135135
const color = final.pop()
136136
const declarations = new Map(longhands.map(longhand =>
137137
longhand === 'background-color'

lib/serialize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ function serializeKeyframeSelector(selector) {
10511051
* @returns {string}
10521052
* @see {@link https://drafts.csswg.org/css-grid-2/#typedef-line-names}
10531053
*
1054-
* It serializes empty line name list to empty string (browser conformance).
1054+
* It serializes an empty line name list to empty string (browser conformance).
10551055
*/
10561056
function serializeLineNames(names, allowEmpty) {
10571057
if (names.value.length === 0) {

scripts/extract.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ const excluded = {
630630
},
631631
}
632632

633-
const descriptors = [...Object.keys(initial.descriptors).map(rule => [rule, Object.entries(initial.descriptors[rule])])]
634-
const properties = [...Object.entries(initial.properties)]
633+
const descriptors = Object.keys(initial.descriptors).map(rule => [rule, Object.entries(initial.descriptors[rule])])
634+
const properties = Object.entries(initial.properties)
635635
const types = [...Object.entries(initial.types), ...Object.entries(replaced.types)]
636636

637637
// TODO: periodically review this list to remove errors that no longer occur

test/stylesheet.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,6 @@ describe('CSSRuleList.item()', () => {
394394
assert.equal(cssRules.item(2), null)
395395
})
396396
})
397-
describe('CSSRuleList.length', () => {
398-
it('returns the length of the rule list', () => {
399-
const { cssRules } = createStyleSheet(`
400-
#rule-1 {}
401-
#rule-2 {}
402-
`)
403-
assert.equal(cssRules.length, 2)
404-
})
405-
})
406397

407398
describe('CSSColorProfileRule', () => {
408399
test('properties', () => {

0 commit comments

Comments
 (0)