Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Equivalent of "super" in XBL?

25 views
Skip to first unread message

Greg Allen

unread,
Mar 30, 2010, 10:10:50 PM3/30/10
to
Is there an equivalent of the Java "super" in XBL?

I have two bindings, "a" and "b". Binding "b" extends "a". Both define
the method "method".

I'd like to be able to call a.method() from b.method(), after b.method has
done some other stuff.

Can this be done?

Thanks,

-- Greg


Boris Zbarsky

unread,
Mar 30, 2010, 10:47:58 PM3/30/10
to

I _think_ that this.__proto__.__proto__.method should be the right thing
if you know b is the most-derived binding....

In the general case, though, you can't do it in xbl1. Not sure about xbl2.

-Boris

Sean Hogan

unread,
Mar 30, 2010, 11:50:52 PM3/30/10
to Greg Allen, dev-te...@lists.mozilla.org

In XBL2 there is the baseBinding property on binding instances.
See http://www.w3.org/TR/xbl/#basebinding


Andrew Sutherland

unread,
Apr 1, 2010, 2:03:38 PM4/1/10
to
On 03/30/2010 07:47 PM, Boris Zbarsky wrote:
> I _think_ that this.__proto__.__proto__.method should be the right thing
> if you know b is the most-derived binding....

Note that you would probably want to use 'call' (or 'apply') to avoid
'this' being the prototype instead of the actual instance:

this.__proto__.__proto__.method.call(this, ...);

or

this.__proto__.__proto__.method.apply(this, arguments);

Andrew

0 new messages