This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25376 - IFrame Seamless attribute should allow for disabling features
Summary: IFrame Seamless attribute should allow for disabling features
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on: 27835 27836
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-17 11:30 UTC by contributor
Modified: 2016-01-25 16:06 UTC (History)
5 users (show)

See Also:


Attachments
Draft on argumenting on iframe seamless attribute augmentation (326.87 KB, application/pdf)
2014-05-08 06:46 UTC, Axel Dahmen
Details
update on document, having the term Web Parts being replaced by Web Components (327.35 KB, patch)
2014-05-08 06:56 UTC, Axel Dahmen
Details
Draft on argumenting on iframe seamless attribute augmentation (327.35 KB, application/pdf)
2014-05-08 06:58 UTC, Axel Dahmen
Details
Sample demonstrating the advantage of IFrames (50.96 KB, application/x-zip-compressed)
2014-10-03 15:24 UTC, Axel Dahmen
Details
Sluggish sample demonstrating the advantage of IFrames (2.09 KB, application/zip)
2014-11-10 23:26 UTC, Axel Dahmen
Details

Description contributor 2014-04-17 11:30:28 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html
Multipage: http://www.whatwg.org/C#attr-iframe-seamless
Complete: http://www.whatwg.org/c#attr-iframe-seamless
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
IFrame Seamless attribute should allow for disabling features

Posted from: 47.73.230.69
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Comment 1 Axel Dahmen 2014-04-17 11:32:27 UTC
See: http://comments.gmane.org/gmane.comp.web.html.general/8922

--

After reading the HTML5 specification on the seamless attribute of the iframe element, I believe the seamless attribute to be too narrowly considered.

It seems, the seamless attribute basically enables three features:

* automatic iframe height calculation
* CSS integration
* DOM integration

I see a problem in integrating the later two. So I would like to suggest the seamless attribute to become a comma separated list of above three Seamless properties to be enabled. For backward compatibility to HTML5, if the attribute value equals "seamless", all three properties should be enabled.


Here's my reason for this suggestion:

I'm using iframe elements to render micro parts of a web page, e. g. a data grid, without requiring much JavaScript ado. In the following I call these iframe micro page elements "controls".

In our web application I'm inserting arbitrary iframe controls into several web pages.

If the page's CSS would have influence on the iframe control's rendering, then it would be necessary to test each and every iframe control on each and every page where the iframe control could possibly be inserted (probably database driven), because some CSS on any particular page might have bad influence on the iframe control's content.

