VK said:
Well, we need "styleFloat" were we need it and "cssFloat" were we need
it depending on the environment where the script is running. I hope
you have no objection to that on.
No, but the problem is that you are not testing the relevant environment.
You are trying to determine a language implementation by the features it
supports, which is unrelated to the DOM property to be used.
Also obviously we are not making a new internal test on each and every
getScriptStyle or getSheetStyle function call as it would be hugely
ineffective.
It would not be ineffective. It would probably be less _efficient_ than
other approaches, but it would no doubt be safer. Where and when I have to
choose between efficiency and safety, I choose safety, because efficiency
can vary greatly depending on the runtime environment, and a safer approach
makes maintenance a lot easier (less expensive) in all runtime environments.
I hope you have no objection to that on.
I have, see above.
So we need to preset attFloat once in the most short, resource
effective and reliable way.
Non sequitur. The most reliable way is not to infer anything.
var jsx_object = jsx.object;
var v = jsx_object.getProperty(o, "cssFloat",
jsx_object.getProperty(o, "styleFloat", ""));
if (v)
{
// ...
}
whereas jsx.object.getProperty() would here be a method that determines with
o.hasOwnProperty() or, if unavailable, a `typeof' test, if the object
referred to by `o' has a property named "cssFloat"; if yes, return its
value, else return the value of the third argument, which here is either the
value of the `styleFloat' property of `o' or the empty string.
Of course, one could test the `float' implementation of only one object, and
infer from there to increase runtime efficiency. But since that would still
be inference, and thus not be safe enough, I would recommend against that.
PointedEarsa