Page MenuHomePhabricator

Bug in text selection in Opera in insertTags() (with patch)
Closed, ResolvedPublic

Description

There's a bug in insertTags() function causing Opera 9.5x select wrong text when inserted text contains newline characters.

Example:

mwCustomEditButtons[mwCustomEditButtons.length] = {

"imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",
"speedTip": "FooBar",
// <nowiki>
"tagOpen": "foo foo(",
"tagClose": ")bar\nbar\nbar\nbar",
"sampleText": "baz baz"};

This bug causes problem on Wiktionary, as buttons inserting multi-line text are in common use there (nearly on every edit creating a new page).

Suggested solution:

Remove

if (window.opera)

tagClose = tagClose.replace(/\n/g,'');

(terrible browser sniffing BTW) - this helps on Opera 9.5, don't know how it's with previous persions, but I remember the problem with insertTags() at least since the very beginning of Opera 9.x versions. Alternatively, your can change browser sniffing to:

if (is_opera && is_opera_seven)

or something like this. Or, the best way, remove the browser sniffing completely:

http://dev.opera.com/articles/view/a-browser-sniffing-warning-the-trouble/


Version: unspecified
Severity: normal

Details

Reference
bz15705

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:21 PM
bzimport set Reference to bz15705.
bzimport added a subscriber: Unknown Object (MLST).

For your knowledge: we on Polish Wiktionary have to add a lot of JavaScript to fix this bug - because we are not able to remove two buggy lines from edit.js otherwise.

http://pl.wiktionary.org/wiki/MediaWiki:Common.js/edit.js

Please note that we are in year 2010 and noone uses Opera 7, so this fix 'if (window.opera)' no longer helps anybody, and makes trouble for all Opera users instead.