fix: correct wrong fix, get test to actually do something (#16779)

#16773 added a test with _expected.html to a wrong suit, so it was ignored, and this allowed to slip in a new bug of printing the falsy hidden attribute as hidden (shortened enabled form).
That fix wasn't released yet, so no changeset.
pull/16774/head
7nik 3 weeks ago committed by GitHub
parent 8b106b94f4
commit 8c982f6101
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -22,11 +22,11 @@ const replacements = {
* @returns {string}
*/
export function attr(name, value, is_boolean = false) {
if (value == null || (!value && is_boolean)) return '';
// attribute hidden for values other than "until-found" behaves like a boolean attribute
if (name === 'hidden' && value !== 'until-found') {
is_boolean = true;
}
if (value == null || (!value && is_boolean)) return '';
const normalized = (name in replacements && replacements[name].get(value)) || value;
const assignment = is_boolean ? '' : `="${escape_html(normalized, true)}"`;
return ` ${name}${assignment}`;

Loading…
Cancel
Save