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

zz <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Message-ID <[email protected]>
On 2009-12-23 11:52, Boris Zbarsky wrote:
> 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
> 
thank you very much, Boris!

now I want to dump these JS property of a (nsIDOMElement *aElement).
please tell me which api-file should I check to do this.

that is when there is a (nsIDOMElement *aElement), how to use
JS_GetProperty to get the JS property, please tell me some class names,
cpp filenames to look into.

thanks.
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.