jsdom
Advanced tools
Comparing version 23.2.0 to 24.0.0
@@ -672,7 +672,9 @@ "use strict"; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("hspace"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -699,4 +701,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(newValue)); | ||
} finally { | ||
@@ -719,7 +721,9 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("vspace"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -746,4 +750,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(newValue)); | ||
} finally { | ||
@@ -750,0 +754,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -11,2 +11,4 @@ "use strict"; | ||
const FileList = require("./FileList.js"); | ||
const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; | ||
const create_DOMException = require("./DOMException.js").create; | ||
const parseURLToResultingURLRecord_helpers_document_base_url = | ||
@@ -925,3 +927,10 @@ require("../helpers/document-base-url.js").parseURLToResultingURLRecord; | ||
try { | ||
return esValue[implSymbol]["maxLength"]; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("maxlength"); | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && conversions.long(value) === value) { | ||
return value; | ||
} | ||
} | ||
return -1; | ||
} finally { | ||
@@ -948,3 +957,10 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
esValue[implSymbol]["maxLength"] = V; | ||
if (V < 0) { | ||
throw create_DOMException(globalObject, [ | ||
`The negative value ${V} cannot be set for the maxLength property.`, | ||
"IndexSizeError" | ||
]); | ||
} | ||
esValue[implSymbol]._reflectSetTheContentAttribute("maxlength", String(V)); | ||
} finally { | ||
@@ -1006,3 +1022,10 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
return esValue[implSymbol]["minLength"]; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("minlength"); | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && conversions.long(value) === value) { | ||
return value; | ||
} | ||
} | ||
return -1; | ||
} finally { | ||
@@ -1029,3 +1052,10 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
esValue[implSymbol]["minLength"] = V; | ||
if (V < 0) { | ||
throw create_DOMException(globalObject, [ | ||
`The negative value ${V} cannot be set for the minLength property.`, | ||
"IndexSizeError" | ||
]); | ||
} | ||
esValue[implSymbol]._reflectSetTheContentAttribute("minlength", String(V)); | ||
} finally { | ||
@@ -1296,3 +1326,10 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
return esValue[implSymbol]["size"]; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("size"); | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 1 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
return 20; | ||
} finally { | ||
@@ -1319,3 +1356,11 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
esValue[implSymbol]["size"] = V; | ||
if (V === 0) { | ||
throw create_DOMException(globalObject, [ | ||
`The value ${V} cannot be set for the size property.`, | ||
"IndexSizeError" | ||
]); | ||
} | ||
const newValue = V <= 2147483647 && V >= 1 ? V : 20; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("size", String(newValue)); | ||
} finally { | ||
@@ -1322,0 +1367,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -113,7 +113,9 @@ "use strict"; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("value"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseInteger_helpers_strings(value); | ||
if (value !== null && conversions.long(value) === value) { | ||
return value; | ||
} | ||
} | ||
value = parseInteger_helpers_strings(value); | ||
return value !== null && conversions.long(value) === value ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -120,0 +122,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -273,7 +273,9 @@ "use strict"; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("hspace"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -300,4 +302,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(newValue)); | ||
} finally { | ||
@@ -320,7 +322,9 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("scrollamount"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -347,4 +351,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("scrollamount", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("scrollamount", String(newValue)); | ||
} finally { | ||
@@ -367,7 +371,9 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("scrolldelay"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -394,4 +400,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("scrolldelay", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("scrolldelay", String(newValue)); | ||
} finally { | ||
@@ -457,7 +463,9 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("vspace"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -484,4 +492,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(newValue)); | ||
} finally { | ||
@@ -488,0 +496,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -636,7 +636,9 @@ "use strict"; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("hspace"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -663,4 +665,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("hspace", String(newValue)); | ||
} finally { | ||
@@ -723,7 +725,9 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("vspace"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -750,4 +754,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("vspace", String(newValue)); | ||
} finally { | ||
@@ -754,0 +758,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -113,7 +113,9 @@ "use strict"; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseInteger_helpers_strings(value); | ||
if (value !== null && conversions.long(value) === value) { | ||
return value; | ||
} | ||
} | ||
value = parseInteger_helpers_strings(value); | ||
return value !== null && conversions.long(value) === value ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -120,0 +122,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -9,2 +9,3 @@ "use strict"; | ||
const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; | ||
const parseFloatingPointNumber_helpers_strings = require("../helpers/strings.js").parseFloatingPointNumber; | ||
const implSymbol = utils.implSymbol; | ||
@@ -151,3 +152,10 @@ const ctorRegistrySymbol = utils.ctorRegistrySymbol; | ||
try { | ||
return esValue[implSymbol]["max"]; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("max"); | ||
if (value !== null) { | ||
value = parseFloatingPointNumber_helpers_strings(value); | ||
if (value !== null && value > 0) { | ||
return value; | ||
} | ||
} | ||
return 1; | ||
} finally { | ||
@@ -174,3 +182,5 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
esValue[implSymbol]["max"] = V; | ||
if (V > 0) { | ||
esValue[implSymbol]._reflectSetTheContentAttribute("max", String(V)); | ||
} | ||
} finally { | ||
@@ -177,0 +187,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -535,7 +535,9 @@ "use strict"; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("size"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -562,4 +564,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("size", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("size", String(newValue)); | ||
} finally { | ||
@@ -566,0 +568,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -7,2 +7,3 @@ "use strict"; | ||
const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor; | ||
const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; | ||
const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps; | ||
@@ -112,3 +113,16 @@ const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; | ||
try { | ||
return esValue[implSymbol]["colSpan"]; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("colspan"); | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null) { | ||
if (value < 1) { | ||
return 1; | ||
} else if (value >= 1 && value <= 1000) { | ||
return value; | ||
} else { | ||
return 1000; | ||
} | ||
} | ||
} | ||
return 1; | ||
} finally { | ||
@@ -135,3 +149,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
esValue[implSymbol]["colSpan"] = V; | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 1; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("colspan", String(newValue)); | ||
} finally { | ||
@@ -153,3 +168,16 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
return esValue[implSymbol]["rowSpan"]; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("rowspan"); | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null) { | ||
if (value < 0) { | ||
return 0; | ||
} else if (value >= 0 && value <= 65534) { | ||
return value; | ||
} else { | ||
return 65534; | ||
} | ||
} | ||
} | ||
return 1; | ||
} finally { | ||
@@ -176,3 +204,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
esValue[implSymbol]["rowSpan"] = V; | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 1; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("rowspan", String(newValue)); | ||
} finally { | ||
@@ -179,0 +208,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -113,7 +113,15 @@ "use strict"; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("span"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null) { | ||
if (value < 1) { | ||
return 1; | ||
} else if (value >= 1 && value <= 1000) { | ||
return value; | ||
} else { | ||
return 1000; | ||
} | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 1; | ||
} finally { | ||
@@ -140,4 +148,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("span", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 1; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("span", String(newValue)); | ||
} finally { | ||
@@ -144,0 +152,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -10,3 +10,4 @@ "use strict"; | ||
const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps; | ||
const parseInteger_helpers_strings = require("../helpers/strings.js").parseInteger; | ||
const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger; | ||
const create_DOMException = require("./DOMException.js").create; | ||
const implSymbol = utils.implSymbol; | ||
@@ -394,3 +395,10 @@ const ctorRegistrySymbol = utils.ctorRegistrySymbol; | ||
try { | ||
return esValue[implSymbol]["cols"]; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("cols"); | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 1 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
return 20; | ||
} finally { | ||
@@ -417,3 +425,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
esValue[implSymbol]["cols"] = V; | ||
const newValue = V <= 2147483647 && V >= 1 ? V : 20; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("cols", String(newValue)); | ||
} finally { | ||
@@ -571,7 +580,9 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("maxlength"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && conversions.long(value) === value) { | ||
return value; | ||
} | ||
} | ||
value = parseInteger_helpers_strings(value); | ||
return value !== null && conversions.long(value) === value ? value : 0; | ||
return -1; | ||
} finally { | ||
@@ -598,2 +609,9 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
if (V < 0) { | ||
throw create_DOMException(globalObject, [ | ||
`The negative value ${V} cannot be set for the maxLength property.`, | ||
"IndexSizeError" | ||
]); | ||
} | ||
esValue[implSymbol]._reflectSetTheContentAttribute("maxlength", String(V)); | ||
@@ -617,7 +635,9 @@ } finally { | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("minlength"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && conversions.long(value) === value) { | ||
return value; | ||
} | ||
} | ||
value = parseInteger_helpers_strings(value); | ||
return value !== null && conversions.long(value) === value ? value : 0; | ||
return -1; | ||
} finally { | ||
@@ -644,2 +664,9 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
if (V < 0) { | ||
throw create_DOMException(globalObject, [ | ||
`The negative value ${V} cannot be set for the minLength property.`, | ||
"IndexSizeError" | ||
]); | ||
} | ||
esValue[implSymbol]._reflectSetTheContentAttribute("minlength", String(V)); | ||
@@ -828,3 +855,10 @@ } finally { | ||
try { | ||
return esValue[implSymbol]["rows"]; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("rows"); | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 1 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
return 2; | ||
} finally { | ||
@@ -851,3 +885,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
esValue[implSymbol]["rows"] = V; | ||
const newValue = V <= 2147483647 && V >= 1 ? V : 2; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("rows", String(newValue)); | ||
} finally { | ||
@@ -854,0 +889,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
@@ -116,7 +116,9 @@ "use strict"; | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("width"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -143,4 +145,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("width", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("width", String(newValue)); | ||
} finally { | ||
@@ -163,7 +165,9 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
let value = esValue[implSymbol]._reflectGetTheContentAttribute("height"); | ||
if (value === null) { | ||
return 0; | ||
if (value !== null) { | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
if (value !== null && value >= 0 && value <= 2147483647) { | ||
return value; | ||
} | ||
} | ||
value = parseNonNegativeInteger_helpers_strings(value); | ||
return value !== null && value >= 0 && value <= 2147483647 ? value : 0; | ||
return 0; | ||
} finally { | ||
@@ -190,4 +194,4 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); | ||
try { | ||
const n = V <= 2147483647 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("height", String(n)); | ||
const newValue = V <= 2147483647 && V >= 0 ? V : 0; | ||
esValue[implSymbol]._reflectSetTheContentAttribute("height", String(newValue)); | ||
} finally { | ||
@@ -194,0 +198,0 @@ ceReactionsPostSteps_helpers_custom_elements(globalObject); |
"use strict"; | ||
const domSelector = require("@asamuzakjp/dom-selector"); | ||
const { wrapperForImpl } = require("../generated/utils"); | ||
const nwsapi = require("nwsapi"); | ||
exports.matchesDontThrow = (selectors, elementImpl) => { | ||
const element = wrapperForImpl(elementImpl); | ||
try { | ||
return domSelector.matches(selectors, element); | ||
} catch { | ||
return false; | ||
const idlUtils = require("../generated/utils"); | ||
function initNwsapi(node) { | ||
const { _globalObject, _ownerDocument } = node; | ||
return nwsapi({ | ||
document: idlUtils.wrapperForImpl(_ownerDocument), | ||
DOMException: _globalObject.DOMException | ||
}); | ||
} | ||
exports.matchesDontThrow = (elImpl, selector) => { | ||
const document = elImpl._ownerDocument; | ||
if (!document._nwsapiDontThrow) { | ||
document._nwsapiDontThrow = initNwsapi(elImpl); | ||
document._nwsapiDontThrow.configure({ | ||
LOGERRORS: false, | ||
VERBOSITY: false, | ||
IDS_DUPES: true, | ||
MIXEDCASE: true | ||
}); | ||
} | ||
}; | ||
exports.matches = (selectors, elementImpl) => { | ||
const element = wrapperForImpl(elementImpl); | ||
return domSelector.matches(selectors, element); | ||
return document._nwsapiDontThrow.match(selector, idlUtils.wrapperForImpl(elImpl)); | ||
}; | ||
exports.closest = (selectors, elementImpl) => { | ||
const element = wrapperForImpl(elementImpl); | ||
return domSelector.closest(selectors, element); | ||
}; | ||
// nwsapi gets `document.documentElement` at creation-time, so we have to initialize lazily, since in the initial | ||
// stages of Document initialization, there is no documentElement present yet. | ||
exports.addNwsapi = parentNode => { | ||
const document = parentNode._ownerDocument; | ||
exports.querySelector = (selectors, parentNodeImpl) => { | ||
const node = wrapperForImpl(parentNodeImpl); | ||
return domSelector.querySelector(selectors, node); | ||
}; | ||
if (!document._nwsapi) { | ||
document._nwsapi = initNwsapi(parentNode); | ||
document._nwsapi.configure({ | ||
LOGERRORS: false, | ||
IDS_DUPES: true, | ||
MIXEDCASE: true | ||
}); | ||
} | ||
exports.querySelectorAll = (selectors, parentNodeImpl) => { | ||
const node = wrapperForImpl(parentNodeImpl); | ||
return domSelector.querySelectorAll(selectors, node); | ||
return document._nwsapi; | ||
}; |
"use strict"; | ||
const cssom = require("rrweb-cssom"); | ||
@@ -172,4 +171,4 @@ const { CSSStyleDeclaration } = require("cssstyle"); | ||
function matches(rule, elementImpl) { | ||
return matchesDontThrow(rule.selectorText, elementImpl); | ||
function matches(rule, element) { | ||
return matchesDontThrow(element, rule.selectorText); | ||
} | ||
@@ -176,0 +175,0 @@ |
"use strict"; | ||
const { closest, matches } = require("../helpers/selectors"); | ||
const { addNwsapi } = require("../helpers/selectors"); | ||
const { HTML_NS } = require("../helpers/namespaces"); | ||
const { mixin, memoizeQuery } = require("../../utils"); | ||
const idlUtils = require("../generated/utils"); | ||
const NodeImpl = require("./Node-impl").implementation; | ||
@@ -548,13 +549,6 @@ const ParentNodeImpl = require("./ParentNode-impl").implementation; | ||
closest(selectors) { | ||
return closest(selectors, this); | ||
const matcher = addNwsapi(this); | ||
return matcher.closest(selectors, idlUtils.wrapperForImpl(this)); | ||
} | ||
matches(selectors) { | ||
return matches(selectors, this); | ||
} | ||
webkitMatchesSelector(selectors) { | ||
return matches(selectors, this); | ||
} | ||
// https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes | ||
@@ -596,4 +590,12 @@ _reflectGetTheElement() { | ||
ElementImpl.prototype.matches = function (selectors) { | ||
const matcher = addNwsapi(this); | ||
return matcher.match(selectors, idlUtils.wrapperForImpl(this)); | ||
}; | ||
ElementImpl.prototype.webkitMatchesSelector = ElementImpl.prototype.matches; | ||
module.exports = { | ||
implementation: ElementImpl | ||
}; |
@@ -751,45 +751,2 @@ "use strict"; | ||
// Reflected IDL attribute does not care about whether the content attribute applies. | ||
get maxLength() { | ||
if (!this.hasAttributeNS(null, "maxlength")) { | ||
return 524288; // stole this from chrome | ||
} | ||
return parseInt(this.getAttributeNS(null, "maxlength")); | ||
} | ||
set maxLength(value) { | ||
if (value < 0) { | ||
throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); | ||
} | ||
this.setAttributeNS(null, "maxlength", String(value)); | ||
} | ||
get minLength() { | ||
if (!this.hasAttributeNS(null, "minlength")) { | ||
return 0; | ||
} | ||
return parseInt(this.getAttributeNS(null, "minlength")); | ||
} | ||
set minLength(value) { | ||
if (value < 0) { | ||
throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); | ||
} | ||
this.setAttributeNS(null, "minlength", String(value)); | ||
} | ||
get size() { | ||
if (!this.hasAttributeNS(null, "size")) { | ||
return 20; | ||
} | ||
return parseInt(this.getAttributeNS(null, "size")); | ||
} | ||
set size(value) { | ||
if (value <= 0) { | ||
throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); | ||
} | ||
this.setAttributeNS(null, "size", String(value)); | ||
} | ||
// https://html.spec.whatwg.org/multipage/input.html#the-min-and-max-attributes | ||
@@ -796,0 +753,0 @@ get _minimum() { |
@@ -20,5 +20,7 @@ "use strict"; | ||
const valueAttr = this.getAttributeNS(null, "value"); | ||
const parsedValue = parseFloatingPointNumber(valueAttr); | ||
if (parsedValue !== null && parsedValue > 0) { | ||
return parsedValue; | ||
if (valueAttr !== null) { | ||
const parsedValue = parseFloatingPointNumber(valueAttr); | ||
if (parsedValue !== null && parsedValue > 0) { | ||
return parsedValue; | ||
} | ||
} | ||
@@ -31,5 +33,17 @@ return 0; | ||
const value = this._value; | ||
return value > this.max ? this.max : value; | ||
return value > this._maximumValue ? this._maximumValue : value; | ||
} | ||
// https://html.spec.whatwg.org/multipage/form-elements.html#concept-progress-maximum | ||
get _maximumValue() { | ||
const maxAttr = this.getAttributeNS(null, "max"); | ||
if (maxAttr !== null) { | ||
const parsedMax = parseFloatingPointNumber(maxAttr); | ||
if (parsedMax !== null && parsedMax > 0) { | ||
return parsedMax; | ||
} | ||
} | ||
return 1.0; | ||
} | ||
get value() { | ||
@@ -45,18 +59,2 @@ if (this._isDeterminate) { | ||
get max() { | ||
const max = this.getAttributeNS(null, "max"); | ||
if (max !== null) { | ||
const parsedMax = parseFloatingPointNumber(max); | ||
if (parsedMax !== null && parsedMax > 0) { | ||
return parsedMax; | ||
} | ||
} | ||
return 1.0; | ||
} | ||
set max(value) { | ||
if (value > 0) { | ||
this.setAttributeNS(null, "max", value); | ||
} | ||
} | ||
get position() { | ||
@@ -67,3 +65,3 @@ if (!this._isDeterminate) { | ||
return this._currentValue / this.max; | ||
return this._currentValue / this._maximumValue; | ||
} | ||
@@ -70,0 +68,0 @@ |
@@ -44,3 +44,3 @@ "use strict"; | ||
return wrap === "hard" ? | ||
textareaWrappingTransformation(apiValue, this.cols) : | ||
textareaWrappingTransformation(apiValue, this.getAttributeNS(null, "cols") ?? 20) : | ||
apiValue; | ||
@@ -187,30 +187,2 @@ } | ||
get cols() { | ||
if (!this.hasAttributeNS(null, "cols")) { | ||
return 20; | ||
} | ||
return parseInt(this.getAttributeNS(null, "cols")); | ||
} | ||
set cols(value) { | ||
if (value <= 0) { | ||
throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); | ||
} | ||
this.setAttributeNS(null, "cols", String(value)); | ||
} | ||
get rows() { | ||
if (!this.hasAttributeNS(null, "rows")) { | ||
return 2; | ||
} | ||
return parseInt(this.getAttributeNS(null, "rows")); | ||
} | ||
set rows(value) { | ||
if (value <= 0) { | ||
throw DOMException.create(this._globalObject, ["The index is not in the allowed range.", "IndexSizeError"]); | ||
} | ||
this.setAttributeNS(null, "rows", String(value)); | ||
} | ||
_barredFromConstraintValidationSpecialization() { | ||
@@ -217,0 +189,0 @@ return this.hasAttributeNS(null, "readonly"); |
"use strict"; | ||
const idlUtils = require("../generated/utils"); | ||
const NodeList = require("../generated/NodeList"); | ||
const HTMLCollection = require("../generated/HTMLCollection"); | ||
const { querySelector, querySelectorAll } = require("../helpers/selectors"); | ||
const { addNwsapi } = require("../helpers/selectors"); | ||
const { domSymbolTree } = require("../helpers/internal-constants"); | ||
@@ -64,3 +65,7 @@ const NODE_TYPE = require("../node-type"); | ||
querySelector(selectors) { | ||
return querySelector(selectors, this); | ||
if (shouldAlwaysSelectNothing(this)) { | ||
return null; | ||
} | ||
const matcher = addNwsapi(this); | ||
return idlUtils.implForWrapper(matcher.first(selectors, idlUtils.wrapperForImpl(this))); | ||
} | ||
@@ -70,9 +75,19 @@ | ||
querySelectorAll(selectors) { | ||
const nodes = querySelectorAll(selectors, this); | ||
return NodeList.create(this._globalObject, [], { nodes }); | ||
if (shouldAlwaysSelectNothing(this)) { | ||
return NodeList.create(this._globalObject, [], { nodes: [] }); | ||
} | ||
const matcher = addNwsapi(this); | ||
const list = matcher.select(selectors, idlUtils.wrapperForImpl(this)); | ||
return NodeList.create(this._globalObject, [], { nodes: list.map(n => idlUtils.tryImplForWrapper(n)) }); | ||
} | ||
} | ||
function shouldAlwaysSelectNothing(elImpl) { | ||
// This is true during initialization. | ||
return elImpl === elImpl._ownerDocument && !elImpl.documentElement; | ||
} | ||
module.exports = { | ||
implementation: ParentNodeImpl | ||
}; |
{ | ||
"name": "jsdom", | ||
"version": "23.2.0", | ||
"version": "24.0.0", | ||
"description": "A JavaScript implementation of many web standards", | ||
@@ -23,3 +23,2 @@ "keywords": [ | ||
"dependencies": { | ||
"@asamuzakjp/dom-selector": "^2.0.1", | ||
"cssstyle": "^4.0.1", | ||
@@ -33,2 +32,3 @@ "data-urls": "^5.0.0", | ||
"is-potential-custom-element-name": "^1.0.1", | ||
"nwsapi": "^2.2.7", | ||
"parse5": "^7.1.2", | ||
@@ -35,0 +35,0 @@ "rrweb-cssom": "^0.6.0", |
3109927
82937
+ Addednwsapi@^2.2.7
+ Addednwsapi@2.2.9(transitive)
- Removed@asamuzakjp/dom-selector@^2.0.1
- Removed@asamuzakjp/dom-selector@2.0.2(transitive)
- Removedbidi-js@1.0.3(transitive)
- Removedcss-tree@2.3.1(transitive)
- Removedmdn-data@2.0.30(transitive)
- Removedrequire-from-string@2.0.2(transitive)
- Removedsource-map-js@1.2.0(transitive)