HTML special characters need to be escaped in JavaScript code, the following line:
if (oAnim && oAnim.isAnimated()) {
will generate HTML validation errors because the two ampersands are not escaped.

Theoretically these characters can be escaped in the JavaScript code or you can use a CDATA block. I say theoretically because I could not get it working :-(

Comments

bakyildiz’s picture

This code comes from yui package. So actually i do not understang what the problem is ? Is it possible to give an example that i can produce and understand the problem ?

bakyildiz’s picture

Assigned: Unassigned » bakyildiz
mariuss’s picture

Well, try to validate a page that has this JavaScript in it.

The problem is that you cannot have plain ampersands, less than or greater than characters in an HTML page, even if this is in a JavaScript block.

Tried to find a solution and I could not find one that would work with both xhtml and html templates. The only solution I can think of is to move the JavaScript code to an external file and just include that file. If the JavaScript code is in an external file then there are escaping issues.

bakyildiz’s picture

Status: Active » Closed (fixed)
xjessie007’s picture

The problem is that you cannot have plain ampersands, less than or greater than characters in an HTML page, even if this is in a JavaScript block.

I am having the same problem. Anyone has a solution to this?