W3C home > Mailing lists > Public > public-html@w3.org > January 2010

Re: <iframe doc="">

From: Maciej Stachowiak <mjs@apple.com>
Date: Sun, 24 Jan 2010 18:18:39 -0800
Cc: Boris Zbarsky <bzbarsky@MIT.EDU>, public-html@w3.org
Message-id: <41936602-B07C-4F06-BA99-74E5C84263E4@apple.com>
To: Joe D Williams <joedwil@earthlink.net>

On Jan 24, 2010, at 12:37 PM, Joe D Williams wrote:

>>>> If you put text/html into an <object> element (which is what we're
>>>> suggesting with @doc), then it acts just like a frame.
>>> An iframe is not a frame. and iframe is not an object.
>> What Adam and Maciej and I are telling you is that in at least Gecko and Webkit they _are_ in fact the same thing, for purposes of HTML rendering.  As in, the same exact code is used to implement HTML
> rendering in all three.
> OK, as for difference between <iframe> and <object>
> (maybe somehow except if standard has grand exception if object @data is html)
> what do these look like in whatever DOM inspector?

The most important functional difference between <object> and <iframe> is this: <iframe> always causes a DOM document to be made, and if it's given an image or plugin content or the like, it will wrap it in a generated HTML document. But <object> looks at the type of content it's presented with and does one of three things:
   - For an image type, it renders essentially like <img>
   - For a built-in type that builds a document (such as HTML, XHTML, SVG or generic XML) it renders essentially like <iframe>.
   - For a type that's handled by a plugin, it will instantiate it directly, much like <embed>, rather than wrapping it its own document.

> All efforts in <iframe> are to somehow how make it look like and act sort of like an object by limiting access using some iframe attributes. At least in Ff and in IE and everywhere else I hope the <iframe> and its content is actually in the same DOM as the parent document. We call it a nested context and build wals around it with sandbox attributes.

It's not really in the same DOM. Web content debugging tools give you that illusion, but it's actually a whole separate Document tree and the only real linkage is via innerDocument. That being said, if you look at this example in the Safari Web Inspector you will see the two cases are treated basically the same:

<iframe src="data:text/html,<div>This is a subdocument</div>"</iframe>
<object data="data:text/html,<div>This is a subdocument</div>"</object>

Received on Monday, 25 January 2010 02:19:13 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:08 UTC