Adding Methods to XBL-defined Elements

Using parentNode in anonymous content will only work if that content is one level below its binding parent. getBindingParent will work in all situations. I'd fix this myself, but I don't know how to change the sample code.--Np 21:51, 2 February 2008 (PST)


Example is not working

The example:<font class="Apple-style-span" face="'Courier New', 'Andale Mono', monospace" size="3">

<box id="num" class="labeledbutton" title="Number of Things:" value="52"/>

<button label="Show" oncommand="document.getElementById('num').showTitle(true)"/>
<button label="Hide" oncommand="document.getElementById('num').showTitle(false)"/>


<binding id="labeledbutton">
    <xul:label xbl:inherits="value=title"/>
    <xul:label xbl:inherits="value"/>
    <method name="showTitle">
      <parameter name="state"/>
        if (state) document.getAnonymousNodes(this)[0].
          setAttribute("style","visibility: visible");
        else document.getAnonymousNodes(this)[0].
          setAttribute("style","visibility: collapse");

is not working.

I've posted a question about it in

Document Tags and Contributors

 Last updated by: wellington7,