Skip to content

Commit 0f4f49c

Browse files
fix(html): reject duplicate srcset descriptors after zero density
Closes webpack#22738 Use descriptor presence checks so a zero-density descriptor remains distinguishable from an absent descriptor.
1 parent e12e122 commit 0f4f49c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎lib/html/syntax-parser.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14920,7 +14920,7 @@ const parseSrcset = (input) => {
1492014920
lastChar === SMALL_LETTER_W
1492114921
) {
1492214922
// If width and density are not both absent, then let error be yes.
14923-
if (width || density) {
14923+
if (width !== undefined || density !== undefined) {
1492414924
pError = true;
1492514925
}
1492614926

@@ -14943,7 +14943,11 @@ const parseSrcset = (input) => {
1494314943
) {
1494414944
// If width, density and future-compat-h are not all absent, then let error
1494514945
// be yes.
14946-
if (width || density || height) {
14946+
if (
14947+
width !== undefined ||
14948+
density !== undefined ||
14949+
height !== undefined
14950+
) {
1494714951
pError = true;
1494814952
}
1494914953

@@ -14965,7 +14969,7 @@ const parseSrcset = (input) => {
1496514969
lastChar === SMALL_LETTER_H
1496614970
) {
1496714971
// If height and density are not both absent, then let error be yes.
14968-
if (height || density) {
14972+
if (height !== undefined || density !== undefined) {
1496914973
pError = true;
1497014974
}
1497114975

0 commit comments

Comments
 (0)