alignment of megaliths

The main point of the standards is of course to align the megaliths rendering and scripting engines of standards-compliant browsers. I've already discussed some of the problems arising when specs and implementations clash, and the dilemmas we face when we have the choice between being strictly standards-compliant and breaking some major website or breaking the spec, aligning with the other browsers, and making the site(s) work.

Never an easy decision to make!

I can now confirm a few points where Opera 9.5 is going to deviate somewhat from the specs or from our earlier implementations in order to be better aligned with other browsers. If you are a webmaster or JavaScript author please check that the changes will not cause problems for you!

We'll do the following:

  • Capturing event listeners will fire on target. This behaviour will be kept until Firefox fixes their bug. Opera's new implementation is not expected to cause problems since most sites using the addEventListener API will have been tested against Firefox. A possible exception is widget code which may expect Opera's old behaviour.
  • Implementation of capturing load event handlers changed: load events from within the document will now only be captured when the capturing event listener is attached to the document. In other words, earlier you could do
    window.addEventListener('load', func, true)

    and expect func to be called for all "load" events inside the document. From 9.5 you will have to do

    document.addEventListener('load', func, true)

    to get this capturing behaviour. (Please do not copy that code unless you know what the "true" part of it means!) This will probably become the official specification. Again, this will probably only break code specifically written for Opera such as widgets, and the change is known to fix large number of websites that use event capture by mistake.

  • We've changed the relationship between body.clientHeight and documentElement.clientHeight in standards mode. The value of body.clientHeight is now viewport height, documentElement.clientHeight is document height. This is AFAIK what Firefox does too. This change can break your website if you use browser detection before reading clientHeight from body or documentElement.

I believe Firefox will support adding capturing load events to document. There you go, alignment of megaliths!

(Like the post title? Found it on Wikipedia :).)

10 thoughts on “alignment of megaliths

  1. wouldn't it be possible for opera to see if it is specifically targeted by code, and then (unless masked as another browser) just act like opera instead of mimicking other browsers?

  2. "wouldn't it be possible for opera to see if it is specifically targeted by code"Not reliably at all, no. Sniffers are terribly unreliable and unpredictable things. You never know if they are being used responsibly or irresponsibly. Sniffing out the sniffers would be even less reliable than the code that uses them.The changes are basically needed because the vast majority of sites that use these features, expect the new approach. In the few cases where sites have specifically tailored their code to work with Opera's implementation, we hope that since they have already allowed for Opera once, they will update to take care of the new approaches. This is why we want to let them know early so they have the time to adapt. If needed, there is the possible fallback of BrowserJS, but it's best if Web developers can have the time they need to update their code.The first change is, unfortunately, not in line with the DOM 2 events spec (to my knowledge, the DOM 3 events spec is not yet decided on this subject, and there are ongoing discussions in the working group). However, it is in line with all major implementations, including Gecko, KHTML/KJS, WebKit, and even iCab. This is one case where (IMHO) the real Web is dictating that the spec will probably need to be changed, and we can attest to that.The second change is allowed by the current spec, since the DOM events spec does not cover the window object at all, and only recognises the document object. Opera 9.5 complies with that, and captures load events on the document (just like KHTML/KJS and WebKit). When it comes to the window object, it has always been browsers trying to be compatible with each other, without a spec to follow (though that will change). In this case, Opera 9.5 will be compatible with the other implementations when it comes to the window object, which is a positive thing.The last change relates to two properties that are extensions to JavaScript (initially introduced by Internet Explorer, I think). So basically, since we implement properties added by another browser, we should do so correctly, so we are doing that in 9.5, and implementing them in the same way as Internet Explorer in standards mode. Opera 9.2's approach was incompatible, and was a bug. That bug will be fixed in Opera 9.5.

  3. Capturing event listeners will fire on target. This behaviour will be kept until Firefox fixes their bug.

    They'll never fix that bug ! They questioned the dom mailing list about their behaviour, quoting all but the right reasons, and the answer they got was that the spec is right, and they have to change Gecko's behaviour. So, for it not to look that bad, instead of making bug 235441 as invalid, or wontfix, they simply ignore it, and mention the old open source etiquete whenever someone ask to fix it, although there is already a submitted path for the bug, which still hasn't been looked at nor merged.

  4. #235441 is listed as blocking 1.9 (Firefox 3.0) but I guess it might not make it this late in the game (although we are still in the alpha stage so hope springs eternal).

  5. Webkit has already gone down the road that we are going down now. They used to implement capture phase firing according to the spec (not firing on the target in capture phase), but they found themselves having to implement the same behaviour as Opera 9.5 will use (starting with Safari 1.2 I think).Since then, from what I have read in bug reports, they experimented with fixing it again, found that it broke too much, and reverted the fix. I assume that if Firefox were to fix the bug, and the Web pages were to change to accommodate that, that Webkit would also fix it. But please don't trust my memory on that one – I am not in any way a spokesperson for Webkit, check their bug tracking system if you want more details.As for Opera on Wii, the current release uses a version of the scripting engine that contains the change to capture phase firing on target, and the clientHeight fix, but it seems not the load capturing change.

Leave a reply to Andrew Gregory Cancel reply