E-mail List Archives

Re: unexplained code changes

for

From: G. Sørtun
Date: Nov 29, 2009 2:10AM


Tania wrote:
> I hope a member can enlighten me about some javascript code changes
> on my webpage. I do not know javascript but has google ads in my
> webpage which uses it. Yesterday, after checking a new webpage i
> found there are 2 additional lines added to the beginning of the
> google ad script.
>
> WHAT DO THE NEW CODES STAND FOR?

CDATA section start - CDStart, followed by the original HTML comment
start. There's most likely a "CDEnd" at the end of that script block
too, as the CDATA section wouldn't be complete without it.

See: <http://www.w3.org/TR/REC-xml/#sec-cdata-sect>;

In the right context - in an XML/XHTML document - the start and end of
the HTML comment is redundant as a CDATA section markup does the same
thing - gets interpreted the same way. In your case it looks like
"butter on fat" with an HTML comment inside a CDATA section, but it does
no real harm in there.

In all documents the HTML comment can be left out when the script block
is marked up correctly as <script ...> .... </script> - regardless of
what the markup is interpreted as, as only extremely old and by now
totally obsolete browsers made "uncommented" scripts visible. Such old
browsers don't treat CDATA section start/end correctly either - they
don't understand such section markers, but no problems in any
half-decent browser that's less than 10 years old.

> I did not add them in. the codes were copied from an old webpage.
> Everything was done in my computer. The old webpage had been verified
> by google. I don't realize when the additional lines were added in-
> and certainly not by me! I am the only one using the PC which is
> password protected.

Probably some version of the "HTML Tidy" clean-up program included in
your source-code editing package, which, rightly or wrongly, has
interpreted the markup to be XML/XHTML.
I do of course not really know if HTML Tidy _is_ part of your editor
package, or how it is set up, but there aren't all that many other
widespread source code clean-up programs around that may add such CDATA
sections markers...

See: <http://www.w3.org/People/Raggett/tidy/>;

HTML Tidy is quite useful when set up, and used, right, but when
included in editors Tidy is in my experience often made useless by
default...

Comment: <http://www.gunlaug.no/contents/wd_1_07.html>;

regards
Georg