@@ -487,20 +487,21 @@ function checkDashStyle(assert, elem, result, style, value) {
487487
488488 QUnit . module ( 'SvgElement markup method' ) ;
489489
490- QUnit . test ( 'Returns correct namespaces (IE specific problem)' , function ( assert ) {
491- function mapFromStr ( str ) {
492- const map = { } ;
493- str . split ( '>' ) . forEach ( function ( s ) {
494- s . split ( '<' ) . forEach ( function ( s ) {
495- s . split ( ' ' ) . forEach ( function ( s ) {
496- if ( s ) {
497- map [ s ] = ( map [ s ] || 0 ) + 1 ;
498- }
499- } ) ;
490+ function mapFromStr ( str ) {
491+ const map = { } ;
492+ str . split ( '>' ) . forEach ( function ( s ) {
493+ s . split ( '<' ) . forEach ( function ( s ) {
494+ s . split ( ' ' ) . forEach ( function ( s ) {
495+ if ( s ) {
496+ map [ s ] = ( map [ s ] || 0 ) + 1 ;
497+ }
500498 } ) ;
501499 } ) ;
502- return map ;
503- }
500+ } ) ;
501+ return map ;
502+ }
503+
504+ QUnit . test ( 'Returns correct namespaces (IE specific problem)' , function ( assert ) {
504505 // arrange
505506 const parent = { element : document . createElement ( 'div' ) } ;
506507 const svg = ( new rendererModule . SvgElement ( { } , 'svg' ) ) . append ( parent ) ;
@@ -521,6 +522,31 @@ function checkDashStyle(assert, elem, result, style, value) {
521522 assert . deepEqual ( mapFromStr ( markupString ) , mapFromStr ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">Some content</svg>' ) ) ;
522523 } ) ;
523524
525+ QUnit . test ( 'Keep all default namespaces (T1292204)' , function ( assert ) {
526+ // arrange
527+ const parent = { element : document . createElement ( 'div' ) } ;
528+ const svg = ( new rendererModule . SvgElement ( { } , 'svg' ) ) . append ( parent ) ;
529+ $ ( '#qunit-fixture' ) . append ( parent ) ;
530+
531+ svg . attr ( {
532+ xmlns : 'http://www.w3.org/2000/svg' ,
533+ 'xmlns:xlink' : 'http://www.w3.org/1999/xlink' ,
534+ version : '1.1'
535+ } ) ;
536+
537+ const foreignContent = document . createElement ( 'table' ) ;
538+ foreignContent . setAttribute ( 'xmlns' , 'http://www.w3.org/1999/xhtml' ) ;
539+
540+ svg . element . appendChild ( foreignContent ) ;
541+
542+ // act
543+ const markupString = svg . markup ( ) ;
544+ const expectedMarkup = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><table xmlns="http://www.w3.org/1999/xhtml"></table></svg>' ;
545+
546+ // assert
547+ assert . deepEqual ( mapFromStr ( markupString ) , mapFromStr ( expectedMarkup ) ) ;
548+ } ) ;
549+
524550 QUnit . test ( 'Can return markup on detached element' , function ( assert ) {
525551 // arrange
526552 const svg = ( new rendererModule . SvgElement ( { } , 'svg' ) ) ;
0 commit comments