I was testing browsers…

… and I noticed something odd – Opera, Firefox, and Internet Explorer all handle DOM Style colors differently when a script gets the color as a string. Let’s say you make something’s color red.

  1. Internet Explorer will keep the format you wrote it – if you put #FF0000, it will give “#FF0000?. If you put rgb(255, 0, 0), it will give “rgb(255, 0, 0)”.
  2. Firefox will turn everything into the rgb(###, ###, ###), turning “#FF0000? into “rgb(255, 0, 0)”.
  3. And to complicate everything, Opera converts all the colors into #hex notation, making rgb(255, 0, 0), become “#FF0000?.

Bothersome, ain’t it?

Leave a Reply