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
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
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
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
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:"Arial",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:"Arial",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:"Arial",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:"Arial",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:"Arial",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:"Arial",sans-serif;color:#17365D;mso-ligatures:none;mso-fareast-language:ZH-CN">
<o:p></o:p>
</span>
</p>
Regards,
Shivam
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?