This is a migrated thread and some comments may be shown as answers.

"Error while executing filter XHTML - TypeError: e is null"

7 Answers 109 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 08 Oct 2014, 06:24 PM
We have a customer reporting this error when switching from Design mode to HTML mode.

The editor content is:

<p><ul><li></li></ul></p>

I get the same error with this content:

<p><table></table></p>

Disabling the ConvertToXhtml filter prevents the error from occurring.

Editor version is:  2014.1.403.45.

Has this been fixed in a later version of the editor?  Or can you provide a workaround to this problem?

Thanks,
Trevor.



7 Answers, 1 is accepted

Sort by
0
Trevor
Top achievements
Rank 1
answered on 08 Oct 2014, 09:24 PM
The customer reports the same error with the following content:

<p><h3><span><strong>Some Text</strong></span></h3></p>

0
Ianko
Telerik team
answered on 09 Oct 2014, 01:01 PM
Hello Trevor,

The described alert shows initially due to the invalid content used. Block elements cannot be nested inside paragraph and such content is officially not supported.

However, there is a bug logged on the matter, and it is related to the reason that the filter cannot handle to correct the HTML. I suggest following this feedback portal item for further explanations and to examine the workaround provided.

Regards,
Ianko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Trevor
Top achievements
Rank 1
answered on 09 Oct 2014, 02:07 PM
Hi,

Thanks for the info.

For us, the main concern is that the editor will not open in HTML mode. This makes it impossible for the user to find and fix the "invalid" html.  This is the real bug.

Additionally, the error message is meaningless to the user. They don't even realize there is a problem with their html.  They just assume there is a bug in the application.

0
Ianko
Telerik team
answered on 10 Oct 2014, 05:13 AM
Hi Trevor,

You are correct, due to the same concerns the issue is logged as a bug report. As I noted, this is a matter that ConvertToXhml filter should be able to handle without alerts or errors.

The provided feedback item (http://feedback.telerik.com/Project/108/Feedback/Details/137856) enables you to track any updates on the task and workaround the problem via the provided temporary resolutions.  I suggest using the second one as it is indented to fix the issue within the ConvertToXhtml logic, rather disabling it:
<telerik:RadEditor ID="RadEditor1" runat="server">
    <Content>
        <p> <h2></h2> <h2></h2> </p>
    </Content>
</telerik:RadEditor>
<script type="text/javascript">
    Telerik.Web.UI.Editor.NestedElementsFix.prototype._shouldRemoveBlockElement = function (element, elementChanged) {
        var utils = Telerik.Web.UI.Editor.Utils;
        if (!elementChanged || !element) return false;
        if (!/^li|td|th$/.test(element.nodeName) &&
        utils.isNodeEmptyRecursive(element) &&
        !$telerik.$(element).find("ol,ul,table,h1,h2,h3,h4,h5,h6").length) {
            return true;
        }
        return false;
    }
</script>


Regards,
Ianko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Trevor
Top achievements
Rank 1
answered on 10 Oct 2014, 01:45 PM
Thanks Ianko.
0
Trevor
Top achievements
Rank 1
answered on 21 Oct 2014, 11:47 PM
I've implemented the suggested code fix, but the problem remains. Here's the code from my test aspx file which I copied directly from the suggested solution:

<html>
<body>
<form runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<telerik:RadEditor ID="RadEditor1" runat="server">
    <Content>
    </Content>
</telerik:RadEditor>
</form>
<script type="text/javascript">
    Telerik.Web.UI.Editor.NestedElementsFix.prototype._shouldRemoveBlockElement = function (element, elementChanged) {
        var utils = Telerik.Web.UI.Editor.Utils;
        if (!elementChanged || !element) return false;
        if (!/^li|td|th$/.test(element.nodeName) &&
        utils.isNodeEmptyRecursive(element) &&
        !$telerik.$(element).find("ol,ul,table,h1,h2,h3,h4,h5,h6").length) {
            return true;
        }
        return false;
    }
</script>
</body>
</html>


When the page loads, switch to HTML mode, enter:  <p> <h2></h2> <h2></h2> </p>

switch to Design mode, then switch back to HTML mode

get the error:  "Error while executing filter XHTML - TypeError: e is null"


Firebug reports a script error:

TypeError: a is undefined
   }a=a.replace(/<body\s*\/>/i,"<body></body>").trim();



We're on editor version: 2014.1.403.45

Can you provide a working solution to this problem?

Thanks,
Trevor.
0
Ianko
Telerik team
answered on 22 Oct 2014, 07:02 AM
Hello Trevor,

Thank you for the additional feedback.

Indeed, testing with the mentioned version the issue is still reproducible. The fix is intended to be used along with further improvements available since 2014.2.724.

I recommend, along with adding the workaround to additionally upgrade the version of the Telerik UI for ASP.NET AJAX suite to the latest one (2014.2.724). 

The improvements done in this version are complex and cannot be isolated in a simple workaround. 

Let me know if you have any further concerns.

Regards,
Ianko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Editor
Asked by
Trevor
Top achievements
Rank 1
Answers by
Trevor
Top achievements
Rank 1
Ianko
Telerik team
Share this question
or