So I would prefer to just add an additional <link> element (the application's CSS) to the iframe control's HTML content and still be sure that there won't be any other CSS influencing the iframe control's HTML presentation.


Same for DOM integration: jQuery selectors may find elements not intended to be found if both, the page's and the iframe controls' DOM trees would be merged.

The current definition results in a testing hell, from my perspective.


So I suggest that any of the above three seamless features may be optionally applicable.

Possible seamless attribute values may be (just suggesting some names here):

    autoheight   =   sets the iframe's height to the minimum height necessary to omit a scrollbar
    cssinclude   =   have the page content's CSS being prepended to the iframe content's CSS
    dominclude   =   have the iframe content's DOM integrate with the page content's DOM
    seamless     =   "autoheight,cssinclude,dominclude"

attribute seamless = [ autoheight || cssinclude || dominclude ] | seamless

Regards,
Axel Dahmen
www.axeldahmen.de
Comment 2 Ian 'Hixie' Hickson 2014-04-22 18:33:02 UTC
If the use case is making a custom control, wouldn't Web Components be a better solution than <iframe seamless>?
Comment 3 Axel Dahmen 2014-04-22 19:20:18 UTC
Nice.

But Web Components are too much ado compared to IFrames. - I'm afraid there's no concept available beating a simple <iframe src="">.

An IFrame element renders asynchronously, it provides full code and visual encapsulation and can be maintained independently. Using Web Components would require plenty of JavaScript code and additional markup to acquire the same result.

And just like with the current IFrame Seamless attribute: Web Components do not keep the template's code/visuals separate from the container's code.

Web Components don't seem a feasible alternative to using IFrames with (just) automatic height calculation to me.
Comment 4 Ian 'Hixie' Hickson 2014-04-22 20:43:58 UTC
If Web components are too complicated compared to the (pretty complicated and subtle) <iframe seamless>, then we need to simplify Web components. Can you elaborate on what part of Web components is the issue here?
Comment 5 Axel Dahmen 2014-05-08 06:46:26 UTC
Created attachment 1473 [details]
Draft on argumenting on iframe seamless attribute augmentation

I now have created a small draft document, trying to elaborate on the benefits of using <iframe> elements compared to any other currently available alternative option, including Web Parts.
Comment 6 Axel Dahmen 2014-05-08 06:53:09 UTC
... was meant to read "Web Components".
Comment 7 Axel Dahmen 2014-05-08 06:56:45 UTC
Created attachment 1474 [details]
update on document, having the term Web Parts being replaced by Web Components
Comment 8 Axel Dahmen 2014-05-08 06:58:43 UTC
Created attachment 1475 [details]
Draft on argumenting on iframe seamless attribute augmentation
Comment 9 Ian 'Hixie' Hickson 2014-05-08 17:56:59 UTC
Can I ask you to send that (ideally in text form rather than PDF form) in an e-mail to public-webapps@w3.org, primarily focused on explaining why Web Components is too complicated as is compared to using <iframe>s? We should make sure we address those rough edges so that Web Components are easier for you than <iframe>s, otherwise we've failed with Web Components.
Comment 10 Axel Dahmen 2014-05-14 09:44:05 UTC
OK, here are the drawbacks of Web Components (compared to IFrames, but also in general) in details:

------------------------

Web Components require a plethora of additional browser features and behaviours.

Web Components require loads of additional HTML, CSS and client script code for displaying content.

Web Components install complex concepts (e.g. <decorators>) by introducing unique, complex, opaque behaviours, abandoning the pure nature of presentation.

Web Components require special script event handling, so existing script code cannot be reused.

Web Components require special CSS handling, so existing CSS cannot be reused.

Web Components unnecessarily introduce a new clumsy “custom”, or “undefined” element, leaving the path of presentation. Custom Elements could as easy be achieved using CSS classes, and querySelector() in ECMA Script.

The W3C DOM MutationObserver specification already provides functionality equivalent to insertedCallback()/readyCallback()/removeCallback().

------------------------

Did you have a deeper look at my sample in PDF format? I've been trying to be very focussed, being brief and thorough at the same time.

Do you believe, after comparing IFrames to Web Components, you can achieve the same output (given my IFrame sample use case) using Web Components instead, *without* a single additional key stroke?


Please try to evaluate (from the given sample):

* How many more keystrokes would it require to achieve the same result using Web Components compared to the IFrame solution?

* How much more time would it require to implement the same result using Web Components compared to the IFrame solution?

* How much more time would it require to test any additional Web Component, having it been applied to, say, 10 different pages compared to the IFrame solution?
Comment 11 Ian 'Hixie' Hickson 2014-05-14 23:40:15 UTC
I'm not particularly familiar with Web Components, so I don't know. But the people in public-webapps@ are.
Comment 12 Axel Dahmen 2014-05-16 11:08:24 UTC
Actually, I' not aiming at condemning Web Components here.

What I'd like to achieve here is to elaborate on the IFrame seamless attribute.
Comment 13 Ian 'Hixie' Hickson 2014-05-16 17:14:28 UTC
Right, but what I'm saying is that for your use case, we should make sure Web Components are easier to use than <iframe>s, so that you don't need a change to iframes to do it.
Comment 14 Axel Dahmen 2014-05-19 21:03:15 UTC
OK, thank you.

I will consider forwarding this thread to the WebApps group so they can see if they want to amend the Web Components spec.

However, would you mind considering amending the seamless attribute for the existing <iframe> element? This would solve many issues without much ado.
Comment 15 Ian 'Hixie' Hickson 2014-05-19 23:05:30 UTC
Yes, this bug still being open means it's being considered.
Comment 16 Ian 'Hixie' Hickson 2014-08-04 23:05:39 UTC
Did you ever forward that thread?

Without a comparison of the way you'd like to do it (described here) to the way that one would do it with Web Components, it's hard to evaluate whether this would in fact make it simpler or not.
Comment 18 Axel Dahmen 2014-08-07 16:03:52 UTC
It seems they've put me on a black list for this thread. At least I wasn't able to reply to the last response in the thread.

At present I assume they didn't want to further discuss on the disadvantages of using/implementing Web Components compared to iframes.
Comment 19 Michael[tm] Smith 2014-08-13 00:28:24 UTC
(In reply to Axel Dahmen from comment #18)
> It seems they've put me on a black list for this thread. At least I wasn't
> able to reply to the last response in the thread.
> 
> At present I assume they didn't want to further discuss on the disadvantages
> of using/implementing Web Components compared to frames.

Who are you talking about?

Nobody's blacklisted you. If you sent a message to the the public-webapps list and it didn't appear, it's likely just because you're actually not a subscriber to that list, so you message might be in a moderation queue waiting for list moderator's approval.

Anyway, I've gone ahead and added your address to the whitelist of addresses that are allowed to post to the list without moderation. So if you re-send a message on that thread now, it should get sent out to the list as expected.
Comment 20 Axel Dahmen 2014-08-13 09:35:09 UTC
Great, thanks Ian.

I'm using a newsgroup reader via GMane. So I'm usually not involved in subscribing to mailing lists.
Comment 21 Ian 'Hixie' Hickson 2014-08-13 18:25:21 UTC
As far as I can tell, you never actually sent any concrete information to that thread.


To make progress on this bug, I think we need a concrete comparison of the way you'd like to do it to the way that one would do it with Web Components. That is, actual source code examples of the two possible ways to do it. I can't evaluate the wisdom of this bug request without being able to compare real code samples, and I don't understand what you want to do well enough to write the code samples myself.
Comment 22 Axel Dahmen 2014-08-26 16:42:20 UTC
I understand your point.

But frankly, I'm at the end of my wisdom now. I've done everything you've requested so far. Nothing seems sufficient enough for you to just amend the attribute with a tiny enhancement which wouldn't even require new application code as the enhancement just puts existing functionality into a condition.

The Web Components specification is still an early draft. All we can discuss on for now is on a theoretical basis. How am I supposed to create sample code??

I believe, after I have now invested quite a lot effort into this bug, time has come for you to act.


Let's reiterate what is for sure as of today:

The main - and crucial - difference between iframes and Web Components is that the design of iframes naturally encapsulate code while Web Components naturally intermix page and Web Component ECMAScript and style code. Intermixing style/script, however, results in a testing hell and instability.


Frankly, I don't know what to discuss with the Web Components team. The above statement is a fact that can not be discussed or interpreted. Even the slightest bit of Web Component code affects a container page.

Using Web Components, a CSS style like "div {width: 100%}" will affect both page and Web Component content.

Using Web Components, a script like "$('div').empty();" will affect both page and Web Component content, too.

Anything that can be done to prevent such intermingling of page and web component content is already an effort that unneccessary when using iframes, because iframes naturally separate a container's content from an iframe content's content.

Using iframes encapsulates code and helps reusig code. An iframe's content will display all the same and behave all the same everywhere. No testing required.

This will never be true for Web Components.

What more is there to know?
Comment 23 Ian 'Hixie' Hickson 2014-09-17 22:38:10 UTC
I believe your statements regarding Web Components are inaccurate. Encapsulation is a key feature of Web Components. If the encapsulation Web Components provide isn't sufficient, then we must fix Web Components, or it just won't solve the problem it set out to solve.

I would like to try to construct a widget using an iframe and using Web Components, to see what the reality is here. Do you have an example of something less involved than a datagrid that I could start with to test this?
Comment 24 Axel Dahmen 2014-10-03 13:12:47 UTC
My main statement is not encapsulation, but effort.

As far as I can tell, Web Components result is more developing and testing effort than iframes do.

Your request for providing an example might overstrain my time schedule. I don't like to write this, but as an external lead software architect for a couple of major brands I'm rather busy and my amount of free time is quite sparse.

Yet, I'll see what I can do.
Comment 25 Axel Dahmen 2014-10-03 15:24:08 UTC
Created attachment 1520 [details]
Sample demonstrating the advantage of IFrames

OK, here's a sample, demonstrating the advantages of iframes.

The sample project contains two HTML files: The main HTML file, Container.html, and the iframe HTML file, ItemEditor.html.

Both HTML files provide their own, separate application logic.
- For obvious reasons I've omitted server side application code here. Instead, I've been using KnockOutJS to implement a basic client side application logic.

Both HTML files provide their own, separate presentation style implementation, too.
- Both inherit the project's basic stylesheet (Project.css). Yet, both add their personal, page dependant, styles. (In fact, Container.html actually doesn't add private styles to the project in this sample.)


--------------

So, here's the advantage of iframes:

Imagine, implementer #1 implements the container, having access to only the following files: "Container.html", "Project.css", "Container.css", "Container.js".

Further imagine, implementer #2 implements the item editor, having access to only the following files: "ItemEditor.html", "Project.css", "ItemEditor.css", "ItemEditor.js".

Both implementers don't know about the other's implementation. They only implement their part of the project. And they only test their share of the project.



Now, I'd like you to compare the following three items:


(1)

Create a sample replacing the iframe implementation with a Web Component implementation.

Compare the number of bytes for all the files of the Web Component version with the number of bytes of all the files of the IFrames version.

The number of bytes of my IFrames version is: 143,337 (using a decent file formatting with white space, no minimization has taken place).


(2)

Rename JavaScript object names in "Container.js" to be equal to the object names in "ItemEditor.js" in both, the Web Components version and the IFrames version.

Compare the effort that's necessary to keep both versions, the Web Components version and the IFrames version, executable.


(3)

Create a second ItemEditor (ItemEditor2.html, ItemEditor2.css, ItemEditor2.js) and add a reference to Container.html so the user will be able to add both, ItemEditor and ItemEditor2, items to the page.
(No intermixing required. Just add another <ul> and a second [add] button.)

For simplicity, don't change anything in the implementation of ItemEditor2.

Compare the effort that's necessary to keep both projects, the Web Components version and the IFrames version, executable.
Comment 26 Axel Dahmen 2014-10-03 15:28:37 UTC
BTW: I've intentionally set the iframe height to only 14.5em. Using Firefox you can see how necessary it is to amend the IFrame element according to my suggestion.

And I -again- like to stress the fact that my suggestion is fully backwards compatible to the current HTML5 specification.
Comment 27 Axel Dahmen 2014-10-03 15:33:52 UTC
I just noticed that I added jQuery and KnockOutJS to my byte count.

Unfortunately, it is not possible to amend comments. So here's my byte count without counting the length of the supporting libraries I've been using:

4,963 Bytes.
Comment 28 Ian 'Hixie' Hickson 2014-11-07 19:50:13 UTC
Ok so I made a version using Web Components:

   http://damowmow.com/playground/demos/components/001/

I didn't use any supporting libraries (didn't need them), and the byte count is 4833. I'm not sure how much that really tells us though. I could certainly have tried to make it smaller if that was necessary.

