Closed Bug 293546 Opened 19 years ago Closed 19 years ago

No way to do "a instanceof b" using the JS API.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jst, Assigned: shaver)

Details

Attachments

(1 file)

I've got two objects and I want to find out if one's an instance of the other.
There's a JSClass hook that helps you implement this for your own classes, but
there's no JS engine API to do that check.
Comme ca?  It wants a doc-comment explaining that it is the equivalent of the
language |instanceof| construct, albeit with reversed operands, and that
JS_InstanceOf trades in native classes only.  We don't always get what we want,
though.
Attachment #183102 - Flags: superreview?(brendan)
Attachment #183102 - Flags: review?(jst)
Comment on attachment 183102 [details] [diff] [review]
the obvious, trivial patch

r/sr/a=me.  No doc comment, instead add to js/docs/jsref.xml.

/be
Attachment #183102 - Flags: superreview?(brendan)
Attachment #183102 - Flags: superreview+
Attachment #183102 - Flags: review?(jst)
Attachment #183102 - Flags: review+
Attachment #183102 - Flags: approval1.8b2+
Oh, and this does indeed do exactly what I wanted. Thanks for the quick fix!
This was already checked in. Marking FIXED.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Flags: testcase-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: