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

Closed
GoogleCodeExporter opened this issue Apr 6, 2015 · 4 comments
Closed

Inline JavaScript breaks XHTML strict validation #125

GoogleCodeExporter opened this issue Apr 6, 2015 · 4 comments

Comments

@GoogleCodeExporter
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
header)?
0.9.10.1-250

On what operating system?
CentOS 5.5

Which version of Apache?
2.2.3

Which MPM?
prefork

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: 
http://wemakeitrun.com/accounting2web/
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 code.google.com by aaronjwood on 2 Dec 2010 at 4:29

@GoogleCodeExporter
Copy link
Author

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: 
http://lachy.id.au/log/2006/11/xhtml-script .

Original comment by sligocki@google.com on 3 Dec 2010 at 10:45

@GoogleCodeExporter
Copy link
Author

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 mdste...@google.com on 7 Dec 2010 at 8:53

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

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

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

@GoogleCodeExporter
Copy link
Author

Fixed back in r298

Original comment by sligocki@google.com 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.
Projects
None yet
Development

No branches or pull requests

1 participant