Hey,
I’m wondering whether there is a (fast/easy) way to determine if an objects property is a read-only property (a getter).
My script is going to try and assign values to properties of objects, usually HTMLElements.
But it’ll come across some properties that are getters, like this:
[CODE]
var myEl = document.getElementById(“someDiv”);
…
var propName = “offsetWidth”;
…
myEl[propName] = someValue;
Don’t worry about this example, it’s far from my actual implementation.
So far I’ve considered using a try statement around the assignment so I can ignore the error, but I’m not certain about the speed of a try statement and speed is an important factor (lots of looping going on in there).
So, does anyone know of an easy way to determine if a property is read-only?
Thanks in advance.