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

test(ssr-compiler): specific fixture for lowercased attribute names #4706

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ekashida
Copy link
Member

Addresses a deviation in behavior for SSR.

@ekashida ekashida requested a review from a team as a code owner October 25, 2024 20:15
@ekashida ekashida changed the title test: ssr-specific test due to lowercased attribute names test(ssr-compiler): specific fixture for lowercased attribute names Oct 25, 2024
@ekashida ekashida enabled auto-merge (squash) October 25, 2024 20:16
@nolanlawson
Copy link
Collaborator

I think we should instead try to make engine-server emit attributes as lowercase when in the HTML namespace. I.e. fix this:

<x-cmp ARIA-LABEL="haha" DATA-FOO="bar" data-lwc-host-mutated="aria-label data-bar data-foo">

HTML is case-insensitive, so either way is fine. But under the hood, we need to think about deduping anyway:

connectedCallback() {
  this.setAttribute('FOO-BAR', 'a')
  this.removeAttribute('foo-bar') // should remove the attribute
}

So to solve this, we may as well lowercase the attribute when this.setAttribute is called.

For the SVG/MathML namespace we actually do have to care about case-sensitivity (e.g. SVG viewBox) so preserving the case is something we're going to have to tackle elsewhere. But it doesn't apply to the this.*Attribute case since LWC component hosts are only in the HTML namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants