File tree 3 files changed +26
-1
lines changed
3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ proto.update = function(graphInfo, buttons) {
88
88
}
89
89
90
90
if ( fullLayout . modebar . orientation === 'v' ) {
91
- this . element . prepend ( logoGroup ) ;
91
+ Lib . prependElement ( this . element , logoGroup ) ;
92
92
} else {
93
93
this . element . appendChild ( logoGroup ) ;
94
94
}
Original file line number Diff line number Diff line change @@ -689,6 +689,19 @@ lib.removeElement = function(el) {
689
689
if ( elParent ) elParent . removeChild ( el ) ;
690
690
} ;
691
691
692
+ lib . prependElement = function ( el ) {
693
+ var argArr = Array . prototype . slice . call ( arguments ) ;
694
+ argArr . splice ( 0 , 1 ) ;
695
+ var docFrag = document . createDocumentFragment ( ) ;
696
+
697
+ argArr . forEach ( function ( argItem ) {
698
+ var isNode = argItem instanceof Node ;
699
+ docFrag . appendChild ( isNode ? argItem : document . createTextNode ( String ( argItem ) ) ) ;
700
+ } ) ;
701
+
702
+ el . insertBefore ( docFrag , el . firstChild ) ;
703
+ } ;
704
+
692
705
/**
693
706
* for dynamically adding style rules
694
707
* makes one stylesheet that contains all rules added
Original file line number Diff line number Diff line change 18
18
] . join ( ' ' ) ) ;
19
19
}
20
20
} ) ;
21
+
22
+ Object . defineProperty ( item , 'prepend' , {
23
+ configurable : true ,
24
+ enumerable : true ,
25
+ writable : true ,
26
+ value : function remove ( ) {
27
+ throw Error ( [
28
+ 'test/jasmine/assets/unpolyfill.js error: calling ChildNode.prepend()' ,
29
+ 'which is not available in IE.'
30
+ ] . join ( ' ' ) ) ;
31
+ }
32
+ } ) ;
21
33
} ) ;
22
34
} ) ( [ Element . prototype , CharacterData . prototype , DocumentType . prototype ] ) ;
You can’t perform that action at this time.
0 commit comments