I don't understand your (2). Why would it cause any trouble?

Again with (3) it seems trivial to do this with Web components.

However, consider:

(4) count the number of network requests made when pressing the "add" button in the iframe version vs the component version.

I don't see why Web Components are "too much ado" here. They seem like a much cleaner fit to the problem than iframes.
Comment 29 Axel Dahmen 2014-11-10 23:26:11 UTC
Created attachment 1541 [details]
Sluggish sample demonstrating the advantage of IFrames
Comment 30 Axel Dahmen 2014-11-10 23:56:50 UTC
(In reply to Ian 'Hixie' Hickson from comment #28)
> Ok so I made a version using Web Components:
> 
>    http://damowmow.com/playground/demos/components/001/
> 
> I didn't use any supporting libraries (didn't need them), and the byte count
> is 4833. I'm not sure how much that really tells us though. I could
> certainly have tried to make it smaller if that was necessary.

Sure, but that's not the point. I could have ommitted the libraries, too (see amended example), but I wanted to give a living example working on every current browser.

The sample you've provided doesn't seem to appreciate requirements and coding standards for working in teams. Neither did you or Web Components in the sample you gave consider encapsulation. Black box programming won't work with Web Components - whereas it works using IFrames.

Here's what your sample is lacking (and what the IFrame sample isn't but by nature of the IFrame design):


