diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2011-07-08 12:33:29 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2011-07-30 19:35:45 +0200 |
commit | e0bb46c852638ed22281cff88a425e6ec983f17a (patch) | |
tree | ba703ce9e25d2560ba8e835767bb19f2af46f9ce /phpBB/styles | |
parent | 7e4460dbc99ce25dbeaa57eaedddea6112cfb9bf (diff) | |
download | forums-e0bb46c852638ed22281cff88a425e6ec983f17a.tar forums-e0bb46c852638ed22281cff88a425e6ec983f17a.tar.gz forums-e0bb46c852638ed22281cff88a425e6ec983f17a.tar.bz2 forums-e0bb46c852638ed22281cff88a425e6ec983f17a.tar.xz forums-e0bb46c852638ed22281cff88a425e6ec983f17a.zip |
[ticket/10253] Fix IE9 handling in javascript, to correctly quote text.
Since IE9 IE supports textarea.selectionStart and window.getSelection.
The only problem is, that the values are still incorrect.
Therefore we need to ensure that it is still treated the old way,
until IE fixes this completely.
PHPBB3-10253
Diffstat (limited to 'phpBB/styles')
-rw-r--r-- | phpBB/styles/prosilver/template/editor.js | 11 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/forum_fn.js | 2 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/editor.js | 11 |
3 files changed, 15 insertions, 9 deletions
diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index ddc862bb8c..cfdb54f54b 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -151,8 +151,10 @@ function insert_text(text, spaces, popup) { text = ' ' + text + ' '; } - - if (!isNaN(textarea.selectionStart)) + + // Since IE9, IE also has textarea.selectionStart, but it still needs to be treated the old way. + // Therefore we simply add a !is_ie here until IE fixes the text-selection completely. + if (!isNaN(textarea.selectionStart) && !is_ie) { var sel_start = textarea.selectionStart; var sel_end = textarea.selectionEnd; @@ -216,11 +218,12 @@ function addquote(post_id, username, l_wrote) } // Get text selection - not only the post content :( - if (window.getSelection) + // IE9 must use the document.selection method but has the *.getSelection so we just force no IE + if (window.getSelection && !is_ie) { theSelection = window.getSelection().toString(); } - else if (document.getSelection) + else if (document.getSelection && !is_ie) { theSelection = document.getSelection(); } diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 4a85858df5..240fe7e51d 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -200,7 +200,7 @@ function selectCode(a) // Get ID of code block var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0]; - // Not IE + // Not IE and IE9+ if (window.getSelection) { var s = window.getSelection(); diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index cd22812bab..7cc5de9034 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -151,8 +151,10 @@ function insert_text(text, spaces, popup) { text = ' ' + text + ' '; } - - if (!isNaN(textarea.selectionStart)) + + // Since IE9, IE also has textarea.selectionStart, but it still needs to be treated the old way. + // Therefore we simply add a !is_ie here until IE fixes the text-selection completely. + if (!isNaN(textarea.selectionStart) && !is_ie) { var sel_start = textarea.selectionStart; var sel_end = textarea.selectionEnd; @@ -218,11 +220,12 @@ function addquote(post_id, username, l_wrote) } // Get text selection - not only the post content :( - if (window.getSelection) + // IE9 must use the document.selection method but has the *.getSelection so we just force no IE + if (window.getSelection && !is_ie) { theSelection = window.getSelection().toString(); } - else if (document.getSelection) + else if (document.getSelection && !is_ie) { theSelection = document.getSelection(); } |