javascript - getElementById a XBL bound XUL element -


I'm trying to reach an XUL element that was XBL bound. I want to control it with javascript.

This is binding.

  & lt; Binding id = "impe-thriber" & gt; & Lt; Resources & gt; & Lt; Stylesheet src = "chrome: // lighting / scan / lighting-wits.css" /> & Lt; / Resources & gt; & Lt; Content pack = "center" align = "center" & gt; & Lt; Xul: image anonid = "loading-throbber" src = "chrome: //global/skin/icons/loading_16.png" hidden = "wrong" /> & Lt; / Content & gt; & Lt; / Binding & gt;   

This is CSS binding

  imip-throbber {-moz-binding: url (chrome: //lightning/content/lightning-widgets.xml # Imip-throbber); }   

This is a xul implementation

  Electricity-Information-time ID = "Impress-Bar" abbreviation = "True" Insert = "msgHeaderView" label = "& amp; Electricity. Examination Disassembly;" & Gt; & Lt; Button ID = "Impress-Button 1" class = "Impress-Button" Hidden = "True" /> & lt; Button ID = "Impe-Button 2" class = "Impress-Button" Hidden = "True" /> & lt; Button ID = "Tip-Button 3" class = "Impress-Button" Hidden = "True" /> & lt; imip-throbber id = "loading-lbl" & gt; & Lt; / Power Notification Bar & gt;   

This is JavaScript Access

  Empip Trombel = Document. GetElementById ("loading-LBL");   

The JavaScript line below is not being executed. Do I need to add something when forced to access the element?

Can not easily ...

In MDN, it says that "Anonymous" content has been automatically added to the XBL:

element within the content tag [XBL binding XML file Name is added to the scroll bar, though anonymous content is displayed on screen, you by default via a script Can not achieve. XUL, it seems that there was only one element, although it is actually made up of many elements.

(emphasis my).

In any case ...

In the MDN XBL 1.0 goes on to say context

in effect Untitled content is present in its own insulin Using pocket ParenNode within the document, anonymous content nodes can refer to their obvious parents, but obvious parents have no knowledge of their anonymous children. Benedictine material for the binding material is not accessible through the list of child nodes, nor is it able to use firstChild / nextSibling to iterate the children of the binding element. Anonymous content can only be accessed through special methods and as soon as possible.

So you can get the getAnonymousNodes / getAnonymousElementByAttribute on anonymous content, automatically inserted by XBL binding. These methods are used primarily by binding the JavaScript code (or related), however, you can use them from JavaScript bound to XUL DOM. Something in MDN

But why?

There will be a better question, why why would you like to log in with these elements? JavaScript bound for XUL DOM?

A good reason could be that you did not write bindings and you want to "upgrade" with some different content / behavior on the fly. If, on the other hand, you write the XBL binding in the done question, why are not you trying to force the XBL element within Jabab? You can add javascript to your elements, which have already reached unknown content (and the remaining XUL DOM).

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -