Closed Bug 244200 Opened 22 years ago Closed 22 years ago

Unable to access attributes/methods on xpconnect wrapped interface

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: darin.moz, Unassigned)

Details

Unable to access attributes/methods on xpconnect wrapped interface. Here's the scenario: I have a XUL listbox with a bunch of listitem children. Each listitem's value property holds a nsIFoo instance. Later when I try to fetch the nsIFoo instance, I am unable to access any attributes or methods on the instance. This is only a problem if I use setAttribute("value", ...) and getAttribute("value") to set and get the value property. If I simply use .value, then there is no problem. I dump'ed the thing I got back from getAttribute("value") to the console and it said something like this: [xpconnect wrapped nsIFoo @ 0x841bda8] On IRC, shaver said: "setAttribute probably flattens evilly"
Er... setAttribute by definition sets only strings. So if you pass something to it, it'll get toString() called on it and that string passed to the native code. That's the correct and expected behavior. If you're trying to set random properties (not to be confused with attributes!), then setting .foo is the way to go.
Right, right, so you get it converted to the string representation, so when you print it out you get what you expect. I was fooled. =/
marking INVALID. thanks boris!
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.