-
Notifications
You must be signed in to change notification settings - Fork 399
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: Use token for the styling host element instead of tag name #390
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor test update
const cmp = createElement('x-cmp', { is: Component }); | ||
document.body.appendChild(cmp); | ||
|
||
expect(querySelectorAll.call(cmp, 'div[token]').length).toBe(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use cmp.shadowRoot.querySelectorAll
Benchmark resultsBase commit: lwc-engine-benchmark
|
Benchmark resultsBase commit: lwc-engine-benchmark
|
@@ -65,12 +73,14 @@ function applyTokenToHost(vm: VM, html: Template): void { | |||
// Remove the token currently applied to the host element if different than the one associated | |||
// with the current template | |||
if (!isUndefined(oldToken)) { | |||
removeAttribute.call(host, oldToken); | |||
const oldHostToken = hostToken(oldToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isn't the token that we use in the engine already using the -host
postfix? why does the engine needs to know this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the engine should know how to build such token, it should come from compiler, and the engine should just pass it around.
@caridy Ready for review, the engine now expect 2 properties on the template, |
Benchmark resultsBase commit: lwc-engine-benchmark
|
Benchmark resultsBase commit: lwc-engine-benchmark
|
## Details Cleanup old style related code in the compiler: * remove `style` property from the component class. The style injection is now done at evaluation time and doesn't rely on an external system to inject it. (obsolete since #302) * Remove `tagName` parameter from `stylesheet` factory. (obsolete since #390) ## Does this PR introduce a breaking change? * [ ] Yes * [X] No
Details
This PR changes the way the host element gets targetted in CSS. Instead of relying on the tag name, the compiler now reuses the token to style the host element.
Fix #383
Does this PR introduce a breaking change?