Loading ...
Sorry, an error occurred while loading the content.

Re: CDATA on Inline Scripts

Expand Messages
  • Douglas Crockford
    ... I currently have no plans to support XHTML. Instead, I am improving the HTML support.
    Message 1 of 4 , Aug 20 5:19 AM
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "Paul" <DWTebriel@...> wrote:
      >
      > --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@>
      > wrote:
      > >
      > > --- In jslint_com@yahoogroups.com, "Paul" <DWTebriel@> wrote:
      > > > I currently have code that looks like the following:
      > > >
      > > > <script type="text/javascript">
      > > > //<![CDATA[
      > > > ...
      > > > //]]>
      > > > </script>
      > > >
      > > > Since I'm doing this in xhtml, my IDE likes that tag being there,
      > > > otherwise it blows up on typical xml characters like [<]. However,
      > > > JSLint is returning a statement such as the following:
      > >
      > > XHTML is a fiction. If it were real, you wouldn't need to hide the
      > > hideous CDATA overhead behind JavaScript comments. You would do better
      > > to write your code like this:
      > >
      > > <script>
      > > ....
      > > </script>
      > >
      > > It is smaller, cleaner, faster.
      > >
      > > Even better, do not put any script in HTML files. Use script src.
      > > Separate the markup from the behavior. This tends to lead to better
      > > designs. It also can provide better performance because of
      > > opportunities for minification, compression, and caching.
      > >
      > Hey thanks for the reply!
      >
      > For the browsers that support a content-type of
      > "application/xml+xhtml", is there any advantage for JavaScript when
      > working with the DOM compared to "text/html"? If not, then yeah I
      > agree that xhtml, while cool in theory, is sadly fictional.
      >
      > The only reason I have inline scripting is so that I can pass data
      > directly into a view page from a controller using monorail. I keep all
      > event handling and other scripting in separate pages. I would rather
      > pass it in on the view than do an additional http request for data on
      > top of the initial one personally. Since our web apps here use xhtml,
      > I have to use the cdata tags to actually code in real (theoretical?)
      > xhtml. So I was just wondering if there was a way to suppress those
      > warnings for those commented cdata tags.

      I currently have no plans to support XHTML. Instead, I am improving
      the HTML support.
    Your message has been successfully submitted and would be delivered to recipients shortly.