I was testing browsers…
Sunday, 18 December 2005
… 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.
- 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)”.
- Firefox will turn everything into the rgb(###, ###, ###), turning “#FF0000? into “rgb(255, 0, 0)”.
- And to complicate everything, Opera converts all the colors into #hex notation, making rgb(255, 0, 0), become “#FF0000?.
Bothersome, ain’t it?