logo       

Re: IFrame: pyxpcom broken or not implemented yet?: msg#00004

mozilla.devel.xpcom.python

Subject: Re: IFrame: pyxpcom broken or not implemented yet?

This is a multi-part message in MIME format.
I think I can add something to this issue...I´ve been knocking my head against the wall for a couple of days trying to do exactly what Torsten was trying to do...access the iframe.contentDocument, but I failed miserably (I ended resorting to a hack, which is to make the document inside the frame report its document to a Python Singleton which is then accesible to the parent of the iframe).
I even implemented a short script that gets a list of all available interfaces and queries them from an object, and sees if they fail or not...I tried this on the iframe object (and on the browser object), but I did not get any useful interface besides the DOMNodes and DomElement interfaces that were already mentioned.

By the way, thanks for the development of the python extension, I´m actually trying to use it as it is to make a real world app...

Gabriel.

Mark Hammond escribió:
This is because the DOM objects don't all support exposing their class info in a generic (ie, non-JS) way.  The work I'm doing on the DOM_AGNOSTIC branches has some hacks to work around this (but it does so by looking at the 'tagName' - and iframe's aren't supported!)
 
So the meta-work-around is to work out what interface you want to use, and explicitly QueryInterface for that interface.  For example, a text box would require a QI for components.interfaces.nsIDOMXULTextBoxElement (I'm afraid I don't have the iframe interface name handy)
 
Cheers,
 
Mark.
-----Original Message-----
From: pyxpcom-bounces@xxxxxxxxxxxxxxxxxxxxxxxx [mailto:pyxpcom-bounces@xxxxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Torsten Vollrath
Sent: Friday, 2 June 2006 4:56 PM
To: pyxpcom@xxxxxxxxxxxxxxxxxxxxxxxx
Subject: [pyxpcom] IFrame: pyxpcom broken or not implemented yet?

Hi,

I tried to address the document in an Iframe with python. But the object returned by:
 
my_iframe = document.getElementById('my_iframe')
 
has no methods or attributes of the iframe class.(It has the inherited methods from Node)
 
 
Ok it has attributes but they can only be addressed via:
 
my_iframe_src = my_iframe.attributes.item(1).nodeValue # item(0) holds the id
 
I havn't found a workaround for methods, yet.
 
This don't work:
my_iframe.src #__getattr__ error
myiframe.contentDocument #__getattr__ error
document.frames[0] #r__getitem__ error; (frames.item)Attribute item doesn't exist
 
I tried the same commands in _javascript_ and they work like intended.
 
I might try to pass the reference from inside the iframe through python module object structure, but i would prefer to understand whats wrong with iframe.
So, did I do anything wrong, or is iframe realy "broken"/not implemented yet ?
 
 
The Xul Element "Label" has the same problems: Attributes can only be reached through the above backdoor.
(Other elements work like intended in python)

Bye,
Torsten

_______________________________________________ pyxpcom mailing list pyxpcom@xxxxxxxxxxxxxxxxxxxxxxxx To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise