Skip to content

Commit 72963d4

Browse files
fix: add check for is attribute
1 parent 09510c8 commit 72963d4

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export function RegularElement(node, context) {
227227
node_id,
228228
attributes_id,
229229
(node.metadata.svg || node.metadata.mathml || is_custom_element_node(node)) && b.true,
230-
node.name.includes('-') && b.true,
230+
is_custom_element_node(node) && b.true,
231231
context.state
232232
);
233233

packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/fragment.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { cannot_be_set_statically } from '../../../../../../utils.js';
55
import { is_event_attribute, is_text_attribute } from '../../../../../utils/ast.js';
66
import * as b from '../../../../../utils/builders.js';
7+
import { is_custom_element_node } from '../../../../nodes.js';
78
import { build_template_chunk } from './utils.js';
89

910
/**
@@ -128,7 +129,7 @@ export function process_children(nodes, initial, is_element, { visit, state }) {
128129
function is_static_element(node, state) {
129130
if (node.type !== 'RegularElement') return false;
130131
if (node.fragment.metadata.dynamic) return false;
131-
if (node.name.includes('-')) return false; // we're setting all attributes on custom elements through properties
132+
if (is_custom_element_node(node)) return false; // we're setting all attributes on custom elements through properties
132133

133134
for (const attribute of node.attributes) {
134135
if (attribute.type !== 'Attribute') {

packages/svelte/src/compiler/phases/nodes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export function is_element_node(node) {
2323

2424
/**
2525
* @param {AST.RegularElement | AST.SvelteElement} node
26-
* @returns {node is AST.RegularElement}
26+
* @returns {boolean}
2727
*/
2828
export function is_custom_element_node(node) {
29-
return node.type === 'RegularElement' && node.name.includes('-');
29+
return node.type === 'RegularElement' && (node.name.includes('-') || node.attributes.some((attr) => attr.type === 'Attribute' && attr.name === 'is'));
3030
}
3131

3232
/**

0 commit comments

Comments
 (0)