https://bugzilla.wikimedia.org/show_bug.cgi?id=23992

--- Comment #8 from XP1 <[email protected]> ---
Did anyone else take a look at "jquery.textSelection.js"? Like I said on
2012-02-07, the bug is on line 65:

    getContents: function () {
        return this.val();
    },

https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=resources/jquery/jquery.textSelection.js#l65

In "jquery.textSelection.js", there are a few bugs with handling newlines.

For Opera, the only change required is to the `getContents` function.

There are more bugs regarding Internet Explorer. The if statements in
"jquery.textSelection.js" should be reversed. You want to check for W3C way
first and then fallback to Internet Explorer way.

Furthermore, the newline strings should not be hardcoded. This causes problems
when the browser has a different newline than what was expected, which results
in off-by-one errors.

Experiment with the following example:

    function getNewline() {
       var document = window.document;
       var textarea = document.createElement("textarea");
       textarea.value = "\n";
       return textarea.value;
    }

    var newline = getNewline();

Running in IE8 mode and Opera 11.50, 11.60:

>> newline.length
2
>> newline === "\r\n"
true
>> newline === "\n"
false

Running in IE9 mode and Opera 11.64:

>> newline.length
1
>> newline === "\r\n"
false
>> newline === "\n"
true

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to