views:

16

answers:

1

Hi All,

I am writing Firefox extension using C++. I am trying to access XUL:tabox element in "TabOpen" event handler, but I am unable access any XUL element.

I am putting here pseudocode of my extension for reference:

HandleEvent()
{
     if (event type is TabOpen)
     {
    nsCOMPtr<nsIDOMNode> OriginalNode = do_QueryInterface(event->GetTarget);
    nsCOMPtr<nsIDOMNodeList> childlist;

       //
       // Note here that I got OriginalNode's local name as "tabbrowser"
       //

    OriginalNode->GetChildNodes(getter_AddRefs(childlist));
    PRUint32 len;
    childlist->GetLength(&len);  // Return 1; consider only "popup" child element.

    nsString localName;
    nsCOMPtr<nsIDOMNode> node1;
    childlist->Item(0, getter_AddRefs(node1));
    node1->GetLocalName(localName);   // Returns "popup" as the local name.
     }
}

By traversing the DOM tree through DOM Inspector, I came to know that XUL elements are anonymous content.

How do I access these XUL elements?

Very Thanks in advance,

Vaibhav.

A: 

Hi,

I got solution of using nsIDOMDocumentXBL interface.

Every DOM Document implements nsIDOMDocumentXBL interface.

If there is any issue, its might be of IID change.

Vaibhav.

Vaibhav Gade