Last modified: 2014-11-18 18:07:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 11011 - InsertTags deletes trailing newline in Internet Explorer
InsertTags deletes trailing newline in Internet Explorer
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
All All
: Low minor with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2007-08-20 21:50 UTC by Tisza Gergő
Modified: 2014-11-18 18:07 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Tisza Gergő 2007-08-20 21:50:35 UTC
In Internet Explorer for Windows (both 6 and 7), a bug in textrange handling causes th insertTags function in wikibits.js to lose trailing newlines.

Steps to reproduce:
1. type two lines of text into the edit box
2. select the first line. Be sure to include the line break at the end. (The highlighting should be a bit longer then the text, as if there would be an extra space at the end. A simple way to do this is triple-clicking the line.)
3. use an edit button that puts tags around the selected text (e.g. bold).

Expected result: 
1. either the end tag is put the beginning of the next line (this is what other browsers do, and this would be the consistent behavior: as the line break has been selected, it too should be between the tags)
2. or the end tag is put at the end of the line (slightly inconsistent, but more intuitive: if you select a line to the end, you expect the end tag to appear at the end, not at the next line).

Actual result: the newline disappears, the text of the first line, the end tag and the text of what was the second line follow each other without any line break.

What probably happens is that the trailing newline is included in the textrange object corresponding to the selection, but it is not included into the text of the selection as returned by the browser. I found this trick to help (didn't thoroughly test it though):

var range = document.selection.createRange();
var l = range.text.length;
while(range.text.length == l) {
   range.moveEnd('character', -1);
range.moveEnd('character', 1);

This will give expected result #2.
Comment 1 DieBuche 2011-04-21 08:20:57 UTC
Fixed in  r86603

Note You need to log in before you can comment on or make changes to this bug.