Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticket/10253] Fix IE9 handling in javascript, to correctly quote text. #263

Merged
merged 1 commit into from Aug 27, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions phpBB/styles/prosilver/template/editor.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion phpBB/styles/prosilver/template/forum_fn.js
Expand Up @@ -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();
Expand Down
11 changes: 7 additions & 4 deletions phpBB/styles/subsilver2/template/editor.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down