(1)

Where's the stylesheet for item-editor.html? If you added it, what would a rule like "form {background-color: white;}" contained in it lead to?

(2)

Your item-editor.html code contains the following code:
    "document.registerElement('item-editor', ...);"

What if your team member created a new, second, item editor, say item-editor2.html, and what if he used the same line:
    "document.registerElement('item-editor', ...);"
... without telling you?

And what if another team member of yours, responsible for the container.html page, added that second editor to the container page by copy/pasting the container page control creation code, just amending the LINK element?

(3) Your item-editor.html code contains a global "owner" function. What if your colleague added a global function of the same name to her item-editor2.html file, but with different content?


Even now your simple sample code already contains three (if not more) breaches of encapsulation. Three situations that have to be considered and tested for. And we are but talking here about three authors fulfilling their tasks without knowing each other's code.


For IFrames ...

(1) won't be a problem, because IFrame opens its own, fully separate, render context. Nothing to test or consider here.

(2) won't be a problem, because IFrame opens its own, fully separate, render context. Nothing to test or consider here.

(3) won't be a problem, because IFrame opens its own, fully separate, render context. Nothing to test or consider here.


Web Components offer a wide gate for programming failure and and random error. IFrames don't.

So still, IFrames are the best solution for team development of larger websites featuring reusable components.
Comment 31 Ian 'Hixie' Hickson 2014-11-12 19:11:04 UTC
Excellent, these are the kinds of things I was asking for in comment 4. Thanks. Now we can work on making Web Components address your issues so that it'll work.
Comment 32 Axel Dahmen 2014-11-13 07:29:28 UTC
That sounds great to me! Looking forward to it!

