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

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T13011, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 11011 - InsertTags deletes trailing newline in Internet Explorer
InsertTags deletes trailing newline in Internet Explorer
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
unspecified
All All
: Low minor with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  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: ---


Attachments

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.


Navigation
Links