File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 472472 }
473473 }
474474
475- return serialized ;
475+ return serialized ;
476476 } ;
477477
478478
504504 ctx . prototype . restore = function ( ) {
505505 var element = this . __groupStack . pop ( ) ;
506506 var state = this . __stack . pop ( ) ;
507+
508+ /** Prune empty group created when running save/restore without any content **/
509+ var node = this . __currentElement
510+ if ( node . nodeName === 'g' && ! node . childNodes . length ) {
511+ node . remove ( )
512+ }
513+
507514 this . __currentElementsToStyle = null ;
508515 this . __currentElement = element || this . __root . childNodes [ 1 ] ;
509516 this . __applyStyleState ( state ) ;
11631170 * Generates a ClipPath from the clip command.
11641171 */
11651172 ctx . prototype . clip = function ( ) {
1173+ console . log ( this . __currentPath )
1174+ if ( ! this . __currentPath ) {
1175+ return ;
1176+ }
1177+
11661178 applyCurrentDefaultPath . call ( this , false ) ;
11671179
11681180 var group = this . __closestGroupOrSvg ( ) ,
11691181 clipPath = this . __createElement ( "clipPath" ) ,
11701182 id = randomString ( this . __ids ) ,
11711183 newGroup = this . __createElement ( "g" ) ;
11721184
1173- this . __currentElement . remove ( ) ;
1174-
11751185 clipPath . setAttribute ( "id" , id ) ;
11761186 clipPath . appendChild ( this . __currentElement ) ;
11771187
You can’t perform that action at this time.
0 commit comments