[whatwg] srcdoc="" feedback

Tab Atkins Jr. jackalmage at gmail.com
Mon Nov 15 14:02:21 PST 2010


On Mon, Nov 15, 2010 at 1:46 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Tue, 31 Aug 2010, Tab Atkins Jr. wrote:
>> What use-case are you trying to address that you think the suggestion in
>> this thread (make @srcdoc imply @sandbox) is incompatible with?  At the
>> moment it appears that you're confused about the goal of the change I'm
>> suggesting, but I could just be missing something.
>
> Another use case for <iframe srcdoc=""> is the kind of thing where today
> you have to have a blank.html file to provide the initial contents of a
> frame that you'll be populating with other pages (e.g. help contents in a
> help viewer). With srcdoc="" you can now conveniently put the original
> document in the same file as the <iframe>:
>
>   <iframe seamless srcdoc="<p>Select a topic from the list."></iframe>
>
> It's very convenient because you can then use either a script setting
> src="" directly or regular <a href="" target=""> to update the iframe. The
> latter is useful if you want the back/forward button to work, the former
> is best if you want to handle that yourself or if you ever want to be able
> to go back to the default (just remove the 'src' attribute and it'll flip
> back to the default).

I'm not sure why making this case marginally more convenient is
important.  If you're going to be pointing the frame to real pages
anyway, why is it a burden to supply an initial page?

@srcdoc wasn't designed to support author-authored (hah!) pages; if
that's a use-case we were aiming for we would have let <iframe>
display its contents when there's no @src, or similar.  Markup in
attributes is a definite antipattern that we're violating in this
particular case only because it's the simplest thing for authors, and
thus the most likely to be done right.

~TJ



More information about the whatwg mailing list