\r
// A collection of the important regions on the page.\r
// Cached so we don't have to keep traversing the DOM.\r
- // Also holds ieRetardedClick and ieCachedRange, where necessary; working around\r
+ // Also holds ieCachedRange and ieCachedScrollTop, where necessary; working around\r
// this issue:\r
// Internet explorer has problems with CSS sprite buttons that use HTML\r
// lists. When you click on the background image "button", IE will \r
\r
this.setInputAreaSelectionStartEnd = function () {\r
\r
- if (!panels.ieRetardedClick && (inputArea.selectionStart || inputArea.selectionStart === 0)) {\r
+ if (!panels.ieCachedRange && (inputArea.selectionStart || inputArea.selectionStart === 0)) {\r
\r
stateObj.start = inputArea.selectionStart;\r
stateObj.end = inputArea.selectionEnd;\r
stateObj.text = util.fixEolChars(inputArea.value);\r
\r
// IE loses the selection in the textarea when buttons are\r
- // clicked. On IE we cache the selection and set a flag\r
- // which we check for here.\r
- var range;\r
- if (panels.ieRetardedClick && panels.ieCachedRange) {\r
- range = panels.ieCachedRange;\r
- panels.ieRetardedClick = false;\r
- }\r
- else {\r
- range = doc.selection.createRange();\r
- }\r
+ // clicked. On IE we cache the selection. Here, if something is cached,\r
+ // we take it.\r
+ var range = panels.ieCachedRange || doc.selection.createRange();\r
\r
var fixedRange = util.fixEolChars(range.text);\r
var marker = "\x07";\r
range.text = fixedRange;\r
}\r
\r
+ if (panels.ieCachedRange)\r
+ stateObj.scrollTop = panels.ieCachedScrollTop; // this is set alongside with ieCachedRange\r
+ \r
+ panels.ieCachedRange = null;\r
+\r
this.setInputAreaSelection();\r
}\r
};\r
if (doc.activeElement && doc.activeElement !== panels.input) { // we're not even in the input box, so there's no selection\r
return;\r
}\r
- panels.ieRetardedClick = true;\r
panels.ieCachedRange = document.selection.createRange();\r
+ panels.ieCachedScrollTop = panels.input.scrollTop;\r
};\r
}\r
\r