Skip to content

Commit 9c32c91

Browse files
committed
Minor things
1 parent cbb8c23 commit 9c32c91

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

lib/cssom/CSS-impl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ function supportsValue(property, value) {
4949
* @see {@link https://drafts.csswg.org/css-conditional-3/#dom-css-supports-conditiontext}
5050
*/
5151
function supportsCondition(conditionText) {
52-
const parsed = parseCSSGrammar(`(${conditionText})`, '<supports-condition>')
53-
return parsed ? matchSupport(parsed) : false
52+
const condition = parseCSSGrammar(`(${conditionText})`, '<supports-condition>')
53+
return condition ? matchSupport(condition) : false
5454
}
5555

5656
/**

lib/parse/grammar.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,10 @@ function matchFunction(value, node, parser) {
270270
value = { ...value, name: match.value }
271271
}
272272
if (definition.value) {
273-
const list = new Stream(value.value, input.source)
274-
const match = parser.parseCSSValue(list, definition.value, ctx)
273+
const match = parser.parseCSSValue(
274+
new Stream(value.value, input.source),
275+
definition.value,
276+
ctx)
275277
if (match === null || match instanceof SyntaxError) {
276278
return match
277279
}

lib/parse/parser.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ function isInvalidPropertyRule(rule) {
152152
return substitutions.keywords.includes(initialValue)
153153
}
154154
if (initialValue) {
155-
const parsed = parseCSSGrammar(initialValue, syntax.slice(1, -1), '@style')
156-
return !(parsed && isComputationallyIndependent(parsed))
155+
const match = parseCSSGrammar(initialValue, syntax.slice(1, -1), '@style')
156+
return !(match && isComputationallyIndependent(match))
157157
}
158158
return true
159159
}
@@ -943,14 +943,14 @@ function parseCSSGrammar(input, grammar, context) {
943943
function parseCSSGrammarList(input, grammar, context) {
944944
input = parseCommaSeparatedComponentValueList(input)
945945
if (input.length === 1) {
946-
const list = input[0]
947-
if (list.length === 1 && isWhitespace(list[0])) {
946+
const value = input[0]
947+
if (value.length === 1 && isWhitespace(value[0])) {
948948
input.pop()
949949
return input
950950
}
951951
}
952952
context = createContext(context)
953-
return list(input.map(list => parseCSSGrammar(list, grammar, context)), ',')
953+
return list(input.map(value => parseCSSGrammar(value, grammar, context)), ',')
954954
}
955955

956956
/**

lib/parse/shorthand.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ function parseLonghandsByIndex(values, longhands) {
6666
* @param {object[][]} lists
6767
* @param {string[]} longhands
6868
* @returns {Map}
69-
* @see {@link https://drafts.csswg.org/css-transitions-2/#propdef-transition}
70-
* @see {@link https://drafts.csswg.org/scroll-animations-1/#propdef-scroll-timeline}
7169
*/
7270
function parseCoordinatedValueList(lists, longhands) {
7371
const declarations = new Map(longhands.map(longhand => [longhand, list([], ',')]))
@@ -863,7 +861,7 @@ function parseSides(values, { length: sides }) {
863861
* @see {@link https://drafts.csswg.org/scroll-animations-1/#propdef-view-timeline}
864862
*/
865863
function parseViewTimeline(values, longhands) {
866-
values = values.map(list => isOmitted(list[1]) ? [list[0], omitted, omitted] : list.flat())
864+
values = values.map(value => isOmitted(value[1]) ? [value[0], omitted, omitted] : value.flat())
867865
return parseCoordinatedValueList(values, longhands)
868866
}
869867

lib/parse/types.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ function createType(unit, entries = [], percentHint = entries.percentHint ?? nul
120120
* @see {@link https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-invert-a-type}
121121
*/
122122
function invertType(type) {
123-
const result = createType(null, [], type.percentHint)
124-
type.forEach((exponent, unit) => result.set(unit, -1 * exponent))
125-
return result
123+
const inverted = createType(null, [], type.percentHint)
124+
type.forEach((exponent, unit) => inverted.set(unit, -1 * exponent))
125+
return inverted
126126
}
127127

128128
/**

lib/serialize.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,11 +1548,11 @@ function serializeURL({ value }) {
15481548
* @see {@link https://drafts.csswg.org/css-syntax-3/#typedef-unicode-range-token}
15491549
*/
15501550
function serializeUnicodeRange({ from, to }) {
1551-
const result = `U+${from.toString(16).toUpperCase()}`
1551+
const string = `U+${from.toString(16).toUpperCase()}`
15521552
if (to === 0) {
1553-
return result
1553+
return string
15541554
}
1555-
return `${result}-${to.toString(16).toUpperCase()}`
1555+
return `${string}-${to.toString(16).toUpperCase()}`
15561556
}
15571557

15581558
/**
@@ -2064,10 +2064,10 @@ function representBackgroundSize(size) {
20642064
function representBorder(declarations, sides) {
20652065
const values = []
20662066
for (const [index, declaration] of declarations.entries()) {
2067-
const match = values[Math.floor(index / sides % 3)]
2067+
const fallback = values[Math.floor(index / sides % 3)]
20682068
const value = serializeCSSValue(declaration)
2069-
if (match) {
2070-
if (match === value) {
2069+
if (fallback) {
2070+
if (fallback === value) {
20712071
continue
20722072
}
20732073
return ['']
@@ -3130,21 +3130,21 @@ function representWhiteSpace(declarations, longhands) {
31303130
}
31313131

31323132
/**
3133-
* @param {string[]} list
3133+
* @param {string[]} sides
31343134
* @returns {string[]}
31353135
*/
3136-
function representSides(list) {
3137-
list = [...list]
3138-
let index = list.length
3136+
function representSides(sides) {
3137+
sides = [...sides]
3138+
let index = sides.length
31393139
while (1 < index--) {
3140-
const side = list[index]
3141-
const opposite = list[index - 2] ?? list[0]
3140+
const side = sides[index]
3141+
const opposite = sides[index - 2] ?? sides[0]
31423142
if (side !== opposite) {
31433143
break
31443144
}
3145-
list.pop()
3145+
sides.pop()
31463146
}
3147-
return list
3147+
return sides
31483148
}
31493149

31503150
/**

0 commit comments

Comments
 (0)