[feature/editor-code-tabs] Check for browser support in function

Check for browser support and valid textarea in function instead of
before applying function.

PHPBB3-11557
This commit is contained in:
Vjacheslav Trushkin 2013-05-20 20:33:51 +03:00
parent b2e5cc8934
commit 809c51f30d
2 changed files with 4 additions and 3 deletions

View file

@ -681,6 +681,10 @@ phpbb.applyCodeEditor = function(textarea) {
startTagsEnd = ']',
endTags = ['[/code]'];
if (!textarea || typeof textarea.selectionStart !== 'number') {
return;
}
if ($(textarea).data('code-editor') === true) {
return;
}

View file

@ -415,9 +415,6 @@ function getCaretPosition(txtarea) {
}
textarea = doc.forms[form_name].elements[text_name];
if (!textarea || typeof textarea.selectionStart !== 'number') {
return;
}
phpbb.applyCodeEditor(textarea);
});