Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only create document.title effect if value is dynamic #12698

Merged
merged 7 commits into from
Aug 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify
  • Loading branch information
Rich-Harris committed Aug 2, 2024
commit 5eaec309e4a86486976f7604ba65d6738dafe5af
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 229,16 @@ export function RegularElement(node, context) {
(attribute.value === true || is_text_attribute(attribute))
) {
const name = get_attribute_name(node, attribute, context);
const literal_value = /** @type {Literal} */ (
build_attribute_value(attribute.value, context).value
).value;
if (name !== 'class' || literal_value) {
const value = is_text_attribute(attribute) ? attribute.value[0].data : true;

if (name !== 'class' || value) {
// TODO namespace=foreign probably doesn't want to do template stuff at all and instead use programmatic methods
// to create the elements it needs.
context.state.template.push(
` ${attribute.name}${
is_boolean_attribute(name) && literal_value === true
is_boolean_attribute(name) && value === true
? ''
: `="${literal_value === true ? '' : escape_html(literal_value, true)}"`
: `="${value === true ? '' : escape_html(value, true)}"`
}`
);
continue;
Expand Down
Loading