Alex Rivera | Logout

NicEdit Error in Chrome

Asked 2011-03-21T06:50:12.477
13

I'm using the NicEdit WYSIWYG plugin on my site.

It's come to my attention that when NicEdit is instantiated in Chrome, the following Javascript error is generated:

Uncaught TypeError: Object  has no method 'createRange'

This doesn't stop the plugin from working, but I would like to prevent this if possible. Here is the offending method:

getRng : function() {
        var s = this.getSel();
        if(!s) { return null; }
        return (s.rangeCount > 0) ? s.getRangeAt(0) : s.createRange();
}

NicEdit seems to be pretty much dead as a project, which is why I am asking this question here instead of over at the NicEdit forums. I am hoping that someone knows of a 'quickfix' to this problem. In all other respects NicEdit works well for me, so I am reluctant to change over to a different WYISWYG plugin just yet...

Thanks (in advance) for your help.

Edit
Report

1 Answer

4

Same code, written in nicEdit current design:

getRng : function() {
    var s = this.getSel();
    if(!s) { return null; }
    return (s.rangeCount > 0) ? s.getRangeAt(0) : (typeof s.createRange == 'undefined') ? document.createRange() : s.createRange();
},
answered 2011-08-03T11:09:50.347

Your Answer