Re: how to get dom-node's attribute set by javascript code.

Boris Zbarsky <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Message-ID <[email protected]>
On 12/22/09 9:34 PM, pengdawei wrote:
>      div1.zz1 = "zz1-attribute";

That's a pure JS property, not a DOM property.

> when then page finished loading, I can get the zz0 attribute through nsIDOMElement interface in c++.
> but I can't get the zz1 attribute.

Correct; that zz1 thing is not present in the DOM at all.  It's present 
only in JavaScript, as a property of the JavaScript reflection of that 
<div>'s DOM Node.

> but zz1 is in Firebug's DOM panel

Firebug's so-called "DOM" panel isn't.  It's a JS object viewer.

> can any one tell me how to get zz1 attribute in C++?

Using JSAPI (JS_GetProperty and the like).

-Boris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.