-
Notifications
You must be signed in to change notification settings - Fork 401
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
perf: optimize scoped ID for light/native #4399
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -564,12 +564,6 @@ function k(compilerKey: number, obj: any): string | void { | |
function gid(id: string | undefined | null): string | null | undefined { | ||
const vmBeingRendered = getVMBeingRendered()!; | ||
if (isUndefined(id) || id === '') { | ||
if (process.env.NODE_ENV !== 'production') { | ||
logError( | ||
`Invalid id value "${id}". The id attribute must contain a non-empty string.`, | ||
vmBeingRendered | ||
); | ||
} | ||
return id; | ||
} | ||
// We remove attributes when they are assigned a value of null | ||
|
@@ -587,14 +581,6 @@ function gid(id: string | undefined | null): string | null | undefined { | |
function fid(url: string | undefined | null): string | null | undefined { | ||
const vmBeingRendered = getVMBeingRendered()!; | ||
if (isUndefined(url) || url === '') { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (isUndefined(url)) { | ||
logError( | ||
`Undefined url value for "href" or "xlink:href" attribute. Expected a non-empty string.`, | ||
vmBeingRendered | ||
); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got rid of these |
||
return url; | ||
} | ||
// We remove attributes when they are assigned a value of null | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...arma/test/synthetic-shadow/scoped-id/x/hrefDynamicEmptyString/hrefDynamicEmptyString.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<template> | ||
<div class="sanjo" id={emptyString}></div> | ||
|
||
<div> | ||
<a class="anchor-empty-string" href={emptyString} data-id={emptyString}>fragment url</a> | ||
</div> | ||
|
||
<div> | ||
<map name="blackdot"> | ||
<area class="area-empty-string" href={emptyString} data-id={emptyString} shape="circle" coords="75,75,75" /> | ||
</map> | ||
</div> | ||
</template> |
7 changes: 7 additions & 0 deletions
7
...-karma/test/synthetic-shadow/scoped-id/x/hrefDynamicEmptyString/hrefDynamicEmptyString.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class HrefDynamicEmptyString extends LightningElement { | ||
get emptyString() { | ||
return ''; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
.../integration-karma/test/synthetic-shadow/scoped-id/x/hrefDynamicNull/hrefDynamicNull.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<template> | ||
<div class="sanjo" id={nullo}></div> | ||
|
||
<div> | ||
<a class="anchor-empty-string" href={nullo} data-id={nullo}>fragment url</a> | ||
</div> | ||
|
||
<div> | ||
<map name="blackdot"> | ||
<area class="area-empty-string" href={nullo} data-id={nullo} shape="circle" coords="75,75,75" /> | ||
</map> | ||
</div> | ||
</template> |
7 changes: 7 additions & 0 deletions
7
...wc/integration-karma/test/synthetic-shadow/scoped-id/x/hrefDynamicNull/hrefDynamicNull.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class HrefDynamicNull extends LightningElement { | ||
get nullo() { | ||
return null; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...on-karma/test/synthetic-shadow/scoped-id/x/hrefDynamicUndefined/hrefDynamicUndefined.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<template> | ||
<div class="sanjo" id={undef}></div> | ||
|
||
<div> | ||
<a class="anchor-empty-string" href={undef} data-id={undef}>fragment url</a> | ||
</div> | ||
|
||
<div> | ||
<map name="blackdot"> | ||
<area class="area-empty-string" href={undef} data-id={undef} shape="circle" coords="75,75,75" /> | ||
</map> | ||
</div> | ||
</template> |
7 changes: 7 additions & 0 deletions
7
...tion-karma/test/synthetic-shadow/scoped-id/x/hrefDynamicUndefined/hrefDynamicUndefined.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class HrefDynamicUndefined extends LightningElement { | ||
get undef() { | ||
return undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...compiler/src/__tests__/fixtures/scoped-id-optimization/static-optimized/light/actual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template lwc:render-mode="light"> | ||
<!-- static values --> | ||
<label for="foo">Click me:</label> | ||
<input type="checkbox" id="foo"> | ||
|
||
<a href="#bar">Click to scroll</a> | ||
<section id="bar">Scroll to me</section> | ||
|
||
<!-- dynamic values --> | ||
<label for={foo}>Click me:</label> | ||
<input type="checkbox" id={foo}> | ||
|
||
<a href={bar}>Click to scroll</a> | ||
<section id={bar}>Scroll to me</section> | ||
</template> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just another case I think is worth testing, especially if we start actually shipping
disableSyntheticShadowSupport=true
.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.
Eagerly anticipating another
chore(ci): rebalance karma tests
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.
You guessed it! It's imbalanced again. I wish GH had an easier way to do this. 🫠