-
Notifications
You must be signed in to change notification settings - Fork 382
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(template-compiler): add deprecated void elements back #3037
Conversation
export function isVoidElement(name: string, namespace: string): boolean { | ||
return namespace === HTML_NAMESPACE && VOID_ELEMENTS_SET.has(name.toLowerCase()); | ||
return ( | ||
namespace === HTML_NAMESPACE && |
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.
Probably be faster keeping two arrays, creating one set out of it and doing the .has(name.toLowerCase())
once?
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.
Great idea! Updated in the latest commit.
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.
lgtm
"warnings": [ | ||
{ | ||
"code": 1057, | ||
"message": "LWC1057: label is not valid attribute for menuitem. For more information refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menuitem", |
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.
🤔 ... label is supported in menuitem according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menuitem"
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 think this is because the list of attributes we're comparing against doesn't account for menuitem
attributes.
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 think it may be because these elements are technically deprecated?
"warnings": [ | ||
{ | ||
"code": 1057, | ||
"message": "LWC1057: name is not valid attribute for keygen. For more information refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen", |
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.
this is supported by keygen
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.
Same thing as the above except for keygen
Details
#2898 removed
<param>
,<menuitem>
, and<keygen>
as valid void elements as per the HTML spec (see here for a list of deprecated elements). However, this introduced a regression in some customer sandboxes because of the usage of the deprecated<param>
tag.This PR addresses the regression by adding the deprecated void elements back into the list of void elements that are checked in the template compiler until the LWC team has decided to fully deprecate them.
One thing to note is that there were several elements removed from the list of void elements that are checked against in the list of void elements.
These elements included both SVG and HTML elements, however, after doing an analysis of the splunk logs for all sandboxes, we determined that there were no occurrences of the SVG elements being used incorrectly as HTML elements.
I have therefore left out the SVG elements as void elements to be checked against.
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
There is an observable change, the components that used either
<param>
,<menuitem>
, or<keygen>
elements will not compile successfully.GUS work item
W-11731809