pull/11387/head
Rich Harris 2 years ago
parent c5cf371067
commit 6f06bd9300

@ -908,14 +908,14 @@ function serialize_element_spread_attributes(
(element.type === 'RegularElement' && is_custom_element_node(element))
? b.false
: b.true;
const is_svg = element.metadata.svg ? b.true : b.false;
const is_mathml = element.metadata.mathml ? b.true : b.false;
const is_html = element.metadata.svg || element.metadata.mathml ? b.false : b.true;
/** @type {import('estree').Expression[]} */
const args = [
b.array(values),
lowercase_attributes,
is_svg,
is_mathml,
is_html,
b.literal(context.state.analysis.css.hash)
];

@ -289,20 +289,12 @@ export function css_props(payload, is_html, props, component) {
/**
* @param {Record<string, unknown>[]} attrs
* @param {boolean} lowercase_attributes
* @param {boolean} is_svg
* @param {boolean} is_mathml
* @param {boolean} is_html
* @param {string} class_hash
* @param {{ styles: Record<string, string> | null; classes: string }} [additional]
* @returns {string}
*/
export function spread_attributes(
attrs,
lowercase_attributes,
is_svg,
is_mathml,
class_hash,
additional
) {
export function spread_attributes(attrs, lowercase_attributes, is_html, class_hash, additional) {
/** @type {Record<string, unknown>} */
const merged_attrs = {};
let key;
@ -352,7 +344,7 @@ export function spread_attributes(
if (lowercase_attributes) {
name = name.toLowerCase();
}
const is_boolean = !is_svg && !is_mathml && DOMBooleanAttributes.includes(name);
const is_boolean = is_html && DOMBooleanAttributes.includes(name);
attr_str += attr(name, merged_attrs[name], is_boolean);
}

Loading…
Cancel
Save