File tree 5 files changed +24
-33
lines changed
runtime/samples/svg-foreignobject-namespace
validator/samples/svg-child-component-undeclared-namespace
5 files changed +24
-33
lines changed Original file line number Diff line number Diff line change @@ -94,16 +94,11 @@ export default class Element extends Node {
94
94
this . name = info . name ;
95
95
96
96
const parent_element = parent . find_nearest ( / ^ E l e m e n t / ) ;
97
- this . namespace = this . name === 'svg' ?
98
- namespaces . svg :
99
- parent_element ? parent_element . namespace : this . component . namespace ;
100
-
101
- if ( ! this . namespace && svg . test ( this . name ) ) {
102
- this . component . warn ( this , {
103
- code : `missing-namespace` ,
104
- message : `<${ this . name } > is an SVG element – did you forget to add <svelte:options namespace="svg"/> ?`
105
- } ) ;
106
- }
97
+ this . namespace = this . name === 'svg' || ( ! parent_element && svg . test ( this . name ) )
98
+ ? namespaces . svg
99
+ : this . name === 'foreignObject'
100
+ ? namespaces . html
101
+ : parent_element ? parent_element . namespace : this . component . namespace ;
107
102
108
103
if ( this . name === 'textarea' ) {
109
104
if ( info . children . length > 0 ) {
Original file line number Diff line number Diff line change
1
+ export default {
2
+ html : `
3
+ <svg>
4
+ <foreignObject x="0" y="0" width="100" height="100">
5
+ <p>some text</p>
6
+ </foreignObject>
7
+ </svg>
8
+ ` ,
9
+
10
+ test ( { assert, target } ) {
11
+ const p = target . querySelector ( 'p' ) ;
12
+ assert . equal ( p . namespaceURI , 'http://www.w3.org/1999/xhtml' ) ;
13
+ }
14
+ } ;
Original file line number Diff line number Diff line change
1
+ <svg >
2
+ <foreignObject x =" 0" y =" 0" width =" 100" height =" 100" >
3
+ <p >some text</p >
4
+ </foreignObject >
5
+ </svg >
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments