[webkit-dev] Constant readonly
Mario Bensi
mbensi at connected-labs.com
Tue Nov 30 00:49:40 PST 2010
Hi Darin,
I understand.
thanks for your help.
Mario
On lundi 22 novembre 2010 17:23:18 Darin Adler wrote:
> 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');
> > alert(node.ELEMENT_NODE);
> > node.ELEMENT_NODE = 666;
> > alert(node.ELEMENT_NODE);
> >
> > 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.
>
> -- Darin
>
>
More information about the webkit-dev
mailing list