@@ -5,7 +5,7 @@ import { addClassNamePrefix, merge, assign, isObject, isFunction, clone, isPerce
5
5
import { Point , Line , Path , normalizeAngle , Rect , Polyline } from '../g/index.mjs' ;
6
6
import * as routers from '../routers/index.mjs' ;
7
7
import * as connectors from '../connectors/index.mjs' ;
8
-
8
+ import { env } from '../env/index.mjs' ;
9
9
10
10
const Flags = {
11
11
TOOLS : CellView . Flags . TOOLS ,
@@ -99,6 +99,11 @@ export const LinkView = CellView.extend({
99
99
this . updateHighlighters ( true ) ;
100
100
this . updateTools ( opt ) ;
101
101
flags = this . removeFlag ( flags , [ Flags . RENDER , Flags . UPDATE , Flags . LABELS , Flags . TOOLS , Flags . CONNECTOR ] ) ;
102
+
103
+ if ( env . test ( 'isSafari' ) ) {
104
+ this . __fixSafariBug268376 ( ) ;
105
+ }
106
+
102
107
return flags ;
103
108
}
104
109
@@ -151,6 +156,19 @@ export const LinkView = CellView.extend({
151
156
return flags ;
152
157
} ,
153
158
159
+ __fixSafariBug268376 : function ( ) {
160
+ // Safari has a bug where any change after the first render is not reflected in the DOM.
161
+ // https://bugs.webkit.org/show_bug.cgi?id=268376
162
+ const { el } = this ;
163
+ const childNodes = Array . from ( el . childNodes ) ;
164
+ const fragment = document . createDocumentFragment ( ) ;
165
+ for ( let i = 0 , n = childNodes . length ; i < n ; i ++ ) {
166
+ el . removeChild ( childNodes [ i ] ) ;
167
+ fragment . appendChild ( childNodes [ i ] ) ;
168
+ }
169
+ el . appendChild ( fragment ) ;
170
+ } ,
171
+
154
172
requestConnectionUpdate : function ( opt ) {
155
173
this . requestUpdate ( this . getFlag ( Flags . UPDATE ) , opt ) ;
156
174
} ,
0 commit comments