1

I'm using a jQuery fork of Wysihat as a Wysiwig editor in a project of mine. It works perfectly in all browsers apart from (surprise, surprise) IE (specifically IE8). I've got the example files uploaded here:

http://pezholio.co.uk/wysihat/examples/custom_buttons.html

When running the file in IE, I get the error Object expected, and it seems to be occurring within this function:

window.getSelection = (function() {
  var selection = new Selection(document);
  return function() { return selection; };
})();

Any ideas what may be causing the problem, and what I can do to fix it?

Cheers

Pezholio
  • 2,439
  • 5
  • 27
  • 41
  • show function Selection - here is some reading material http://stackoverflow.com/questions/1981088/set-textarea-selection-in-internet-explorer – mplungjan Apr 28 '12 at 09:16
  • Nothing is obviously wrong in the Wysihat code. `window.Selection` is defined just before that function. – Tim Down Apr 28 '12 at 10:21
  • So, *in IE*, what is the evaluation of `Selection` in that context? And how has that function been pin-pointed? Using the IE Script Debugger? –  Apr 28 '12 at 17:14
  • Yup, I got at it using the Script debugger. Not sure what you mean about 'what is the evauation of selection in that context'? If you mean the source order, then `Selection` appears before the problematic function. I'm no Javascript ninja by any stretch of the imagination, so would appreciate some help :) – Pezholio Apr 30 '12 at 08:31
  • What is Selection? I've generally used more verbose methods in the past to get txt selections etc. – Aaria Carter-Weir Apr 30 '12 at 09:02
  • This whole function is a mess anyway. If window.getSelection only ever returns the same selection obj, just have it as a property rather than a function. window.currentSelection = newSelection(document); – Aaria Carter-Weir Apr 30 '12 at 09:15
  • There's an IE fallback function for getSelection in there, but it doesn't seem to be working. I've also tried [selection.js](https://github.com/timcameronryan/selection.js) as an alternative, but that doesn't seem to work either. – Pezholio Apr 30 '12 at 09:44

1 Answers1

0

Ah, OK. I think I've nailed this now. I've removed the existing IE fallback code and am using selection.js instead. You can see the code in the gist below:

https://gist.github.com/2556956

Pezholio
  • 2,439
  • 5
  • 27
  • 41