W3C home > Mailing lists > Public > public-webapi@w3.org > February 2006

Re: Targeted Cross-Document Scripting

From: Maciej Stachowiak <mjs@apple.com>
Date: Sun, 12 Feb 2006 03:25:24 -0800
Message-Id: <3CBBBADC-D307-487E-B266-262E113F89CE@apple.com>
Cc: public-webapi@w3.org, public-cdf@w3.org
To: Doug Schepers <doug@schepers.cc>

On Feb 11, 2006, at 11:27 PM, Doug Schepers wrote:

>
> For the record, my working example is here:
>   http://svg-whiz.com/svg/instances/
>
> To get this to work, I had to fork my code, and to pass each  
> instance a
> unique identifier from the parent HTML, that was passed back as a  
> parameter.
> I think that's remarkably inelegant, and it did not consistently  
> work for me
> outside the limited confines of this test code.

The following much simpler code works in Safari (with a WebKit  
nightly, that's the only versions with SVG support so far) Opera 9  
and Firefox 1.5:





I don't have Win IE + ASV to test with but I suspect it would work  
there too.

This relies on three things that are not currently standardized:

1) contentWindow property of the <object> and <iframe> elements in HTML
2) frameElement property of the global object
3) parent property of the global object

But I think all three are interoperably implemented in major UAs.

The CDR proposed document.referencingElement would replace the need  
for 2.

referencingElement + contentDocument could replace the need for 1 if  
you attached the functions to the document instead of the global object.

Regards,
Maciej



Received on Sunday, 12 February 2006 11:26:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:53 GMT