diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/error-is-dynamic/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/error-is-dynamic/actual.html
deleted file mode 100644
index 3184647666..0000000000
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/error-is-dynamic/actual.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/error-is-dynamic/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/error-is-dynamic/expected.js
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/error-is-dynamic/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/error-is-dynamic/metadata.json
deleted file mode 100644
index 251acf6e51..0000000000
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/error-is-dynamic/metadata.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "warnings": [
- {
- "code": 1062,
- "message": "LWC1062: \"is\" attribute value can't be an expression",
- "level": 1,
- "location": {
- "line": 2,
- "column": 13,
- "start": 23,
- "length": 30
- }
- }
- ],
- "metadata": {
- "definedSlots": [],
- "templateUsedIds": [
- "dynamicCmp"
- ],
- "templateDependencies": []
- }
-}
\ No newline at end of file
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/actual.html
index bf26b43c43..b4c3b8a5ce 100644
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/actual.html
+++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/actual.html
@@ -24,9 +24,6 @@
-
-
-
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/expected.js
index 25ae61c5e9..fc7c46d4e8 100644
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/expected.js
+++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/expected.js
@@ -1,8 +1,5 @@
import _nsFoo from "ns/foo";
import _nsBar from "ns/bar";
-import _nsBuzz from "ns/buzz";
-import _nsTable from "ns/table";
-import _nsInput from "ns/input";
import { registerTemplate, sanitizeAttribute } from "lwc";
function tmpl($api, $cmp, $slotset, $ctx) {
@@ -77,7 +74,12 @@ function tmpl($api, $cmp, $slotset, $ctx) {
"use",
{
attrs: {
- "xlink:href": sanitizeAttribute("use", "http://www.w3.org/2000/svg", "xlink:href", "xx")
+ "xlink:href": sanitizeAttribute(
+ "use",
+ "http://www.w3.org/2000/svg",
+ "xlink:href",
+ "xx"
+ )
},
key: 6
},
@@ -85,60 +87,13 @@ function tmpl($api, $cmp, $slotset, $ctx) {
)
]
),
- api_custom_element(
- "div",
- _nsBuzz,
- {
- attrs: {
- is: "ns-buzz"
- },
- props: {
- bgColor: "x",
- ariaHidden: "hidden"
- },
- key: 7
- },
- []
- ),
api_element(
"table",
{
attrs: {
bgcolor: "x"
},
- key: 8
- },
- []
- ),
- api_custom_element(
- "table",
- _nsTable,
- {
- attrs: {
- is: "ns-table"
- },
- props: {
- bgColor: "x",
- tabIndex: "0",
- bar: "test",
- min: "3"
- },
- key: 9
- },
- []
- ),
- api_custom_element(
- "input",
- _nsInput,
- {
- attrs: {
- is: "ns-input"
- },
- props: {
- minLength: "3",
- maxLength: "10"
- },
- key: 10
+ key: 7
},
[]
),
@@ -149,7 +104,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
attrs: {
"aria-hidden": "hidden"
},
- key: 11
+ key: 8
},
[]
)
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/metadata.json
index 1a813445e1..5ce5a7f4e6 100644
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/metadata.json
+++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/attributes/mixed-props-attrs/metadata.json
@@ -54,56 +54,6 @@
"value": "blue"
}
}
- },
- {
- "moduleName": "ns/buzz",
- "tagName": "div",
- "properties": {
- "bgColor": {
- "type": "literal",
- "value": "x"
- },
- "ariaHidden": {
- "type": "literal",
- "value": "hidden"
- }
- }
- },
- {
- "moduleName": "ns/table",
- "tagName": "table",
- "properties": {
- "bgColor": {
- "type": "literal",
- "value": "x"
- },
- "tabIndex": {
- "type": "literal",
- "value": "0"
- },
- "bar": {
- "type": "literal",
- "value": "test"
- },
- "min": {
- "type": "literal",
- "value": "3"
- }
- }
- },
- {
- "moduleName": "ns/input",
- "tagName": "input",
- "properties": {
- "minLength": {
- "type": "literal",
- "value": "3"
- },
- "maxLength": {
- "type": "literal",
- "value": "10"
- }
- }
}
]
}
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is-with-other-directives/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is-with-other-directives/actual.html
deleted file mode 100644
index 5a7ed81888..0000000000
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is-with-other-directives/actual.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is-with-other-directives/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is-with-other-directives/expected.js
deleted file mode 100644
index 15ca690bf7..0000000000
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is-with-other-directives/expected.js
+++ /dev/null
@@ -1,45 +0,0 @@
-import _nsRow from "ns/row";
-import { registerTemplate } from "lwc";
-
-function tmpl($api, $cmp, $slotset, $ctx) {
- const {
- k: api_key,
- c: api_custom_element,
- i: api_iterator,
- h: api_element
- } = $api;
- return [
- api_element(
- "table",
- {
- key: 2
- },
- [
- api_element(
- "tbody",
- {
- key: 3
- },
- api_iterator($cmp.rows, function(row) {
- return row.visible
- ? api_custom_element(
- "tr",
- _nsRow,
- {
- attrs: {
- is: "ns-row"
- },
- key: api_key(4, row.id)
- },
- []
- )
- : null;
- })
- )
- ]
- )
- ];
-}
-
-export default registerTemplate(tmpl);
-tmpl.stylesheets = [];
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is-with-other-directives/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is-with-other-directives/metadata.json
deleted file mode 100644
index e0fe26258d..0000000000
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is-with-other-directives/metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "warnings": [],
- "metadata": {
- "definedSlots": [],
- "templateUsedIds": [
- "rows"
- ],
- "templateDependencies": [
- {
- "moduleName": "ns/row",
- "tagName": "tr"
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is/actual.html
deleted file mode 100644
index b2e5d9b3a5..0000000000
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is/actual.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is/expected.js
deleted file mode 100644
index 5ad92e6787..0000000000
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is/expected.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import _nsRow from "ns/row";
-import { registerTemplate } from "lwc";
-
-function tmpl($api, $cmp, $slotset, $ctx) {
- const { c: api_custom_element, h: api_element } = $api;
- return [
- api_element(
- "table",
- {
- key: 2
- },
- [
- api_element(
- "tbody",
- {
- key: 3
- },
- [
- api_custom_element(
- "tr",
- _nsRow,
- {
- attrs: {
- is: "ns-row"
- },
- key: 4
- },
- []
- )
- ]
- )
- ]
- )
- ];
-}
-
-export default registerTemplate(tmpl);
-tmpl.stylesheets = [];
diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is/metadata.json
deleted file mode 100644
index e10a6e4357..0000000000
--- a/packages/@lwc/template-compiler/src/__tests__/fixtures/directive-is/is/metadata.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "warnings": [],
- "metadata": {
- "definedSlots": [],
- "templateUsedIds": [],
- "templateDependencies": [
- {
- "moduleName": "ns/row",
- "tagName": "tr"
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/packages/@lwc/template-compiler/src/__tests__/parser.spec.ts b/packages/@lwc/template-compiler/src/__tests__/parser.spec.ts
index 8d5b3f7e03..f50378d4e7 100644
--- a/packages/@lwc/template-compiler/src/__tests__/parser.spec.ts
+++ b/packages/@lwc/template-compiler/src/__tests__/parser.spec.ts
@@ -546,21 +546,6 @@ describe('props and attributes', () => {
'data-xx': { value: 'foo' },
});
});
-
- it('custom element using is with attribute / prop mix', () => {
- const { root } = parseTemplate(`
-
- `);
- expect(root.children[0].props).toMatchObject({
- bar: { value: 'test' },
- min: { value: '3' },
- bgColor: { value: 'x' },
- tabIndex: { value: '2' },
- });
- expect(root.children[0].attrs).toMatchObject({
- is: { value: 'x-table' },
- });
- });
});
describe('metadata', () => {
@@ -582,15 +567,6 @@ describe('metadata', () => {
expect(Array.from(state.ids)).toEqual(['state', 'componentProp']);
});
- it('dependent component', () => {
- const { state } = parseTemplate(`
-
-
- `);
-
- expect(Array.from(state.dependencies)).toEqual(['x-menu', 'x-button']);
- });
-
it('slots', () => {
const { state } = parseTemplate(`
diff --git a/packages/@lwc/template-compiler/src/parser/attribute.ts b/packages/@lwc/template-compiler/src/parser/attribute.ts
index 7b16ab736d..eff662b99d 100644
--- a/packages/@lwc/template-compiler/src/parser/attribute.ts
+++ b/packages/@lwc/template-compiler/src/parser/attribute.ts
@@ -199,10 +199,6 @@ function isAriaAttribute(attrName: string): boolean {
return attrName === 'role' || ARIA_RE.test(attrName);
}
-export function isDeprecatedIsAttribute(attrName: string): boolean {
- return attrName === 'lwc-deprecated:is';
-}
-
export function isProhibitedIsAttribute(attrName: string): boolean {
return attrName === 'is';
}
@@ -225,16 +221,11 @@ function isDataAttribute(attrName: string): boolean {
}
function isFmkAttribute(attrName: string): boolean {
- return attrName === 'lwc-deprecated:is' || attrName === 'key' || attrName === 'slot';
+ return attrName === 'key' || attrName === 'slot';
}
function isCustomElementAttribute(attrName: string): boolean {
- return (
- attrName === 'lwc-deprecated:is' ||
- attrName === 'key' ||
- attrName === 'slot' ||
- !!attrName.match(DATA_RE)
- );
+ return attrName === 'key' || attrName === 'slot' || !!attrName.match(DATA_RE);
}
function isInputStateAttribute(element: IRElement, attrName: string) {
@@ -262,13 +253,6 @@ export function isAttribute(element: IRElement, attrName: string): boolean {
return false;
}
- // Handle attributes applied to a subclassed element via the is="" attribute.
- // Returns true only attributes that are valid attribute for the base element.
- const hasDeprecatedIsAttr = !!getAttribute(element, 'lwc-deprecated:is');
- if (hasDeprecatedIsAttr) {
- return isValidHTMLAttribute(element.tag, attrName);
- }
-
// Handle general case where only standard element have attribute value.
return !isCustomElement(element);
}
diff --git a/packages/@lwc/template-compiler/src/parser/index.ts b/packages/@lwc/template-compiler/src/parser/index.ts
index 39fe9e8764..232ffe0190 100644
--- a/packages/@lwc/template-compiler/src/parser/index.ts
+++ b/packages/@lwc/template-compiler/src/parser/index.ts
@@ -23,7 +23,6 @@ import {
normalizeAttributeValue,
isValidHTMLAttribute,
attributeToPropertyName,
- isDeprecatedIsAttribute,
isProhibitedIsAttribute,
isSvgUseHref,
isTabIndexAttribute,
@@ -652,32 +651,18 @@ export default function parse(
function applyComponent(element: IRElement) {
const { tag } = element;
- let component: string | undefined;
- if (tag.includes('-') && !DASHED_TAGNAME_ELEMENT_SET.has(tag)) {
- component = tag;
- }
-
- const isAttr = getTemplateAttribute(element, 'lwc-deprecated:is');
- if (isAttr) {
- if (isAttr.type !== IRAttributeType.String) {
- return warnAt(
- ParserDiagnostics.DEPRECATED_IS_ATTRIBUTE_CANNOT_BE_EXPRESSION,
- [],
- isAttr.location
- );
- }
-
- // Don't remove the is, because passed as attribute
- component = isAttr.value;
+ // Check if the element tag is a valid custom element name and is not part of known standard
+ // element name containing a dash.
+ if (!tag.includes('-') || DASHED_TAGNAME_ELEMENT_SET.has(tag)) {
+ return;
}
- if (component) {
- element.component = component;
+ element.component = tag;
- if (!state.dependencies.includes(component)) {
- state.dependencies.push(component);
- }
+ // Add the component to the list of dependencies if not already present.
+ if (!state.dependencies.includes(tag)) {
+ state.dependencies.push(tag);
}
}
@@ -780,9 +765,6 @@ export default function parse(
if (isAttribute(element, name)) {
const attrs = element.attrs || (element.attrs = {});
-
- // authored code for 'lwc-deprecated:is' attr maps to 'is'
- const attrKey = isDeprecatedIsAttribute(name) ? 'is' : name;
const node = element.__original as parse5.AST.Default.Element;
// record secure import dependency if xlink attr is detected
@@ -791,7 +773,8 @@ export default function parse(
state.secureDependencies.push('sanitizeAttribute');
}
}
- attrs[attrKey] = attr;
+
+ attrs[name] = attr;
} else {
const props = element.props || (element.props = {});
props[attributeToPropertyName(element, name)] = attr;