You are correct that this is the expected behavior of the given code
on an implementation of the DOM that follow the spec to the letter.
I misunderstood your comment to be related to the intended behavior
of the code.
Thanks for clarifying.
That is correct.
It is not what it was *intended* to do, though, so it's a fair guess
that the function actually throwing the exception is a bug in the
function.
That function will fail with any browser that implements DOM 2 Style and
throws errors on unparsable values. SO far we've only seen that in MSIE.
[...]
Not at all. I never said that IE was wrong. I stated that the function
was broken, because it doesn't correctly handle the behavior of IE.
I can't agree with the thinking that the function is broken because it
doesn't correctly handle the behavior of IE.
Try to understand where I'm coming from here.
There is a specification stating that an error should be thrown. If IE
were to not throw an error, would you surmise that no browser throws an
error, or that it works in "all browsers" do? We didn't even test in
Blackberry -- but that's not the point.
The point is that before declaring a bug or "it works" or any expected
outcome, you must first have a clear understanding of reasonable
expectations for that function.
Those reasonable expectations are made by more than mere observations of
what happens in a few browsers. The specification is highly relevant
here because it helps get past the part of "what browsers do" to "what
browsers must do"; it is *not* useless.
I did.
Your answer is correct, but useless.
No, my answer is correct and relevant and useful.
I saw Jorge's strategy of developing a function based around what four
browsers do. I saw him blame the browser (IE in this case) that didn't
behave the same way. I saw the misconception that IE is wrong and then I
saw you echo that. I read that the function was "broken in IE because IE
behaves differently."
The function is not broken in IE because IE behaves differently.
The function is broken by design and approach. It is the design of: Try
[thing] in a small set of browsers, check the result, generalize and
deduce an assertion based upon said generalization. That is not a
logical way to go about making an assertion of expected outcome.
However, such assertion is what followed. And what followed was blaming
the one who acted differently. That one happened to be MSIE.
To quote Jorge in response to me claiming that his code was broken:
| In Microsoft's Internet Explorers... what's not broken in that piece
| of crap ?
Now on a deeper philosophical level, and existential level, I see this
sort of generalization fallacy being employed by humans.
I get the you're-not-right-you're-different a lot.
Now we have all these so-called minority groups for gays, blacks, jews,
etc, but what about the individual? Isn't that the smallest denomination
of humanity itself? Don't I have a group? No, I must not! I must not
think for myself. Nobody does that. That must be wrong!
[...]
I never disagreed with the DOM spec saying that an exeption should
be thrown, and that IE is correct in doing so, and that the function
was broken as written because it didn't handle that exception.
Now it does.
It avoids known errors in IE but more important, it is somewhat
future-proof against such errors.
We did not cover, however, disparity that may be seen in CSS3 system
colors or the keyword "inherit" or "currentColor", and so if the UI is
going to round-trip (user sends value to server, server sends value back
to any web client) then you could potentially see:
Firefox 4 ----> Server ----> IE6
Thus, if the user inputs "currentColor" in Firefox 4, and then returns
in IE6, he may see "" instead.
Firefox 4 --------> Server ---------> IE6 --> Server
"currentColor" --> "currentColor" --> "" ---> ""
Now the user won't see javascript errors because those errors are now
suppressed but he will get inconsistent results when the color value
that was set in Firefox is not in the safe subset of colors allowed by IE.
The post on this thread by rf pointed this out and touched upon such
issue. And provided the idea of creating your own color list. And my
early response about loving "papayawhip" and "cornflowerblue", if it
wasn't obvious, was a joke.
[...]