- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 4.7k
 
          fix: infer svg namespace correctly
          #10027
        
          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
Changes from 4 commits
ba8de99
              30e9baa
              ef725ea
              f82f804
              4c68f63
              c34f3d0
              92cd4cf
              5598c4c
              1175362
              399d81f
              eb8475f
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'svelte': patch | ||
| --- | ||
| 
     | 
||
| fix: infer `svg` namespace correctly | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -209,7 +209,10 @@ export function infer_namespace(namespace, parent, nodes, path) { | |
| parent_node.type === 'Component' || | ||
| parent_node.type === 'SvelteComponent' || | ||
| parent_node.type === 'SvelteFragment' || | ||
| parent_node.type === 'SnippetBlock') | ||
| parent_node.type === 'SnippetBlock' || | ||
| parent_node.type === 'IfBlock' || | ||
| parent_node.type === 'EachBlock' || | ||
| parent_node.type === 'AwaitBlock') | ||
| ) { | ||
| // Heuristic: Keep current namespace, unless we find a regular element, | ||
| // in which case we always want html, or we only find svg nodes, | ||
| 
        
          
        
         | 
    @@ -222,7 +225,7 @@ export function infer_namespace(namespace, parent, nodes, path) { | |
| only_svg = false; | ||
| break; | ||
| } | ||
| } else if (node.type !== 'Text' || node.data.trim() !== '') { | ||
| } else if (node.type !== 'ConstTag' && (node.type !== 'Text' || node.data.trim() !== '')) { | ||
                
       | 
||
| only_svg = false; | ||
| } | ||
| } | ||
| 
          
            
          
           | 
    ||
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.