CDATA Sections
When the following code is validated under Version 11.0042:
The following warning is issued:
The code example above already implements the solution suggested by the warning of commenting out the CDATA section using "//<![CDATA[" and "//]]>" in a "script" element. The warning gives the programmer no remedial action that has not already been taken. The warning message in this example could be considered a false positive.
- Code: Select all
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() !== false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
The following warning is issued:
This document contains 1 CDATA section. Using CDATA sections is not recommended due to poor browser support (even some newer browsers fail to properly support it) and due to other complications. AI Internet Solutions recommends avoiding CDATA sections if possible or commenting them out (for example, using "//<![CDATA[" and "//]]>" in a "script" element).
The code example above already implements the solution suggested by the warning of commenting out the CDATA section using "//<![CDATA[" and "//]]>" in a "script" element. The warning gives the programmer no remedial action that has not already been taken. The warning message in this example could be considered a false positive.