Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught exception: TypeError: 'win.getSelection' is not a function #12

Closed
heydojo opened this issue Aug 30, 2010 · 4 comments
Closed

Comments

@heydojo
Copy link

heydojo commented Aug 30, 2010

I'm seeing this in Opera Linux's error console :

Uncaught exception: TypeError: 'win.getSelection' is not a function
Error thrown at line 423, column 6 in (win) in http://localhost/admin/jscript/editor-plugins/codemirror/js/select.js:
var selection = win.getSelection();
called from line 1299, column 8 in () in http://localhost/admin/jscript/editor-plugins/codemirror/js/editor.js:
select.markSelection(self.win);

Can't see function getSelection(); defined anywhere.
Thanks

@marijnh
Copy link
Member

marijnh commented Aug 30, 2010

window.getSelection is built into the browser. I'm not seeing this error. Which version of Opera are you using, and which CodeMirror page are you opening?

@heydojo
Copy link
Author

heydojo commented Sep 4, 2010

Oops, sorry.
I was actually trying to do this :
http://heydojo.co.cc/ckeditor-codemirror/index.html
and it is my fault. I am trying to do too much.

I use the latest snapshot of Opera Linux 10.70 from :
http://my.opera.com/desktopteam/blog/
(10.60 isn't as good.)

I think the problem I am having is that maybe I am trying to destroy and recreate a code mirror instance in a dirty way because in the demo linked above, I get two errors, one when the toggle toolbar button is clicked and the same when switching to and from source mode.

Uncaught exception: TypeError: 'b.getSelection' is not a function
Error thrown at line 12, column 946 in (b) in http://heydojo.co.cc/ckeditor-codemirror/ckeditor/plugins/codemirror/js/select.js:
var c=b.getSelection();
called from line 43, column 288 in () in http://heydojo.co.cc/ckeditor-codemirror/ckeditor/plugins/codemirror/js/editor.js:
select.markSelection(b.win);

So do you have any recommendations on how to destroy the CodeMirror instance cleanly straight after using the getCode() function?
I've read through the manual and it doesn't look like there is such a function.

Thanks,
Tony

@marijnh
Copy link
Member

marijnh commented Sep 4, 2010

Hi Tony,

I have pushed a fix to the CodeMirror git repository that should fix this. The problem was that a timeout was firing (for the continuousScanning option), which tried to work with the frame, after the frame had been removed from the document. This largely worked, except that, apparently, the window.getSelection function vanishes when a frame is no longer in the document.

Best,
Marijn

@heydojo
Copy link
Author

heydojo commented Sep 4, 2010

Wow!
Much appreciated.
Thanks for the fix to your awesome editor.
I'll update the demo ASAP.

Cheers!
Tony

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants