Bug 110926 - Konqueror errorneously interpretes CSS comment as HTML one
Summary: Konqueror errorneously interpretes CSS comment as HTML one
Status: RESOLVED NOT A BUG
Alias: None
Product: konqueror
Classification: Applications
Component: khtml parsing (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-16 22:46 UTC by Candid Dauth
Modified: 2005-10-12 00:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Testcase that shows the bug. (579 bytes, text/html)
2005-08-16 22:47 UTC, Candid Dauth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Candid Dauth 2005-08-16 22:46:07 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    Compiled From Sources
OS:                Linux

I'm sorry if this bug has already been fixed but I've got only KDE 3.4.1 at the moment.

Well, see testcase. The <!-- in the style block is a CSS comment, that was originally used so that Netscape 1 wouldn't show the CSS/JS code in style/script elements. Many web pages still use it today.

So, I "forgot" to "close" that comment in the testcase, actually I don't have to close it because it's a CSS comment and it only marks the end of its line as commented out. But Konqueror takes it as HTML comment and ignores the HTML code after the style information. It's quite weird that Konqueror even shows the background colour as red then.

Konqueror should -- like Firefox does -- show the popup at loading and the background colour should be green.
Comment 1 Candid Dauth 2005-08-16 22:47:12 UTC
Created attachment 12242 [details]
Testcase that shows the bug.
Comment 2 Thiago Macieira 2005-08-22 00:58:44 UTC
<!-- [something] --> is an SGML comment and is valid in XML.

So, for Konqueror, your page is:
		<style type="text/css">
		</script>
		<style type="text/css">
			body { background-color:#0f0; }
		</style>

So, it's completely wrong. The Konqueror parsing is correct.
Comment 3 Candid Dauth 2005-10-12 00:04:47 UTC
> <!-- [something] --> is an SGML comment and is valid in XML.

In XML it would be, but in this case it’s HTML. According to the HTML DTD, both <style> and <script> contain #PCDATA, which means that HTML code inside them may not be interpreted. The #PCDATA block is closed by “</”, so the comment shouldn’t be interpreted like a comment but like PCDATA.