原型中的属性 [英] Property in prototype

查看:100
本文介绍了原型中的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想确定一个属性是否在Event原型中可用。

我试过这样做:


if(Event.prototype.srcElement)


但是我得到了一个对WrappedNative原型对象的非法操作

异常。无论如何都要看它是否已经定义。


我还有一个问题是__defineGetter__方法是否是

的一部分Javascript / ECMA脚本版本或者它是Mozilla专有的。


谢谢!

Robert

解决方案

< blockquote>


Robert写道:

另外一个问题是__defineGetter__方法是否是某些Javascript / ECMA的一部分脚本版本或者它是Mozilla专有的。




实现了JavaScript 1.5。该引擎用于Mozilla。所以人们可以说b_b $ b表示__defineGetter__是JavaScript 1.5的一部分,取决于考虑定义该版本的是什么


__defineGetter__不属于任何现有的ECMAScript规范

版本。


-


Martin Honnen
http://JavaScript.FAQTs.com/


< blockquote>


Robert写道:

我想确定一个属性是否在Event原型中可用。 />我试过这样做:

if(Event.prototype.srcElement)

但是我得到了一个对WrappedNative原型对象的非法操作
异常。无论如何都要看它是否已经定义。




是Firefox 1.03吗?然后你可能遇到了一个混乱的bug,这里描述了一个

的解决方法:


< http://developer-test.mozilla.org/ en / docs / Working_around_the_Firefox_1.0.3_DHTML_regression>


-


Martin Honnen
http://JavaScript.FAQTs.com/


Martin Honnen写道:



Robert写道:

我想确定一个事件中是否有可用的物业
prototype。
我试过这样做:

if(Event.prototype.srcElement)

但是我在WrappedNative原型上得到了一个非法操作对象
例外。无论如何都要看它是否已经定义。



是Firefox 1.03吗?然后你可能遇到了一个混乱的bug,这里描述了一个解决方法:




不使用Firefox 1.04

Are你暗示Event.prototype.srcElement应该有用吗?


Hi,

I would like to determine if a property is available in an Event prototype.
I tried doing this using:

if (Event.prototype.srcElement)

but I got an "Illegal operation on WrappedNative prototype object"
exception. Is there anyway to see if it already has been defined.

One other question I have is if the __defineGetter__ method is part of
some Javascript/ECMA Script version or if it is Mozilla proprietary.

Thanks!
Robert

解决方案



Robert wrote:

One other question I have is if the __defineGetter__ method is part of
some Javascript/ECMA Script version or if it is Mozilla proprietary.



__defineGetter__ is implemented in the Spidermonkey engine that
implements JavaScript 1.5. That engine is used in Mozilla. So one could
say that __defineGetter__ is part of JavaScript 1.5 depending of what is
considered to define that version.
__defineGetter__ is not part of any existing ECMAScript specification
version.

--

Martin Honnen
http://JavaScript.FAQTs.com/




Robert wrote:

I would like to determine if a property is available in an Event prototype.
I tried doing this using:

if (Event.prototype.srcElement)

but I got an "Illegal operation on WrappedNative prototype object"
exception. Is there anyway to see if it already has been defined.



Is that Firefox 1.03? Then you are probably running into a messy bug, a
workaround is described here:

<http://developer-test.mozilla.org/en/docs/Working_around_the_Firefox_1.0.3_DHTML_regression>

--

Martin Honnen
http://JavaScript.FAQTs.com/


Martin Honnen wrote:



Robert wrote:

I would like to determine if a property is available in an Event
prototype.
I tried doing this using:

if (Event.prototype.srcElement)

but I got an "Illegal operation on WrappedNative prototype object"
exception. Is there anyway to see if it already has been defined.


Is that Firefox 1.03? Then you are probably running into a messy bug, a
workaround is described here:



No I use Firefox 1.04
Are you implying that Event.prototype.srcElement should work?


这篇关于原型中的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