jquery - What is the meaning of CDATA -
gurus,
i self taught. there's lot of enlightened ones call basic know nothing about.
reading jquery tutorial, noticed tag (for lack of better word): "cdata" shown here (third line top):
<script src="http://jquery.com/src/jquery-latest.js"></script> <script> //<![cdata[ $(document).ready(function(){ $(".article .thebody").hide(); $("#container .article ul") .prepend("<li class='readbody'><a href='' title='read article'>read body</a></li>"); $(".actions li.readbody a").click(function(event){ $(this).parents("ul").prev(".thebody").toggle(); event.preventdefault(); }); }); //]]></script> what meaning of cdata? there tags similar cdata?
with <![cdata[ can embed js in xml (and xhtml) documents without need replace special xml characters <, >, &, etc xml entities <, >, & etc prevent xml syntax malformed , errors the entity name must follow '&' in entity reference. general recommendation put js code in own .js file include <script src>.
the <![cdata[ not needed in plain html documents. unless you're developing xml based view technology facelets (for jsf) or asp.net mvc, there's absolutely no need declare html xhtml. <!doctype html> suffice
Comments
Post a Comment