Firefox bug? Everything gets displayed

Recently I’ve been playing with Web Standards and Ajax. I noticed an interesting bug (or feature?) of Firefox while digging into the almighty CSS.

Environment:

  • Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2
  • Windows Server 2003 R2

Description:

Firefox renders some HTML elements which are not expected to be displayed, when their display CSS property is set to a value other than none.

Elements like <title>, <style> or <script> are not for display purpose. By default, their display CSS property is none. However, these elements, like <span> and <div>, are part of the DOM structure thus we can specify any property for them. What would happen if I specify display:block for all elements?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Firefox bug</title>
<style type="text/css">
/* CSS source is displayed*/
* {
display:block;
}
</style>
<script type="text/javascript">
var msg = "javascript is displayed, too.";
</script>
</head>
<body>
<p>Bug: Why does firefox display the source code? :)</p>
</body>
</html>

The universal selector * matches all elements including <title>, <style> and <script>. Firefox displays the page as follows.

This seems buggy to any end-user but is technically reasonable. It indicates that Firefox treats all html elements in a uniform way. However, according to the semantic meaning, those elements should never be rendered.

Advertisements
This entry was posted in Web. Bookmark the permalink.

6 Responses to Firefox bug? Everything gets displayed

  1. Unknown says:

    最近没有看到你写的东西呢

  2. 栓昱 says:

    不觉得是bug.
    你好! 我是无意中闯进你的blog的。因为被点名玩游戏,我找不到认识的人了,就想随机找找陌生人来玩。来我的blog看看吧,一定要留言给我!!!http://spaces.msn.com/deepersocket/

  3. Unknown says:

    wow gold!All wow gold US Server 24.99$/1000G on sell! Cheap wow gold,wow gold,wow gold,Buy Cheapest/Safe/Fast WoW US EU wow gold Power leveling wow gold from the time you wWorld of Warcraft gold ordered!

    wow power leveling wow power leveling power leveling wow power leveling wow powerleveling wow power levelingcheap wow power leveling wow power leveling buy wow power leveling wow power leveling buy power leveling wow power leveling cheap power leveling wow power leveling wow power leveling wow power leveling wow powerleveling wow power leveling power leveling wow power leveling wow powerleveling wow power leveling buy rolex cheap rolex wow gold wow gold wow gold wow gold -29682890625706

  4. Unknown says:

    wow gold!All wow gold US Server 24.99$/1000G on sell! Cheap wow gold,wow gold,wow gold,Buy Cheapest/Safe/Fast WoW US EU wow gold Power leveling wow gold from the time you wWorld of Warcraft gold ordered!

    wow power leveling wow power leveling power leveling wow power leveling wow powerleveling wow power levelingcheap wow power leveling wow power leveling buy wow power leveling wow power leveling buy power leveling wow power leveling cheap power leveling wow power leveling wow power leveling wow power leveling wow powerleveling wow power leveling power leveling wow power leveling wow powerleveling wow power leveling buy rolex cheap rolex wow gold wow gold wow gold wow gold -34656432314963

  5. Unknown says:

    wow gold!All wow gold US Server 24.99$/1000G on sell! Cheap wow gold,wow gold,wow gold,Buy Cheapest/Safe/Fast WoW US EU wow gold Power leveling wow gold from the time you wWorld of Warcraft gold ordered!

    wow power leveling wow power leveling power leveling wow power leveling wow powerleveling wow power levelingcheap wow power leveling wow power leveling buy wow power leveling wow power leveling buy power leveling wow power leveling cheap power leveling wow power leveling wow power leveling wow power leveling wow powerleveling wow power leveling power leveling wow power leveling wow powerleveling wow power leveling buy rolex cheap rolex wow gold wow gold wow gold wow gold -210042495649229

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s