Cdata statements

For topics about current BETA or future releases, including feature requests.
Post Reply
User avatar
RSteinwand
Rank VI - Professional
Posts: 596
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND
Contact:

Cdata statements

Post by RSteinwand »

Boy this place sure was quiet before I came here. :roll:

Just went thru 140 pages and updated all my inline JS to be similar to this:

<script type="text/javascript">
//<![CDATA[
function SavePrefs(){}
function LoadPrefs(){}
//]]>
</script>

... using example #4 from devedge-temp.mozilla.org.

I'm using a doctype of xhtml strict and a content type of "text/html".

I'm seeing this message:
"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."

The cdata I'm using is prefaced with comments, which is supposed to make it OK with older browsers.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

Thanks. I see that. I think the best thing that can be done now would be to change the message to something like this:

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 (like in using "//<![CDATA[" and "//]]>" in a "script" element).

Does this sound good? Once an author is aware of this, then he/she can disable that message or just change it to a regular message instead of a warning message.

But I will also make a note look into not displaying this message if all CDATA sections are commented out (for a future version).
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
RSteinwand
Rank VI - Professional
Posts: 596
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND
Contact:

Post by RSteinwand »

Excellent.

Of course that's only if the content type is "text/html". :wink:
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

RSteinwand wrote:Excellent.

Of course that's only if the content type is "text/html". :wink:
Great! The warning message now reads (for XHTML documents):
"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)."

HTML (not XHTML) documents will generate this error message:
"This document contains 1 CDATA section. CDATA sections should not be used in HTML, but may be used in XHTML (though it is not recommended due to poor browser support and due to other complications)."

If you see any further issues with this, then please let me know.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
RSteinwand
Rank VI - Professional
Posts: 596
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND
Contact:

Post by RSteinwand »

Let me know if I'm wearing you down. I can be downright picky. :P
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

RSteinwand wrote:Let me know if I'm wearing you down. I can be downright picky. :P
Nope, pick away... any comments to improve the program are welcome (especially if they are easy to do). :)
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Post Reply