However, in the meantime, would it be daring to ask to amend the IFrame Seamless attribute the way I described?

It'd mean quite less effort to application programmers to implement and, thus, be quicker and more reliable to use in the midterm because of the truly minor change.
Comment 33 Ian 'Hixie' Hickson 2015-01-15 00:36:30 UTC
> Where's the stylesheet for item-editor.html?

In item-editor.html at the top. Right now it just imports default.css since there's nothing special about the editor, but you could have a separate file if you wanted.


> If you added it, what would a rule like "form {background-color: white;}"
> contained in it lead to?

It would be scoped to the component, so it would make the form inside the item editor white, while not affecting the outer form.


> Your item-editor.html code contains the following code:
>     "document.registerElement('item-editor', ...);"
> 
> What if your team member created a new, second, item editor, say
> item-editor2.html, and what if he used the same line:
>     "document.registerElement('item-editor', ...);"
> ... without telling you?

Much like two teams that both create an ItemEditor.html file are going to conflict, two teams that both register the same element name are going to conflict. This is trivial to work around: have a wiki page for your project with first-come-first-served name registration.

But maybe the better solution is per-module element registration. Filed bug 27835 to make components have this feature.


> And what if another team member of yours, responsible for the container.html
> page, added that second editor to the container page by copy/pasting the
> container page control creation code, just amending the LINK element?

Yes, when writing code you need to make sure you don't use globals that have the same name. I mean, if you import two JS libraries that both export a global "start()" function, you're going to have the same problem. This is not unexpected. The same happens with the <iframe> model e.g. if the iframe adds an API to the parent frame, or if different components made with iframes both use external style sheets with the same names, or whatever.


> Your item-editor.html code contains a global "owner" function. What if
> your colleague added a global function of the same name to her
> item-editor2.html file, but with different content?

Yeah, that's unfortunate. We should fix that. Filed bug 27836.


> Web Components offer a wide gate for programming failure and and random
> error. IFrames don't.
> 
> So still, IFrames are the best solution for team development of larger
> websites featuring reusable components.

Right. Let's fix Web Components so that this isn't true. If Web Components aren't the best solution for what you're proposing, then they've failed. What you're proposing is the entire point of Web Components.
Comment 34 Axel Dahmen 2015-07-06 19:24:59 UTC
Yes, but with much unnecessary overhead for reaching the same result IFrames already provide.
Comment 35 Anne 2016-01-22 13:40:30 UTC
<iframe seamless> has been removed from the implementation. Unfortunately nobody wanted to support it.

https://github.com/whatwg/html/commit/1490eba4dba5ab476f0981443a86c01acae01311