You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reject duplicate srcset descriptors after a zero-density descriptor #22738
parseSrcset uses truthiness checks to detect whether a descriptor is already present. The WHATWG parser accepts a density value of zero (0x), but the implementation stores it as numeric 0. As a result, a following descriptor is not recognized as conflicting and is accepted too.
Link to Minimal Reproduction and steps to reproduce
It returns [["a.png", 0, 5]]. Also try a.png 0x 1w and a.png 0x 1h.
Expected Behavior
Accept a single 0x descriptor, but reject a second x, w, or h descriptor in the same candidate with Invalid srcset descriptor. In the HTML parser, the invalid value should be reported as a bad srcset attribute.
Actual Behavior
The parser accepts 0x 1x (and 0x 1w / 0x 1h) and returns the URL candidate instead of reporting invalid descriptors.
Environment
webpack: 5.112.0 (source checkout at e12e1224)
System: Windows 11 10.0.26300 (x64)
Node: 24.14.0
npm: 11.9.0
Activity
fix(html): reject duplicate srcset descriptors after zero density