1- import { Http , View , Style , CssProperty , AddChildFromBuilder , Frame , Property , path , knownFolders , CSSType , Screen , Application , Utils } from '@nativescript/core' ;
1+ import { Http , View , Style , CssProperty , AddChildFromBuilder , Frame , Property , path , knownFolders , CSSType , Application , Utils } from '@nativescript/core' ;
22
33export const strokeProperty = new CssProperty < Style , any > ( {
44 name : 'stroke' ,
@@ -54,9 +54,10 @@ export const srcProperty = new Property<Svg, string>({
5454 name : 'src' ,
5555} ) ;
5656
57- declare const TNSSVG ;
57+ declare const TNSSVG , org ;
5858import { SVGItem } from './SVGItem' ;
5959import { DOMParser , XMLSerializer } from 'xmldom' ;
60+ const initialSVG = '<svg width="auto" height="auto" xmlns="http://www.w3.org/2000/svg"></svg>' ;
6061@CSSType ( 'Svg' )
6162export class Svg extends View {
6263 public static readyEvent = 'ready' ;
@@ -75,7 +76,7 @@ export class Svg extends View {
7576 this . _svg = TNSSVG . alloc ( ) . initWithFrame ( CGRectZero ) ;
7677 this . _svg . backgroundColor = UIColor . clearColor ;
7778 }
78- this . _dom = new DOMParser ( ) . parseFromString ( '<svg width="auto" height="auto" xmlns="http://www.w3.org/2000/svg"></svg>' ) ;
79+ this . _dom = new DOMParser ( ) . parseFromString ( initialSVG ) ;
7980 this . _serializer = new XMLSerializer ( ) ;
8081 }
8182
@@ -143,7 +144,7 @@ export class Svg extends View {
143144 domCopy . documentElement . setAttribute ( 'height' , `${ this . getMeasuredHeight ( ) } px` ) ;
144145 }
145146 const serialized = this . _serializer . serializeToString ( domCopy ) ;
146- if ( serialized !== '<svg xmlns="http://www.w3.org/2000/svg"></svg>' ) {
147+ if ( serialized !== initialSVG ) {
147148 this . src = serialized ;
148149 }
149150 }
0 commit comments