Last modified: 2014-11-18 18:07:16 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.
Fixed in r86603