Web browsers differences: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
== Internet Explorer ==
= Internet Explorer =


=== General ===
== General ==


* Debugging JavaScript on IE is a lot harder than on FF. The best is to install Firebug Lite. However, you must not use console.log() before the window is loaded (else you'll get a very annoying fatal error saying IE cannot open the page).
* Debugging JavaScript on IE is a lot harder than on FF. The best is to install Firebug Lite. However, you must not use console.log() before the window is loaded (else you'll get a very annoying fatal error saying IE cannot open the page).
Line 7: Line 7:
* IE caches *a lot*. In particular Ajax requests can be cached! Be sure to put some caching directives on the server side, else IE simply won't hit your server again. It'll use the cached version.
* IE caches *a lot*. In particular Ajax requests can be cached! Be sure to put some caching directives on the server side, else IE simply won't hit your server again. It'll use the cached version.


=== CSS bugs ===
== CSS bugs ==


* IE 7 has a bug regarding elements with z-index (absolutely positioned elements with relatively positioned parents).
* IE 7 has a bug regarding elements with z-index (absolutely positioned elements with relatively positioned parents).
Line 18: Line 18:
* If you have new lines in anchor (<a>) elements, IE may mess your page (the behavior I got was that IE thought the page was very wide, so I got an horizontal scrollbar).
* If you have new lines in anchor (<a>) elements, IE may mess your page (the behavior I got was that IE thought the page was very wide, so I got an horizontal scrollbar).


=== JavaScript bugs ===
== JavaScript bugs ==


* The "change" event does not work as expected on checkboxes (it fires only when the checkbox loses focus). A workaround is to use the "click" event.
* The "change" event does not work as expected on checkboxes (it fires only when the checkbox loses focus). A workaround is to use the "click" event.
Line 26: Line 26:
* The results of a regular expression evaluation in IE may be empty strings, whereas in Firefox it's undefined (null) objects.
* The results of a regular expression evaluation in IE may be empty strings, whereas in Firefox it's undefined (null) objects.


=== Different behavior than Firefox (not necessarily bugs) ===
== Different behavior than Firefox (not necessarily bugs) ==


* IE 7 automatically adds margins to forms. You can override that behavior with CSS.
* IE 7 automatically adds margins to forms. You can override that behavior with CSS.


=== Links ===
== Links ==


* [http://css-discuss.incutio.com/?page=IE7 A good link to IE 7 bugs.]
* [http://css-discuss.incutio.com/?page=IE7 A good link to IE 7 bugs.]


== Opera ==
= Opera =


* location.hash is bugged when the hash contains a question mark. '''Update:''' this seems to have been fixed.
* location.hash is bugged when the hash contains a question mark. '''Update:''' this seems to have been fixed.
Line 41: Line 41:
* Opera does not fire the "load" event on an newly created image, which has already been downloaded (eg, whose source corresponds to an already fetched element). This is probably a bug that hopefully will be fixed.
* Opera does not fire the "load" event on an newly created image, which has already been downloaded (eg, whose source corresponds to an already fetched element). This is probably a bug that hopefully will be fixed.


=== CSS ===
== CSS ==


* When using an element with fixed position at the bottom of the page, you usually add an absolutely positioned element with a negative bottom value to provide scrolling. This technique does not seem to work very well in Opera.
* When using an element with fixed position at the bottom of the page, you usually add an absolutely positioned element with a negative bottom value to provide scrolling. This technique does not seem to work very well in Opera.


=== JavaScript ===
== JavaScript ==


* Opera has a default behavior when using a mousedown event on an image. You can prevent that from happening with event.stop() in Prototype as usual. However, if in the same function you move an image directly under the mouse (for example this could be the case with a slider...), another mousedown event launches, this time on the moved image! And then you get the annoying behavior. This can easily be fixed by stopping the second event. I consider this a bug as Firefox does not launch the second event. Once the original event is stopped, nothing further happens.
* Opera has a default behavior when using a mousedown event on an image. You can prevent that from happening with event.stop() in Prototype as usual. However, if in the same function you move an image directly under the mouse (for example this could be the case with a slider...), another mousedown event launches, this time on the moved image! And then you get the annoying behavior. This can easily be fixed by stopping the second event. I consider this a bug as Firefox does not launch the second event. Once the original event is stopped, nothing further happens.
= Firefox =
== CSS ==
* You cannot correctly change the properties of a file upload form field with CSS. [https://bugzilla.mozilla.org/show_bug.cgi?id=52500 Firefox has a bug] that prevents width from correctly working on the associated text field. All other browsers support this correctly though.

Revision as of 09:23, 30 June 2008

Internet Explorer

General

  • Debugging JavaScript on IE is a lot harder than on FF. The best is to install Firebug Lite. However, you must not use console.log() before the window is loaded (else you'll get a very annoying fatal error saying IE cannot open the page).
  • Only use Prototype JS code or you'll run into troubles (mainly because all elements should be extended Prototype elements to ensure cross-browser behavior).
  • IE caches *a lot*. In particular Ajax requests can be cached! Be sure to put some caching directives on the server side, else IE simply won't hit your server again. It'll use the cached version.

CSS bugs

  • IE 7 has a bug regarding elements with z-index (absolutely positioned elements with relatively positioned parents).
  • IE does not properly support CSS comments; multiple CSS comments on one line, with an actual property / value set, confuses the poor piece of crap.
  • IE seems to have a bug when multiple floated divs are present on a container, with their widths in percentage. If the percentage amounts to exactly one hundred (100%), then it will not render correctly. To fix this, you can just make the widths go only to 99% if possible.
  • IE does not like absolute positioning on anchor elements or images; but you can usually fix it by wrapping in a div or span. Apparently for IE it is better to give both top and left properties for absolutely positioned elements (eg, both coordinates).
  • text-align: center can also cause misbehavior, usually you can fix it by only applying this property to a subelement.
  • IE 7 does not support attribute selector when the attribute is "for" (on a label).
  • IE 7 has a strange behavior on an absolutely positioned element when top: is used (bottom is fine) and the relatively positioned ancestor has not a width of auto. Having a 100% width confuses IE. It is important with our technique for a generic skinning of a block for example (when the block did not have a fixed width this caused problems).
  • If you have new lines in anchor (<a>) elements, IE may mess your page (the behavior I got was that IE thought the page was very wide, so I got an horizontal scrollbar).

JavaScript bugs

  • The "change" event does not work as expected on checkboxes (it fires only when the checkbox loses focus). A workaround is to use the "click" event.
  • Same thing for radio buttons.
  • When adding a CSS rule dynamically to a stylesheet, IE chokes if the rule selector part actually contains more than one selector. Eg, if the selector contains the "," syntax element. You must manually break the rule into two rules before.
  • Also note that when dealing with stylesheets dynamically, IE seems to be at least 20 times slower than Firefox.
  • The results of a regular expression evaluation in IE may be empty strings, whereas in Firefox it's undefined (null) objects.

Different behavior than Firefox (not necessarily bugs)

  • IE 7 automatically adds margins to forms. You can override that behavior with CSS.

Links

Opera

  • location.hash is bugged when the hash contains a question mark. Update: this seems to have been fixed.
  • myForm.readAttribute("action") behaves differently in Opera, as it adds the hostname before (which is bad!). The bug was apparently fixed in Opera 9.50 (see this bug reference).
  • Opera automatically adds margins to forms.
  • Opera does not fire the "load" event on an newly created image, which has already been downloaded (eg, whose source corresponds to an already fetched element). This is probably a bug that hopefully will be fixed.

CSS

  • When using an element with fixed position at the bottom of the page, you usually add an absolutely positioned element with a negative bottom value to provide scrolling. This technique does not seem to work very well in Opera.

JavaScript

  • Opera has a default behavior when using a mousedown event on an image. You can prevent that from happening with event.stop() in Prototype as usual. However, if in the same function you move an image directly under the mouse (for example this could be the case with a slider...), another mousedown event launches, this time on the moved image! And then you get the annoying behavior. This can easily be fixed by stopping the second event. I consider this a bug as Firefox does not launch the second event. Once the original event is stopped, nothing further happens.

Firefox

CSS

  • You cannot correctly change the properties of a file upload form field with CSS. Firefox has a bug that prevents width from correctly working on the associated text field. All other browsers support this correctly though.