The Good Life... a weblog about life, technology, and the Opera web browser

Acid2 - Spec. Violations vs. Page Rendering Problems

Two of the Acid2 bugs in Opera have somewhat interesting histories. First, there's a bug with the handling of HTML comments. According to the W3C HTML 4.01 spec., an HTML comment can contain multiple comments inside each markup declaration delimiter pair. We used to handle comments according to the HTML 4.01 spec., but found problems on a couple of pages. Since Internet Explorer doesn't treat HTML comments according to the spec., authors didn't see the problem. After unsuccessfully attempting to get the pages fixed, we decided to break the spec. and treat everything between markup declaration delimiters as comments like Internet Explorer. This causes the word "ERROR" to appear in row 13 of the Acid2 test.

We had similar problems with :hover rules on some Web sites. Many authors didn't specify classes, IDs, and/or elements along with the :hover pseudo-class in selectors (thus triggering the universal selector). Internet Explorer only supports the :hover pseudo-class for A elements, so most page authors didn't know that a problem existed. Again, after unsuccessfully attempting to get the pages fixed, we decided to break the spec. and prevent the :hover pseudo-class from working with the universal selector. This causes the nose in rows 6 to 9 to turn red when hovered rather than blue.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Note: Comments with a light blue background were made by the site owner.

So, will Opera continue suppo

So, will Opera continue support these behaviours or Opera will go standards like Mozilla and Safari?
I personally think that this days too many people already use "right" browsers, so authors just can't do their designs only for one browser anymore.

We haven't decided yet. We n

We haven't decided yet. We need to do more testing to see how these changes affect existing Web pages. One possibility is to only do these changes for Standards mode, which could minimize site compatibility issues.

Microsoft has the same reason

Microsoft has the same reason not going to standards. Most people designed and unfortunately still design and test pages only for IE.
So, Microsoft has same fear as you guys, one difference is number of users. ;)
Be brave, Opera!

What about Quirks Mode?

I completely disagree with such pseudo-solution :( For God's sake, there is a simple solution for it. This quirky behaviour should be simply limited to Quirks Rendering Mode only. Mozilla Gecko has already got such solution. Compare Standards Mode: http://webstandards.org/act/acid2/test.html#top vs. Quirks Mode: http://quiris.klub.chip.pl/testy/acid2-quirk.html#top in Mozilla Firefox. If they did it, Opera could do it either. I don't understand why Opera has chosen its own way of dealing with these two bugs :(
--
Best regards
Robert Błaut

We may be moving these to Qui

We may be moving these to Quirks mode only, but some of the Web pages that caused these problems may have been using a Standards mode DOCTYPE. Quirks mode is not the answer to every problem. We try to minimize its use whenever possible.

As far as I'm concerned, Oper

As far as I'm concerned, Opera should follow the spec 100% in standards mode, no matter what. Page authors providing no (or a 'quirks') doctype can be expected to be ignorant, authors providing a strict doctype cannot. They specifically ask browsers to render their page as per the spec, any resulting errors are their own responsibility.

If a major site with strict doctype still 'fails', user css or js would be the only viable solution.

Changes not for the better, fixing the spec

For HTML comments the obvious solution would be to fix the spec. Yes, the spec states that "--" is the comment delimiter, but adhering to this rule makes for worse usability. There are other aspects of HTML that has been quietly ignored by every browser since its creation and I can't see why this should be an exception.

:hover is different, there is no doubt that :hover applies to every element "under" a pointing device in CSS2.1. Still this is not a very useful selector, so the likelihood of this being an error is far higher than by intent. This is being compounded by CSS1 explicitly stating "In CSS1, anchor pseudo-classes have no effect on elements other than 'A'. Therefore, the element type can be omitted from the selector". In other words in CSS1 :hover and a:hover is the same selector. The long term solution here to could be to fix the spec, in this case giving an explicit warning in this section of CSS1 never to use :hover to mean a:hover. In the meantime I would recommend all authors actually intending to use :hover in the CSS2.1 sense to use a complex selector, e.g. "html :hover" or "* :hover".

I want to clear...

The above deliberation concerning :hover pseudo-class is CSS1 is simply wrong because there is no :hover in CSS1 as porneL explained earlier ;)
--
Best regards
Robert Błaut

"Many authors didn't specify

"Many authors didn't specify classes, IDs, and/or elements along with the :hover pseudo-class in selectors (thus triggering the universal selector)."

This statement isn't entirely correct.  IDs and classes "trigger" the universal selector too.  In fact, Opera's current standpoint on the :hover pseudo-class combined with the universal selector is inconsistent in that *:hover is blocked but *.class:hover is not.  I did come across a lot of pages with CSS styles like these:

/* General rules */
p, td { font: 16px "Times New Roman", serif }
.gray { color: gray }

/* Anchors */
a { text-decoration: none; font-size: 21px }
.gray:hover { font-weight: bold; font-size: 20px }

Then in the HTML:


<p><font class="gray">Paragraph text</font></p>
<table><tr><td class="gray">Text in table cell</td></tr></table>
<p><a href="#" class="gray">Some link text</a></p>

This CSS code is rather simplistic, but it can get worse.  So I'm wondering why Opera blocks *:hover but allows *.class:hover...

Because it was when only the

Because it was when only the :hover pseudo-class was used (without elements, classes, or IDs) that we saw problems.

That sounds reasonable. Ei

That sounds reasonable.

Either way, I'm on my "little crusade" in explaining these web authors why their code has this effect in Opera.  Probably one of the biggest examples is the InstantASP message board software.  Often times, you need to explain this several times before they get what you're talking about... ;-)