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

Problem with html attributes processing in Editor in viewHtml mode

3 Answers 330 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 14 Sep 2015, 02:02 PM

I got a problem with attributes processing in viewHtml mode

There is steps to reproduce:

1. Create Editor with "viewHtml" button

2. Open "View Html" dialog by clicking on "View Html" button

3. Put the html code as below:

    <img height="157" width="314" on="" k-script-on="" />

4. Click on Update button

    Uncaught TypeError: Cannot read property 'nodeName' of undefined

    in _preventScriptExecution function

 

The ​bug is in processing of attributes: on="" k-script-on="" 

When the code below is run

    this.setAttribute("k-script-" + name, attribute.value);

the "attributes.length" changing and the variables "i" and "l" is wrong

 

Is it posible to fix it?

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 16 Sep 2015, 10:30 AM
Hello Hans,

The problem is caused by the fact that a combination of "on" and "k-script-on" attributes are used. The Editor's logic is to replace all "on...." attributes with "k-script-on..." attributes. Since the latter attribute already exists, it is removed, which changes the attribute count on the fly.

The "k-script-on" attribute is for internal use and should normally not be used by the end user. Can you describe a valid scenario, in which the described issue occurs?

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Hans
Top achievements
Rank 1
answered on 18 Sep 2015, 01:46 PM

Thank you for response

>>Can you describe a valid scenario, in which the described issue occurs

For example user can open some site in html mode and copy some html code with "on...." , "k-script-on..." attributes. Pasting of this html code is broke the kendo editor.

I understand "k-script-on" attribute is for internal use, but we creating a stable app/site and should expect any attributes from user, 

and that is why we expact from kendo editor checking of this behavior. It seem we can't fix it outside of kendo editor, so Is it posible that kendo team will provide a fix for it in future?

 

Thanks

0
Dimo
Telerik team
answered on 23 Sep 2015, 07:32 AM
Hello Hans,

I am afraid we do not regard the described scenario as valid or plausible, for a couple of reasons:

- an on="" HTML attribute does not exist;
- a k-script-on="" HTML attribute does not exist. It is created and used by the Editor temporarily on the client, and is never submitted to the server or included in the returned widget's value;

Even if we replace "on" with another valid "onfoo" attribute (e.g. onclick), the probability for the user to paste code with both onfoo and k-script-onfoo attributes applied to the same element is practically zero. Moreover, this represents an unsupported scenario, because the k-script-onfoo attribute will be lost when the onfoo attribute is renamed.

The Javascript error itself is caused by the fact that the attributes collection size is cached for performance reasons, which is a good practice when the iterated collection's size is not expected to change.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Shivam
Top achievements
Rank 1
commented on 19 Jul 2024, 09:11 AM | edited

Hi Team,

We are using Kendo Editor to represent some HTML, but the same is returning the error "k-script-<dynamic value>", on further debugging the same seems to be coming from the preventScriptExecution method and is failing for some keywords. 

 

Sharing the example tag for the same. Request you to kindly help as the same throws different errors for different HTML tags and is blocker for us.


                     <p class="MsoNormal" style="vertical-align:baseline">
                        <a https://www.facebook.com/ontexgroup/"><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#17365D;mso-fareast-language:EN-AU;text-decoration:none"><img border="0" width="17" height="29" style="width:.1736in;height:.3055in" id="Picture_x0020_2" src="cid:image002.png@01D9BF9D.255AF930"></span></a><a https://www.linkedin.com/company/ontex/"><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#17365D;mso-fareast-language:EN-AU;text-decoration:none"><img border="0" width="25" height="32" style="width:.2638in;height:.3333in" id="Picture_x0020_3" src="cid:image003.png@01D9BF9D.255AF930"></span></a><a https://www.instagram.com/ontex_group/"><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#17365D;mso-fareast-language:EN-AU;text-decoration:none"><img border="0" width="25" height="27" style="width:.2638in;height:.2847in" id="Picture_x0020_4" src="cid:image004.png@01D9BF9D.255AF930"></span></a><a https://www.youtube.com/c/ontexgroup"><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#17365D;mso-fareast-language:EN-AU;text-decoration:none"><img border="0" width="35" height="28" style="width:.368in;height:.2916in" id="Picture_x0020_5" src="cid:image005.png@01D9BF9D.255AF930"></span></a><a http://www.ontexglobal.com/"><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#17365D;mso-fareast-language:EN-AU;text-decoration:none"><img border="0" width="24" height="27" style="width:.25in;height:.2847in" id="Picture_x0020_6" src="cid:image006.png@01D9BF9D.255AF930"></span></a>
                        <span lang="NL-BE" style="font-size:9.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#17365D;mso-ligatures:none;mso-fareast-language:ZH-CN">
                           <o:p></o:p>
                        </span>
                     </p>


Regards,

Shivam

Martin
Telerik team
commented on 23 Jul 2024, 06:49 AM

Hello, Shivam,

I responded to your query in the support ticket 1658391 you opened on the matter. Could you let me know if the information provided was not sufficient?

Tags
Editor
Asked by
Hans
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Hans
Top achievements
Rank 1
Share this question
or