Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Apr 18, 2024
1 parent ea95475 commit 3729b63
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2041,9 +2041,8 @@ export const template_visitors = {
if (attribute.type === 'Attribute') {
if (attribute.name === 'xmlns' && !is_text_attribute(attribute)) {
dynamic_namespace = attribute.value;
} else {
attributes.push(attribute);
}
attributes.push(attribute);
} else if (attribute.type === 'SpreadAttribute') {
attributes.push(attribute);
} else if (attribute.type === 'ClassDirective') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export function element(anchor, get_tag, is_svg, render_fn, get_namespace) {

block(() => {
const next_tag = get_tag() || null;
const ns = get_namespace?.() || (is_svg || next_tag === 'svg' ? namespace_svg : null);
const ns = get_namespace
? get_namespace()
: is_svg || next_tag === 'svg'
? namespace_svg
: null;
// Assumption: Noone changes the namespace but not the tag (what would that even mean?)
if (next_tag === tag) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<button onclick={() => {
tag = 'div';
xmlns = 'http://www.w3.org/1999/xhtml';
xmlns = null;
}}>change</button>

<!-- wrapper necessary or else jsdom says this is always an xhtml namespace -->
Expand Down
6 changes: 3 additions & 3 deletions packages/svelte/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1539,10 +1539,10 @@ declare module 'svelte/compiler' {
tag: Expression;
metadata: {
/**
* `true`/`false` if this is definitely (not) an svg element.
* `null` means we can't know statically.
* `true` if this is an svg element. The boolean may not be accurate because
* the tag is dynamic, but we do our best to infer it from the template.
*/
svg: boolean | null;
svg: boolean;
scoped: boolean;
};
}
Expand Down

0 comments on commit 3729b63

Please sign in to comment.