Bug 61101

Summary: KHTML ignores scripts inside cdata sections when used in xhtml [testcase]
Product: [Applications] konqueror Reporter: djoham
Component: khtml parsingAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: attaching test case

Description djoham 2003-07-11 20:47:41 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:          Linux

Hello,

According to http://www.w3.org/TR/xhtml1/#h-4.8, it is appropriate to use the following syntax for javascript in xhtml documents:

<script type="text/javascript">
<![CDATA[
... unescaped script content ...
]]>
</script>

Konqueror's KHTML engine doesn't seem to support this. If you take the following (valid xhtml) code and name it test.xhtml (the.xhtml is important) and run it through Mozilla, you'll get an alert box when you press the button. Konq will render the page, but will not display the alert when the button is pressed. 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
<title>
Test</title>
</head>
<body>
    <div>
        <button type="button" onclick="go()">Hello world</button>
    </div>
    <script type="text/javascript">
        <![CDATA[
        function go() {
            alert("hello world");
        }
        ]]>
    </script>

</body>
</html>


Thanks for looking into this!

David
Comment 1 Stephan Kulow 2003-11-27 20:05:06 UTC
Created attachment 3446 [details]
attaching test case
Comment 2 Tommi Tervo 2004-10-20 11:54:14 UTC
Works fine with khtml from CVS-head.