sleemanj / xinha

WYSIWYG HTML Editor Component (turns <textarea> into HTML editors)
http://trac.xinha.org/
Other
13 stars 2 forks source link

IE 10: exception when calling str.replace in function htmlEncode (Trac #1624) #1624

Closed sleemanj closed 3 years ago

sleemanj commented 10 years ago

The following line does not work because of exceptions in htmlEncode:

document.form.editorContent.value = xinha_editors['editor'].getEditorContent();

The exception message is:

Unable to get property 'replace' of undefined or null reference XinhaCore.js, line 2943

We are using Xinha 0.95.

line 2943 is within the following code snippet:

2942 Xinha.htmlEncode=function(str){ 2943 if(typeof str.replace=="undefined"){ 2944 str=str.toString(); 2945 }

We tried to fix it ourselves and run in further exceptions in other parts of the code.

Is this a known issue?

Reported by guest, migrated from http://trac.xinha.org/ticket/1624

sleemanj commented 10 years ago

guest commented:

The line should be:

document.form.editorContent.value = xinha_editors[\'editor\'].getEditorContent();

without the backslashes

sleemanj commented 10 years ago

The current trunk appears to include a fix for that

Xinha.htmlEncode = function(str)
{
  if (!str)
  {
    return '';
  }  if ( typeof str.replace == 'undefined' )
  {
    str = str.toString();
  }

so I'd guess probably fixed