mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-23 15:57:15 +00:00
document.selection is undefined in IE11
IE11 replaced document.selection by window.getSelection, which breaks dialogs in WikiEditor, because document.selection.createRange was accessed without check. Inserting this check unbreaks the dialogs. Bug: 57489 Change-Id: I70d49fb43bbf7602f43e9a8086ecd32027cb6d6f
This commit is contained in:
parent
06ac7335cd
commit
37a1deb799
|
@ -249,7 +249,7 @@ if ( !context || typeof context === 'undefined' ) {
|
|||
'oldDelayedHTML': null,
|
||||
// The previous selection of the iframe, stored to detect whether the selection has changed
|
||||
'oldDelayedSel': null,
|
||||
// Saved selection state for IE
|
||||
// Saved selection state for old IE (<=10)
|
||||
'savedSelection': null,
|
||||
// Stack of states in { html: [string] } form
|
||||
'history': [],
|
||||
|
@ -459,17 +459,17 @@ if ( !context || typeof context === 'undefined' ) {
|
|||
},
|
||||
|
||||
/**
|
||||
* Save text selection for IE
|
||||
* Save text selection for old IE (<=10)
|
||||
*/
|
||||
saveSelection: function () {
|
||||
if ( $.client.profile().name === 'msie' ) {
|
||||
if ( $.client.profile().name === 'msie' && document.selection && document.selection.createRange ) {
|
||||
context.$textarea.focus();
|
||||
context.savedSelection = document.selection.createRange();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Restore text selection for IE
|
||||
* Restore text selection for old IE (<=10)
|
||||
*/
|
||||
restoreSelection: function () {
|
||||
if ( $.client.profile().name === 'msie' && context.savedSelection !== null ) {
|
||||
|
|
Loading…
Reference in a new issue