File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 192
192
] ;
193
193
}
194
194
195
+ function setRangeOnSelection ( range , selection ) {
196
+ selection . removeAllRanges ( ) ;
197
+ selection . addRange ( range ) ;
198
+ }
199
+
195
200
function moveNativeSelectionToBookmark ( document , bm ) {
196
201
var sel = document . getSelection ( ) ,
197
202
range = document . createRange ( ) ;
198
203
199
204
range . setStart ( bm [ 0 ] . node , bm [ 0 ] . offset ) ;
200
205
range . collapse ( true ) ;
201
- sel . removeAllRanges ( ) ;
202
- sel . addRange ( range ) ;
206
+ setRangeOnSelection ( range , sel ) ;
203
207
sel . extend ( bm [ 1 ] . node , bm [ 1 ] . offset ) ;
204
208
}
205
209
221
225
nativeRange . setStart ( range . startContainer . $ , range . startOffset ) ;
222
226
nativeRange . collapse ( 1 ) ;
223
227
224
- nativeSel . removeAllRanges ( ) ;
225
- nativeSel . addRange ( nativeRange ) ;
228
+ setRangeOnSelection ( nativeRange , nativeSel ) ;
226
229
}
227
230
else {
228
231
// IE in specific case may also fire selectionchange.
1978
1981
}
1979
1982
1980
1983
// Select the range.
1981
- sel . removeAllRanges ( ) ;
1982
- sel . addRange ( nativeRange ) ;
1984
+ setRangeOnSelection ( nativeRange , sel ) ;
1983
1985
}
1984
1986
}
1985
1987
You can’t perform that action at this time.
0 commit comments