Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Inline JavaScript breaks XHTML strict validation #125

GoogleCodeExporter opened this issue Apr 6, 2015 · 4 comments

Inline JavaScript breaks XHTML strict validation #125

GoogleCodeExporter opened this issue Apr 6, 2015 · 4 comments


Copy link

What steps will reproduce the problem?
1. Write a small script and place it in an external .js file
2. View the source of the page and see the small script placed in the head 
section of the page instead of in the external .js file
3. Validate the page with an XHTML strict doctype and view errors

What version of the product are you using (please check X-Mod-Pagespeed

On what operating system?
CentOS 5.5

Which version of Apache?

Which MPM?

Please provide any additional information below, especially a URL or an
HTML file that exhibits the problem.
This is happening on a site I am currently developing for a client. I recently 
put the site up yesterday "as is" so the client could see it. I went to do some 
validation checking today and noticed this problem. Here's the URL:
Originally, I had all the javascript that's now in the head section in an 
external file called main.js.
I assume it's breaking validation because it doesn't have the proper <!-- // 
--> or the CDATA tag around it...

Original issue reported on by aaronjwood on 2 Dec 2010 at 4:29

Copy link

Your right. It appears that strict XHTML does not allow inline scripts unless 
they are (A) escaped or (B) surrounded by CDATA[[ ]].

Matthew, could you look into this. We could either turn off inlining JS for 
XHTML or just add the //CDATA tags as suggested here: .

Original comment by on 3 Dec 2010 at 10:45

Copy link

Thanks for the report.  I have a fix for this in the works now; it should make 
its way into trunk in the near future.

Original comment by on 7 Dec 2010 at 8:53

  • Changed state: Started

Copy link

You're welcome :) Glad to be of help.

Original comment by aaronjwood on 7 Dec 2010 at 8:58

Copy link

Fixed back in r298

Original comment by on 31 Dec 2010 at 12:34

  • Changed state: Fixed
  • Added labels: release-note

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

1 participant