[webkit-dev] Constant readonly
darin at apple.com
Mon Nov 22 08:23:18 PST 2010
On Nov 22, 2010, at 2:41 AM, Mario Bensi wrote:
> I tested if the constant in idl was readonly, like that :
> var node = document.getElementById('console');
> node.ELEMENT_NODE = 666;
> And it's strange, I can change ELEMENT_NODE value.
> I know it's stupid to do this but is it the correct behaviour ?
The property ELEMENT_NODE is read-only on the prototype for nodes. But there’s no rule against creating a property of the same name on an individual node. That is what your code does.
If you try:
Node.ELEMENT_NODE = 666;
You’ll see that you can’t change the value on the prototype for nodes.
More information about the webkit-dev