Permalink
Browse files

[acgiow] (0) <iframe srcdoc=''> first cut.

git-svn-id: http://svn.whatwg.org/webapps@4619 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent c1f9f85 commit f41d12b7cbb33466c8eaa98f27994babdd2ef21b @Hixie Hixie committed Jan 22, 2010
Showing with 461 additions and 149 deletions.
  1. +145 −49 complete.html
  2. +145 −49 index
  3. +171 −51 source
View
194 complete.html
@@ -110,7 +110,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<hgroup><h1>Web Applications 1.0</h1>
- <h2 class="no-num no-toc">Draft Standard &mdash; 20 January 2010</h2>
+ <h2 class="no-num no-toc">Draft Standard &mdash; 22 January 2010</h2>
</hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -4820,7 +4820,14 @@ <h4 id=terminology-0><span class=secno>2.5.1 </span>Terminology</h4>
</ol><p>This specification defines the URL
<dfn id=about:legacy-compat><code>about:legacy-compat</code></dfn> as a reserved, though
- unresolvable, <code title="">about:</code> URI. <a href=#refsABOUT>[ABOUT]</a></p>
+ unresolvable, <code title="">about:</code> URI, for use in <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>s in <a href=#html-documents>HTML
+ documents</a> when needed for compatibility with XML tools. <a href=#refsABOUT>[ABOUT]</a></p>
+
+ <p>This specification defines the URL
+ <dfn id=about:srcdoc><code>about:srcdoc</code></dfn> as a reserved, though
+ unresolvable, <code title="">about:</code> URI, that is used as
+ <a href="#the-document's-address">the document's address</a> of <a href=#an-iframe-srcdoc-document title="an iframe srcdoc
+ document"><code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> documents</a>. <a href=#refsABOUT>[ABOUT]</a></p>
</div>
@@ -10516,7 +10523,8 @@ <h4 id=the-head-element-0><span class=secno>4.2.1 </span>The <dfn><code>head</co
<dt>Contexts in which this element may be used:</dt>
<dd>As the first element in an <code><a href=#the-html-element-0>html</a></code> element.</dd>
<dt>Content model:</dt>
- <dd>One or more elements of <a href=#metadata-content>metadata content</a>, of which exactly one is a <code><a href=#the-title-element-0>title</a></code> element.</dd>
+ <dd>If the document is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>: Zero or more elements of <a href=#metadata-content>metadata content</a>.</dd>
+ <dd>Otherwise: One or more elements of <a href=#metadata-content>metadata content</a>, of which exactly one is a <code><a href=#the-title-element-0>title</a></code> element.</dd>
<dt>Content attributes:</dt>
<dd><a href=#global-attributes>Global attributes</a></dd>
<dt>DOM interface:</dt>
@@ -11824,7 +11832,8 @@ <h5 id=charset><span class=secno>4.2.5.5 </span>Specifying the document's charac
</ul><p>If an <a href=#html-documents title="HTML documents">HTML document</a> does not
start with a BOM, and if its encoding is not explicitly given by
- <a href=#content-type title=Content-Type>Content-Type metadata</a>, then the
+ <a href=#content-type title=Content-Type>Content-Type metadata</a>, and the
+ document is not <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, then the
character encoding used must be an <a href=#ascii-compatible-character-encoding>ASCII-compatible character
encoding</a>, and, in addition, if that encoding isn't US-ASCII
itself, then the encoding must be specified using a
@@ -11833,6 +11842,12 @@ <h5 id=charset><span class=secno>4.2.5.5 </span>Specifying the document's charac
<a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration
state</a>.</p>
+ <p>If the document is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, the
+ document must not have a <a href=#character-encoding-declaration>character encoding
+ declaration</a>. (In this case, the source is already decoded,
+ since it is part of the document that contained the
+ <code><a href=#the-iframe-element>iframe</a></code>.)</p>
+
<p>If an <a href=#html-documents title="HTML documents">HTML document</a> contains
a <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
<code><a href=#meta>meta</a></code> element with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
@@ -19541,6 +19556,7 @@ <h4 id=the-iframe-element><span class=secno>4.8.3 </span>The <dfn><code>iframe</
<dt>Content attributes:</dt>
<dd><a href=#global-attributes>Global attributes</a></dd>
<dd><code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code></dd>
+ <dd><code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code></dd>
<dd><code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code></dd>
<dd><code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code></dd>
<dd><code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code></dd>
@@ -19550,6 +19566,7 @@ <h4 id=the-iframe-element><span class=secno>4.8.3 </span>The <dfn><code>iframe</
<dd>
<pre class=idl>interface <dfn id=htmliframeelement>HTMLIFrameElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute DOMString <a href=#dom-iframe-src title=dom-iframe-src>src</a>;
+ attribute DOMString <a href=#dom-iframe-srcdoc title=dom-iframe-srcdoc>srcdoc</a>;
attribute DOMString <a href=#dom-iframe-name title=dom-iframe-name>name</a>;
[PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-iframe-sandbox title=dom-iframe-sandbox>sandbox</a>;
attribute boolean <a href=#dom-iframe-seamless title=dom-iframe-seamless>seamless</a>;
@@ -19559,63 +19576,129 @@ <h4 id=the-iframe-element><span class=secno>4.8.3 </span>The <dfn><code>iframe</
readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-iframe-contentwindow title=dom-iframe-contentWindow>contentWindow</a>;
};</pre>
</dd>
- </dl><!-- v2 doc="" idea (awaiting implementation experience with seamless="" first):
+ </dl><p>The <code><a href=#the-iframe-element>iframe</a></code> element <a href=#represents>represents</a> a
+ <a href=#nested-browsing-context>nested browsing context</a>.</p>
- http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-May/014874.html
+ <p>The <dfn id=attr-iframe-src title=attr-iframe-src><code>src</code></dfn> attribute
+ gives the address of a page that the <a href=#nested-browsing-context>nested browsing
+ context</a> is to contain. The attribute, if present, must be a
+ <a href=#valid-url>valid URL</a>.</p>
- doc="" would take a string which would then be interpreted as
- the source document markup of an HTML document, much like the
- above; it would override src="" if it was present, allowing
- src="" to be used for legacy UAs:
+ <p>The <dfn id=attr-iframe-srcdoc title=attr-iframe-srcdoc><code>srcdoc</code></dfn>
+ attribute gives the content of the page that the <a href=#nested-browsing-context>nested
+ browsing context</a> is to contain. The value of the attribute
+ in is <dfn id=an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</dfn>.</p>
- <iframe seamless sandbox="allow-scripts allow-forms" doc="
- Welcome to my blog!
- </sandbox>
- <a href='#' onclick='alert(document.cookie)'>Click here</a>
- "></iframe>
+ <p>For <code><a href=#the-iframe-element>iframe</a></code> elements in <a href=#html-documents>HTML documents</a>,
+ the attribute, if present, must have a value using <a href=#syntax>the HTML
+ syntax</a> that consists of the following syntactic components,
+ in the given order:</p>
- TODO:
- <!DOCTYPE HTML> implication
- <title></title> optional
+ <ol><li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
- --><p>The <code><a href=#the-iframe-element>iframe</a></code> element <a href=#represents>represents</a> a
- <a href=#nested-browsing-context>nested browsing context</a>.</p>
+ <li>Optionally, a <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>.
- <p>The <dfn id=attr-iframe-src title=attr-iframe-src><code>src</code></dfn> attribute
- gives the address of a page that the <a href=#nested-browsing-context>nested browsing
- context</a> is to contain. The attribute, if present, must be a
- <a href=#valid-url>valid URL</a>. <span class=impl>When the browsing context
- is created, if the attribute is present, the user agent must <a href=#resolve-a-url title="resolve a url">resolve</a> the value of that attribute,
- relative to the element, and if that is successful, must then
- <a href=#navigate>navigate</a> the element's browsing context to the
- resulting <a href=#absolute-url>absolute URL</a>, with <a href=#replacement-enabled>replacement
- enabled</a>, and with the <code><a href=#the-iframe-element>iframe</a></code> element's
- document's <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source
- browsing context</a>. If the user <a href=#navigate title=navigate>navigates</a> away from this page, the
- <code><a href=#the-iframe-element>iframe</a></code>'s corresponding <code><a href=#windowproxy>WindowProxy</a></code> object
- will proxy new <code><a href=#window>Window</a></code> objects for new
- <code>Document</code> objects, but the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute will not
- change.</span></p>
+ <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ <li>The root element, in the form of an <code><a href=#the-html-element-0>html</a></code> <a href=#syntax-elements title=syntax-elements>element</a>.</li>
+
+ <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ </ol><p>For <code><a href=#the-iframe-element>iframe</a></code> elements in <a href=#xml-documents>XML documents</a>,
+ the attribute, if present, must have a value that matches the
+ production labeled <code>document</code> in the XML
+ specification. <a href=#refsXML>[XML]</a></p>
+
+ <p>If the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute and the
+ <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute are both
+ specified together, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code>
+ attribute takes priority. This allows authors to provide a fallback
+ <a href=#url>URL</a> for legacy user agents that do not support the
+ <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute.</p>
<div class=impl>
- <p>Whenever the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute
- is set, the user agent must <a href=#resolve-a-url title="resolve a
- url">resolve</a> the value of that attribute, relative to the
- element, and if that is successful, the nested <a href=#browsing-context>browsing
- context</a> must be <a href=#navigate title=navigate>navigated</a> to
- the resulting <a href=#absolute-url>absolute URL</a>, with the
- <code><a href=#the-iframe-element>iframe</a></code> element's document's <a href=#browsing-context>browsing
- context</a> as the <a href=#source-browsing-context>source browsing context</a>.</p> <!--
- It doesn't happen when the base URL is changed, though. -->
+ <p>When an <code><a href=#the-iframe-element>iframe</a></code> element is first <a href=#insert-an-element-into-a-document title="insert
+ an element into a document">inserted into a document</a>, the
+ user agent must create a <a href=#nested-browsing-context>nested browsing context</a>, and
+ then <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a>.</p>
- <p>If the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute is not
- set when the element is created, or if its value cannot be <a href=#resolve-a-url title="resolve a url">resolved</a>, the browsing context will
- remain at the initial <code><a href=#about:blank>about:blank</a></code> page.</p>
+ <p>Whenever an <code><a href=#the-iframe-element>iframe</a></code> element with a <a href=#nested-browsing-context>nested
+ browsing context</a> has its <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute set or changed,
+ the user agent must <a href=#process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</a>.</p>
+
+ <p>Similarly, whenever an <code><a href=#the-iframe-element>iframe</a></code> element with a
+ <a href=#nested-browsing-context>nested browsing context</a> but with no <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute specified has its
+ <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute set or changed,
+ the user agent must <a href=#process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</a>.</p> <!-- It doesn't happen when the base URL is
+ changed, though. -->
+
+ <p>When the user agent is to <dfn id=process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</dfn>, it must run the first appropriate steps from the
+ following list:</p>
+
+ <dl class=switch><dt>If the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute
+ is specified</dt>
+
+ <dd><p><a href=#navigate>Navigate</a> the element's <a href=#browsing-context>browsing
+ context</a> to a resource whose <a href=#content-type>Content-Type</a> is
+ <code><a href=#text/html>text/html</a></code>, whose <a href=#url>URL</a> is
+ <code><a href=#about:srcdoc>about:srcdoc</a></code>, and whose data consists of the value of
+ the attribute.</dd>
+
+ <dt>Otherwise, if the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code>
+ attribute is specified but the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is not</dt>
+
+ <dd>
+
+ <ol><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of
+ the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute, relative
+ to the <code><a href=#the-iframe-element>iframe</a></code> element.</li>
+
+ <li><p>If that is successful, <a href=#navigate>navigate</a> the element's
+ <a href=#browsing-context>browsing context</a> to the resulting <a href=#absolute-url>absolute
+ URL</a>.</li>
+
+ </ol></dd>
+
+ </dl><p>Any <a href=#navigate title=navigate>navigation</a> required of the user
+ agent in the <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a>
+ algorithm must be completed with the <code><a href=#the-iframe-element>iframe</a></code> element's
+ document's <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source
+ browsing context</a>.</p>
+
+ <p>Furthermore, if the <a href=#process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</a> algorithm was invoked as a result of the element
+ being <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into
+ a document</a>, then any <a href=#navigate title=navigate>navigation</a>
+ required of the user agent in that algorithm must be completed with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ </div>
+
+ <p class=note>If, when the element is created, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is not set, and
+ the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute is either
+ also not set or set but its value cannot be <a href=#resolve-a-url title="resolve a
+ url">resolved</a>, the browsing context will remain at the
+ initial <code><a href=#about:blank>about:blank</a></code> page.</p>
+
+ <p class=note>If the user <a href=#navigate title=navigate>navigates</a>
+ away from this page, the <code><a href=#the-iframe-element>iframe</a></code>'s corresponding
+ <code><a href=#windowproxy>WindowProxy</a></code> object will proxy new <code><a href=#window>Window</a></code>
+ objects for new <code>Document</code> objects, but the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute will not change.</p>
+
+ <div class=example>
+
+ <p class=xxx>example for srcdoc here</p>
</div>
- <p>The <dfn id=attr-iframe-name title=attr-iframe-name><code>name</code></dfn>
+ <hr><p>The <dfn id=attr-iframe-name title=attr-iframe-name><code>name</code></dfn>
attribute, if present, must be a <a href=#valid-browsing-context-name>valid browsing context
name</a>. The given value is used to name the <a href=#nested-browsing-context>nested
browsing context</a>. <span class=impl>When the browsing
@@ -20075,7 +20158,7 @@ <h4 id=the-iframe-element><span class=secno>4.8.3 </span>The <dfn><code>iframe</
<div class=impl>
- <p>The IDL attributes <dfn id=dom-iframe-src title=dom-iframe-src><code>src</code></dfn>, <dfn id=dom-iframe-name title=dom-iframe-name><code>name</code></dfn>, <dfn id=dom-iframe-sandbox title=dom-iframe-sandbox><code>sandbox</code></dfn>, and <dfn id=dom-iframe-seamless title=dom-iframe-seamless><code>seamless</code></dfn> must
+ <p>The IDL attributes <dfn id=dom-iframe-src title=dom-iframe-src><code>src</code></dfn>, <dfn id=dom-iframe-srcdoc title=dom-iframe-srcdoc><code>srcdoc</code></dfn>, <dfn id=dom-iframe-body title=dom-iframe-body><code>body</code></dfn>, <dfn id=dom-iframe-name title=dom-iframe-name><code>name</code></dfn>, <dfn id=dom-iframe-sandbox title=dom-iframe-sandbox><code>sandbox</code></dfn>, and <dfn id=dom-iframe-seamless title=dom-iframe-seamless><code>seamless</code></dfn> must
<a href=#reflect>reflect</a> the respective content attributes of the same
name.</p>
@@ -50966,6 +51049,14 @@ <h3 id=origin-0><span class=secno>6.4 </span>Origin</h3>
assigned when its browsing context was created</a>.</dd>
+ <dt>If a <code>Document</code> is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a></dt>
+
+ <dd>The <a href=#origin>origin</a> of the <code>Document</code> is the
+ <a href=#origin>origin</a> of the <code>Document</code>'s <a href=#browsing-context>browsing
+ context</a>'s <a href=#browsing-context-container>browsing context container</a>'s
+ <code>Document</code>.</dd>
+
+
<dt>If a <code>Document</code> or image was obtained in some
other manner (e.g. a <code title="">data:</code> URL typed in by
the user, a <code>Document</code> created using the <code title=dom-DOMImplementation-createDocument>createDocument()</code>
@@ -84809,6 +84900,7 @@ <h3 class=no-num id=elements-1>Elements</h3>
<td>text*</td>
<td><a href=#global-attributes title="global attributes">globals</a>;
<code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code>;
+ <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code>;
<code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code>;
<code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>;
<code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code>;
@@ -85493,6 +85585,10 @@ <h3 class=no-num id=attributes-0>Attributes</h3>
<code title=attr-media-autoplay><a href=#attr-media-autoplay>video</a></code>
<td> Hint that the <a href=#media-resource>media resource</a> can be started automatically when the page is loaded
<td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">srcdoc</code>
+ <td> <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>iframe</a></code>
+ <td> A document to render in the <code><a href=#the-iframe-element>iframe</a></code>
+ <td> The source of <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>*
<tr><th> <code title="">challenge</code>
<td> <code title=attr-keygen-challenge><a href=#attr-keygen-challenge>keygen</a></code>
<td> String to package with the generated and signed public key
View
194 index
@@ -112,7 +112,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<hgroup><h1>HTML5 (including next generation additions still in development)</h1>
- <h2 class="no-num no-toc">Draft Standard &mdash; 20 January 2010</h2>
+ <h2 class="no-num no-toc">Draft Standard &mdash; 22 January 2010</h2>
</hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -4720,7 +4720,14 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
</ol><p>This specification defines the URL
<dfn id=about:legacy-compat><code>about:legacy-compat</code></dfn> as a reserved, though
- unresolvable, <code title="">about:</code> URI. <a href=#refsABOUT>[ABOUT]</a></p>
+ unresolvable, <code title="">about:</code> URI, for use in <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>s in <a href=#html-documents>HTML
+ documents</a> when needed for compatibility with XML tools. <a href=#refsABOUT>[ABOUT]</a></p>
+
+ <p>This specification defines the URL
+ <dfn id=about:srcdoc><code>about:srcdoc</code></dfn> as a reserved, though
+ unresolvable, <code title="">about:</code> URI, that is used as
+ <a href="#the-document's-address">the document's address</a> of <a href=#an-iframe-srcdoc-document title="an iframe srcdoc
+ document"><code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> documents</a>. <a href=#refsABOUT>[ABOUT]</a></p>
</div>
@@ -10416,7 +10423,8 @@ gave me some of the songs they wrote. I love sharing my music.&lt;/p&gt;
<dt>Contexts in which this element may be used:</dt>
<dd>As the first element in an <code><a href=#the-html-element-0>html</a></code> element.</dd>
<dt>Content model:</dt>
- <dd>One or more elements of <a href=#metadata-content>metadata content</a>, of which exactly one is a <code><a href=#the-title-element-0>title</a></code> element.</dd>
+ <dd>If the document is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>: Zero or more elements of <a href=#metadata-content>metadata content</a>.</dd>
+ <dd>Otherwise: One or more elements of <a href=#metadata-content>metadata content</a>, of which exactly one is a <code><a href=#the-title-element-0>title</a></code> element.</dd>
<dt>Content attributes:</dt>
<dd><a href=#global-attributes>Global attributes</a></dd>
<dt>DOM interface:</dt>
@@ -11724,7 +11732,8 @@ people expect to have work and what is necessary.
</ul><p>If an <a href=#html-documents title="HTML documents">HTML document</a> does not
start with a BOM, and if its encoding is not explicitly given by
- <a href=#content-type title=Content-Type>Content-Type metadata</a>, then the
+ <a href=#content-type title=Content-Type>Content-Type metadata</a>, and the
+ document is not <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, then the
character encoding used must be an <a href=#ascii-compatible-character-encoding>ASCII-compatible character
encoding</a>, and, in addition, if that encoding isn't US-ASCII
itself, then the encoding must be specified using a
@@ -11733,6 +11742,12 @@ people expect to have work and what is necessary.
<a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration
state</a>.</p>
+ <p>If the document is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>, the
+ document must not have a <a href=#character-encoding-declaration>character encoding
+ declaration</a>. (In this case, the source is already decoded,
+ since it is part of the document that contained the
+ <code><a href=#the-iframe-element>iframe</a></code>.)</p>
+
<p>If an <a href=#html-documents title="HTML documents">HTML document</a> contains
a <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
<code><a href=#meta>meta</a></code> element with an <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the
@@ -19441,6 +19456,7 @@ href="?audio"&gt;audio&lt;/a&gt; test instead.)&lt;/p&gt;</pre>
<dt>Content attributes:</dt>
<dd><a href=#global-attributes>Global attributes</a></dd>
<dd><code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code></dd>
+ <dd><code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code></dd>
<dd><code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code></dd>
<dd><code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code></dd>
<dd><code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code></dd>
@@ -19450,6 +19466,7 @@ href="?audio"&gt;audio&lt;/a&gt; test instead.)&lt;/p&gt;</pre>
<dd>
<pre class=idl>interface <dfn id=htmliframeelement>HTMLIFrameElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute DOMString <a href=#dom-iframe-src title=dom-iframe-src>src</a>;
+ attribute DOMString <a href=#dom-iframe-srcdoc title=dom-iframe-srcdoc>srcdoc</a>;
attribute DOMString <a href=#dom-iframe-name title=dom-iframe-name>name</a>;
[PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-iframe-sandbox title=dom-iframe-sandbox>sandbox</a>;
attribute boolean <a href=#dom-iframe-seamless title=dom-iframe-seamless>seamless</a>;
@@ -19459,63 +19476,129 @@ href="?audio"&gt;audio&lt;/a&gt; test instead.)&lt;/p&gt;</pre>
readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-iframe-contentwindow title=dom-iframe-contentWindow>contentWindow</a>;
};</pre>
</dd>
- </dl><!-- v2 doc="" idea (awaiting implementation experience with seamless="" first):
+ </dl><p>The <code><a href=#the-iframe-element>iframe</a></code> element <a href=#represents>represents</a> a
+ <a href=#nested-browsing-context>nested browsing context</a>.</p>
- http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-May/014874.html
+ <p>The <dfn id=attr-iframe-src title=attr-iframe-src><code>src</code></dfn> attribute
+ gives the address of a page that the <a href=#nested-browsing-context>nested browsing
+ context</a> is to contain. The attribute, if present, must be a
+ <a href=#valid-url>valid URL</a>.</p>
- doc="" would take a string which would then be interpreted as
- the source document markup of an HTML document, much like the
- above; it would override src="" if it was present, allowing
- src="" to be used for legacy UAs:
+ <p>The <dfn id=attr-iframe-srcdoc title=attr-iframe-srcdoc><code>srcdoc</code></dfn>
+ attribute gives the content of the page that the <a href=#nested-browsing-context>nested
+ browsing context</a> is to contain. The value of the attribute
+ in is <dfn id=an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</dfn>.</p>
- <iframe seamless sandbox="allow-scripts allow-forms" doc="
- Welcome to my blog!
- </sandbox>
- <a href='#' onclick='alert(document.cookie)'>Click here</a>
- "></iframe>
+ <p>For <code><a href=#the-iframe-element>iframe</a></code> elements in <a href=#html-documents>HTML documents</a>,
+ the attribute, if present, must have a value using <a href=#syntax>the HTML
+ syntax</a> that consists of the following syntactic components,
+ in the given order:</p>
- TODO:
- <!DOCTYPE HTML> implication
- <title></title> optional
+ <ol><li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
- --><p>The <code><a href=#the-iframe-element>iframe</a></code> element <a href=#represents>represents</a> a
- <a href=#nested-browsing-context>nested browsing context</a>.</p>
+ <li>Optionally, a <a href=#syntax-doctype title=syntax-doctype>DOCTYPE</a>.
- <p>The <dfn id=attr-iframe-src title=attr-iframe-src><code>src</code></dfn> attribute
- gives the address of a page that the <a href=#nested-browsing-context>nested browsing
- context</a> is to contain. The attribute, if present, must be a
- <a href=#valid-url>valid URL</a>. <span class=impl>When the browsing context
- is created, if the attribute is present, the user agent must <a href=#resolve-a-url title="resolve a url">resolve</a> the value of that attribute,
- relative to the element, and if that is successful, must then
- <a href=#navigate>navigate</a> the element's browsing context to the
- resulting <a href=#absolute-url>absolute URL</a>, with <a href=#replacement-enabled>replacement
- enabled</a>, and with the <code><a href=#the-iframe-element>iframe</a></code> element's
- document's <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source
- browsing context</a>. If the user <a href=#navigate title=navigate>navigates</a> away from this page, the
- <code><a href=#the-iframe-element>iframe</a></code>'s corresponding <code><a href=#windowproxy>WindowProxy</a></code> object
- will proxy new <code><a href=#window>Window</a></code> objects for new
- <code>Document</code> objects, but the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute will not
- change.</span></p>
+ <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ <li>The root element, in the form of an <code><a href=#the-html-element-0>html</a></code> <a href=#syntax-elements title=syntax-elements>element</a>.</li>
+
+ <li>Any number of <a href=#syntax-comments title=syntax-comments>comments</a> and
+ <a href=#space-character title="space character">space characters</a>.</li>
+
+ </ol><p>For <code><a href=#the-iframe-element>iframe</a></code> elements in <a href=#xml-documents>XML documents</a>,
+ the attribute, if present, must have a value that matches the
+ production labeled <code>document</code> in the XML
+ specification. <a href=#refsXML>[XML]</a></p>
+
+ <p>If the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute and the
+ <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute are both
+ specified together, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code>
+ attribute takes priority. This allows authors to provide a fallback
+ <a href=#url>URL</a> for legacy user agents that do not support the
+ <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute.</p>
<div class=impl>
- <p>Whenever the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute
- is set, the user agent must <a href=#resolve-a-url title="resolve a
- url">resolve</a> the value of that attribute, relative to the
- element, and if that is successful, the nested <a href=#browsing-context>browsing
- context</a> must be <a href=#navigate title=navigate>navigated</a> to
- the resulting <a href=#absolute-url>absolute URL</a>, with the
- <code><a href=#the-iframe-element>iframe</a></code> element's document's <a href=#browsing-context>browsing
- context</a> as the <a href=#source-browsing-context>source browsing context</a>.</p> <!--
- It doesn't happen when the base URL is changed, though. -->
+ <p>When an <code><a href=#the-iframe-element>iframe</a></code> element is first <a href=#insert-an-element-into-a-document title="insert
+ an element into a document">inserted into a document</a>, the
+ user agent must create a <a href=#nested-browsing-context>nested browsing context</a>, and
+ then <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a>.</p>
- <p>If the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute is not
- set when the element is created, or if its value cannot be <a href=#resolve-a-url title="resolve a url">resolved</a>, the browsing context will
- remain at the initial <code><a href=#about:blank>about:blank</a></code> page.</p>
+ <p>Whenever an <code><a href=#the-iframe-element>iframe</a></code> element with a <a href=#nested-browsing-context>nested
+ browsing context</a> has its <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute set or changed,
+ the user agent must <a href=#process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</a>.</p>
+
+ <p>Similarly, whenever an <code><a href=#the-iframe-element>iframe</a></code> element with a
+ <a href=#nested-browsing-context>nested browsing context</a> but with no <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute specified has its
+ <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute set or changed,
+ the user agent must <a href=#process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</a>.</p> <!-- It doesn't happen when the base URL is
+ changed, though. -->
+
+ <p>When the user agent is to <dfn id=process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</dfn>, it must run the first appropriate steps from the
+ following list:</p>
+
+ <dl class=switch><dt>If the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute
+ is specified</dt>
+
+ <dd><p><a href=#navigate>Navigate</a> the element's <a href=#browsing-context>browsing
+ context</a> to a resource whose <a href=#content-type>Content-Type</a> is
+ <code><a href=#text/html>text/html</a></code>, whose <a href=#url>URL</a> is
+ <code><a href=#about:srcdoc>about:srcdoc</a></code>, and whose data consists of the value of
+ the attribute.</dd>
+
+ <dt>Otherwise, if the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code>
+ attribute is specified but the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is not</dt>
+
+ <dd>
+
+ <ol><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the value of
+ the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute, relative
+ to the <code><a href=#the-iframe-element>iframe</a></code> element.</li>
+
+ <li><p>If that is successful, <a href=#navigate>navigate</a> the element's
+ <a href=#browsing-context>browsing context</a> to the resulting <a href=#absolute-url>absolute
+ URL</a>.</li>
+
+ </ol></dd>
+
+ </dl><p>Any <a href=#navigate title=navigate>navigation</a> required of the user
+ agent in the <a href=#process-the-iframe-attributes>process the <code>iframe</code> attributes</a>
+ algorithm must be completed with the <code><a href=#the-iframe-element>iframe</a></code> element's
+ document's <a href=#browsing-context>browsing context</a> as the <a href=#source-browsing-context>source
+ browsing context</a>.</p>
+
+ <p>Furthermore, if the <a href=#process-the-iframe-attributes>process the <code>iframe</code>
+ attributes</a> algorithm was invoked as a result of the element
+ being <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into
+ a document</a>, then any <a href=#navigate title=navigate>navigation</a>
+ required of the user agent in that algorithm must be completed with
+ <a href=#replacement-enabled>replacement enabled</a>.</p>
+
+ </div>
+
+ <p class=note>If, when the element is created, the <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is not set, and
+ the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute is either
+ also not set or set but its value cannot be <a href=#resolve-a-url title="resolve a
+ url">resolved</a>, the browsing context will remain at the
+ initial <code><a href=#about:blank>about:blank</a></code> page.</p>
+
+ <p class=note>If the user <a href=#navigate title=navigate>navigates</a>
+ away from this page, the <code><a href=#the-iframe-element>iframe</a></code>'s corresponding
+ <code><a href=#windowproxy>WindowProxy</a></code> object will proxy new <code><a href=#window>Window</a></code>
+ objects for new <code>Document</code> objects, but the <code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute will not change.</p>
+
+ <div class=example>
+
+ <p class=xxx>example for srcdoc here</p>
</div>
- <p>The <dfn id=attr-iframe-name title=attr-iframe-name><code>name</code></dfn>
+ <hr><p>The <dfn id=attr-iframe-name title=attr-iframe-name><code>name</code></dfn>
attribute, if present, must be a <a href=#valid-browsing-context-name>valid browsing context
name</a>. The given value is used to name the <a href=#nested-browsing-context>nested
browsing context</a>. <span class=impl>When the browsing
@@ -19975,7 +20058,7 @@ href="?audio"&gt;audio&lt;/a&gt; test instead.)&lt;/p&gt;</pre>
<div class=impl>
- <p>The IDL attributes <dfn id=dom-iframe-src title=dom-iframe-src><code>src</code></dfn>, <dfn id=dom-iframe-name title=dom-iframe-name><code>name</code></dfn>, <dfn id=dom-iframe-sandbox title=dom-iframe-sandbox><code>sandbox</code></dfn>, and <dfn id=dom-iframe-seamless title=dom-iframe-seamless><code>seamless</code></dfn> must
+ <p>The IDL attributes <dfn id=dom-iframe-src title=dom-iframe-src><code>src</code></dfn>, <dfn id=dom-iframe-srcdoc title=dom-iframe-srcdoc><code>srcdoc</code></dfn>, <dfn id=dom-iframe-body title=dom-iframe-body><code>body</code></dfn>, <dfn id=dom-iframe-name title=dom-iframe-name><code>name</code></dfn>, <dfn id=dom-iframe-sandbox title=dom-iframe-sandbox><code>sandbox</code></dfn>, and <dfn id=dom-iframe-seamless title=dom-iframe-seamless><code>seamless</code></dfn> must
<a href=#reflect>reflect</a> the respective content attributes of the same
name.</p>
@@ -50866,6 +50949,14 @@ interface <dfn id=window>Window</dfn> {
assigned when its browsing context was created</a>.</dd>
+ <dt>If a <code>Document</code> is <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a></dt>
+
+ <dd>The <a href=#origin>origin</a> of the <code>Document</code> is the
+ <a href=#origin>origin</a> of the <code>Document</code>'s <a href=#browsing-context>browsing
+ context</a>'s <a href=#browsing-context-container>browsing context container</a>'s
+ <code>Document</code>.</dd>
+
+
<dt>If a <code>Document</code> or image was obtained in some
other manner (e.g. a <code title="">data:</code> URL typed in by
the user, a <code>Document</code> created using the <code title=dom-DOMImplementation-createDocument>createDocument()</code>
@@ -79159,6 +79250,7 @@ interface <a href=#htmldocument>HTMLDocument</a> {
<td>text*</td>
<td><a href=#global-attributes title="global attributes">globals</a>;
<code title=attr-iframe-src><a href=#attr-iframe-src>src</a></code>;
+ <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code>;
<code title=attr-iframe-name><a href=#attr-iframe-name>name</a></code>;
<code title=attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>;
<code title=attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code>;
@@ -79843,6 +79935,10 @@ interface <a href=#htmldocument>HTMLDocument</a> {
<code title=attr-media-autoplay><a href=#attr-media-autoplay>video</a></code>
<td> Hint that the <a href=#media-resource>media resource</a> can be started automatically when the page is loaded
<td> <a href=#boolean-attribute>Boolean attribute</a>
+ <tr><th> <code title="">srcdoc</code>
+ <td> <code title=attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>iframe</a></code>
+ <td> A document to render in the <code><a href=#the-iframe-element>iframe</a></code>
+ <td> The source of <a href=#an-iframe-srcdoc-document>an <code>iframe</code> <code title=attr-iframe-srcdoc>srcdoc</code> document</a>*
<tr><th> <code title="">challenge</code>
<td> <code title=attr-keygen-challenge><a href=#attr-keygen-challenge>keygen</a></code>
<td> String to package with the generated and signed public key
View
222 source
@@ -4309,7 +4309,17 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<p>This specification defines the URL
<dfn><code>about:legacy-compat</code></dfn> as a reserved, though
- unresolvable, <code title="">about:</code> URI. <a
+ unresolvable, <code title="">about:</code> URI, for use in <span
+ title="syntax-doctype">DOCTYPE</span>s in <span>HTML
+ documents</span> when needed for compatibility with XML tools. <a
+ href="#refsABOUT">[ABOUT]</a></p>
+
+ <p>This specification defines the URL
+ <dfn><code>about:srcdoc</code></dfn> as a reserved, though
+ unresolvable, <code title="">about:</code> URI, that is used as
+ <span>the document's address</span> of <span title="an iframe srcdoc
+ document"><code>iframe</code> <code
+ title="attr-iframe-srcdoc">srcdoc</code> documents</span>. <a
href="#refsABOUT">[ABOUT]</a></p>
</div>
@@ -10859,7 +10869,8 @@ gave me some of the songs they wrote. I love sharing my music.&lt;/p>
<dt>Contexts in which this element may be used:</dt>
<dd>As the first element in an <code>html</code> element.</dd>
<dt>Content model:</dt>
- <dd>One or more elements of <span>metadata content</span>, of which exactly one is a <code>title</code> element.</dd>
+ <dd>If the document is <span>an <code>iframe</code> <code title="attr-iframe-srcdoc">srcdoc</code> document</span>: Zero or more elements of <span>metadata content</span>.</dd>
+ <dd>Otherwise: One or more elements of <span>metadata content</span>, of which exactly one is a <code>title</code> element.</dd>
<dt>Content attributes:</dt>
<dd><span>Global attributes</span></dd>
<dt>DOM interface:</dt>
@@ -12377,7 +12388,9 @@ people expect to have work and what is necessary.
<p>If an <span title="HTML documents">HTML document</span> does not
start with a BOM, and if its encoding is not explicitly given by
- <span title="Content-Type">Content-Type metadata</span>, then the
+ <span title="Content-Type">Content-Type metadata</span>, and the
+ document is not <span>an <code>iframe</code> <code
+ title="attr-iframe-srcdoc">srcdoc</code> document</span>, then the
character encoding used must be an <span>ASCII-compatible character
encoding</span>, and, in addition, if that encoding isn't US-ASCII
itself, then the encoding must be specified using a
@@ -12388,6 +12401,13 @@ people expect to have work and what is necessary.
<span title="attr-meta-http-equiv-content-type">Encoding declaration
state</span>.</p>
+ <p>If the document is <span>an <code>iframe</code> <code
+ title="attr-iframe-srcdoc">srcdoc</code> document</span>, the
+ document must not have a <span>character encoding
+ declaration</span>. (In this case, the source is already decoded,
+ since it is part of the document that contained the
+ <code>iframe</code>.)</p>
+
<p>If an <span title="HTML documents">HTML document</span> contains
a <code>meta</code> element with a <code
title="attr-meta-charset">charset</code> attribute or a
@@ -20770,6 +20790,7 @@ href="?audio">audio&lt;/a> test instead.)&lt;/p></pre>
<dt>Content attributes:</dt>
<dd><span>Global attributes</span></dd>
<dd><code title="attr-iframe-src">src</code></dd>
+ <dd><code title="attr-iframe-srcdoc">srcdoc</code></dd>
<dd><code title="attr-iframe-name">name</code></dd>
<dd><code title="attr-iframe-sandbox">sandbox</code></dd>
<dd><code title="attr-iframe-seamless">seamless</code></dd>
@@ -20779,6 +20800,7 @@ href="?audio">audio&lt;/a> test instead.)&lt;/p></pre>
<dd>
<pre class="idl">interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
attribute DOMString <span title="dom-iframe-src">src</span>;
+ attribute DOMString <span title="dom-iframe-srcdoc">srcdoc</span>;
attribute DOMString <span title="dom-iframe-name">name</span>;
[PutForwards=<span title="dom-DOMSettableTokenList-value">value</span>] readonly attribute <span>DOMSettableTokenList</span> <span title="dom-iframe-sandbox">sandbox</span>;
attribute boolean <span title="dom-iframe-seamless">seamless</span>;
@@ -20790,68 +20812,149 @@ href="?audio">audio&lt;/a> test instead.)&lt;/p></pre>
</dd>
</dl>
- <!-- v2 doc="" idea (awaiting implementation experience with seamless="" first):
+ <p>The <code>iframe</code> element <span>represents</span> a
+ <span>nested browsing context</span>.</p>
- http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-May/014874.html
+ <p>The <dfn title="attr-iframe-src"><code>src</code></dfn> attribute
+ gives the address of a page that the <span>nested browsing
+ context</span> is to contain. The attribute, if present, must be a
+ <span>valid URL</span>.</p>
- doc="" would take a string which would then be interpreted as
- the source document markup of an HTML document, much like the
- above; it would override src="" if it was present, allowing
- src="" to be used for legacy UAs:
+ <p>The <dfn title="attr-iframe-srcdoc"><code>srcdoc</code></dfn>
+ attribute gives the content of the page that the <span>nested
+ browsing context</span> is to contain. The value of the attribute
+ in is <dfn>an <code>iframe</code> <code
+ title="attr-iframe-srcdoc">srcdoc</code> document</dfn>.</p>
- <iframe seamless sandbox="allow-scripts allow-forms" doc="
- Welcome to my blog!
- </sandbox>
- <a href='#' onclick='alert(document.cookie)'>Click here</a>
- "></iframe>
+ <p>For <code>iframe</code> elements in <span>HTML documents</span>,
+ the attribute, if present, must have a value using <span>the HTML
+ syntax</span> that consists of the following syntactic components,
+ in the given order:</p>
- TODO:
- <!DOCTYPE HTML> implication
- <title></title> optional
+ <ol>
- -->
+ <li>Any number of <span title="syntax-comments">comments</span> and
+ <span title="space character">space characters</span>.</li>
- <p>The <code>iframe</code> element <span>represents</span> a
- <span>nested browsing context</span>.</p>
+ <li>Optionally, a <span title="syntax-doctype">DOCTYPE</span>.
- <p>The <dfn title="attr-iframe-src"><code>src</code></dfn> attribute
- gives the address of a page that the <span>nested browsing
- context</span> is to contain. The attribute, if present, must be a
- <span>valid URL</span>. <span class="impl">When the browsing context
- is created, if the attribute is present, the user agent must <span
- title="resolve a url">resolve</span> the value of that attribute,
- relative to the element, and if that is successful, must then
- <span>navigate</span> the element's browsing context to the
- resulting <span>absolute URL</span>, with <span>replacement
- enabled</span>, and with the <code>iframe</code> element's
- document's <span>browsing context</span> as the <span>source
- browsing context</span>. If the user <span
- title="navigate">navigates</span> away from this page, the
- <code>iframe</code>'s corresponding <code>WindowProxy</code> object
- will proxy new <code>Window</code> objects for new
- <code>Document</code> objects, but the <code
- title="attr-iframe-src">src</code> attribute will not
- change.</span></p>
+ <li>Any number of <span title="syntax-comments">comments</span> and
+ <span title="space character">space characters</span>.</li>
+
+ <li>The root element, in the form of an <code>html</code> <span
+ title="syntax-elements">element</span>.</li>
+
+ <li>Any number of <span title="syntax-comments">comments</span> and
+ <span title="space character">space characters</span>.</li>
+
+ </ol>
+
+ <p>For <code>iframe</code> elements in <span>XML documents</span>,
+ the attribute, if present, must have a value that matches the
+ production labeled <code>document</code> in the XML
+ specification. <a href="#refsXML">[XML]</a></p>
+
+ <p>If the <code title="attr-iframe-src">src</code> attribute and the
+ <code title="attr-iframe-srcdoc">srcdoc</code> attribute are both
+ specified together, the <code title="attr-iframe-srcdoc">srcdoc</code>
+ attribute takes priority. This allows authors to provide a fallback
+ <span>URL</span> for legacy user agents that do not support the
+ <code title="attr-iframe-srcdoc">srcdoc</code> attribute.</p>
<div class="impl">
- <p>Whenever the <code title="attr-iframe-src">src</code> attribute
- is set, the user agent must <span title="resolve a
- url">resolve</span> the value of that attribute, relative to the
- element, and if that is successful, the nested <span>browsing
- context</span> must be <span title="navigate">navigated</span> to
- the resulting <span>absolute URL</span>, with the
- <code>iframe</code> element's document's <span>browsing
- context</span> as the <span>source browsing context</span>.</p> <!--
- It doesn't happen when the base URL is changed, though. -->
+ <p>When an <code>iframe</code> element is first <span title="insert
+ an element into a document">inserted into a document</span>, the
+ user agent must create a <span>nested browsing context</span>, and
+ then <span>process the <code>iframe</code> attributes</span>.</p>
- <p>If the <code title="attr-iframe-src">src</code> attribute is not
- set when the element is created, or if its value cannot be <span
- title="resolve a url">resolved</span>, the browsing context will
- remain at the initial <code>about:blank</code> page.</p>
+ <p>Whenever an <code>iframe</code> element with a <span>nested
+ browsing context</span> has its <code
+ title="attr-iframe-srcdoc">srcdoc</code> attribute set or changed,
+ the user agent must <span>process the <code>iframe</code>
+ attributes</span>.</p>
+
+ <p>Similarly, whenever an <code>iframe</code> element with a
+ <span>nested browsing context</span> but with no <code
+ title="attr-iframe-srcdoc">srcdoc</code> attribute specified has its
+ <code title="attr-iframe-src">src</code> attribute set or changed,
+ the user agent must <span>process the <code>iframe</code>
+ attributes</span>.</p> <!-- It doesn't happen when the base URL is
+ changed, though. -->
+
+ <p>When the user agent is to <dfn>process the <code>iframe</code>
+ attributes</dfn>, it must run the first appropriate steps from the
+ following list:</p>
+
+ <dl class="switch">
+
+ <dt>If the <code title="attr-iframe-srcdoc">srcdoc</code> attribute
+ is specified</dt>
+
+ <dd><p><span>Navigate</span> the element's <span>browsing
+ context</span> to a resource whose <span>Content-Type</span> is
+ <code>text/html</code>, whose <span>URL</span> is
+ <code>about:srcdoc</code>, and whose data consists of the value of
+ the attribute.</p></dd>
+
+ <dt>Otherwise, if the <code title="attr-iframe-src">src</code>
+ attribute is specified but the <code
+ title="attr-iframe-srcdoc">srcdoc</code> attribute is not</dt>
+
+ <dd>
+
+ <ol>
+
+ <li><p><span title="resolve a url">Resolve</span> the value of
+ the <code title="attr-iframe-src">src</code> attribute, relative
+ to the <code>iframe</code> element.</p></li>
+
+ <li><p>If that is successful, <span>navigate</span> the element's
+ <span>browsing context</span> to the resulting <span>absolute
+ URL</span>.</p></li>
+
+ </ol>
+
+ </dd>
+
+ </dl>
+
+ <p>Any <span title="navigate">navigation</span> required of the user
+ agent in the <span>process the <code>iframe</code> attributes</span>
+ algorithm must be completed with the <code>iframe</code> element's
+ document's <span>browsing context</span> as the <span>source
+ browsing context</span>.</p>
+
+ <p>Furthermore, if the <span>process the <code>iframe</code>
+ attributes</span> algorithm was invoked as a result of the element
+ being <span title="insert an element into a document">inserted into
+ a document</span>, then any <span title="navigate">navigation</span>
+ required of the user agent in that algorithm must be completed with
+ <span>replacement enabled</span>.</p>
</div>
+ <p class="note">If, when the element is created, the <code
+ title="attr-iframe-srcdoc">srcdoc</code> attribute is not set, and
+ the <code title="attr-iframe-src">src</code> attribute is either
+ also not set or set but its value cannot be <span title="resolve a
+ url">resolved</span>, the browsing context will remain at the
+ initial <code>about:blank</code> page.</p>
+
+ <p class="note">If the user <span title="navigate">navigates</span>
+ away from this page, the <code>iframe</code>'s corresponding
+ <code>WindowProxy</code> object will proxy new <code>Window</code>
+ objects for new <code>Document</code> objects, but the <code
+ title="attr-iframe-src">src</code> attribute will not change.</p>
+
+ <div class="example">
+
+ <p class="xxx">example for srcdoc here</p>
+
+ </div>
+
+ <hr>
+
<p>The <dfn title="attr-iframe-name"><code>name</code></dfn>
attribute, if present, must be a <span>valid browsing context
name</span>. The given value is used to name the <span>nested
@@ -21374,6 +21477,8 @@ href="?audio">audio&lt;/a> test instead.)&lt;/p></pre>
<p>The IDL attributes <dfn
title="dom-iframe-src"><code>src</code></dfn>, <dfn
+ title="dom-iframe-srcdoc"><code>srcdoc</code></dfn>, <dfn
+ title="dom-iframe-body"><code>body</code></dfn>, <dfn
title="dom-iframe-name"><code>name</code></dfn>, <dfn
title="dom-iframe-sandbox"><code>sandbox</code></dfn>, and <dfn
title="dom-iframe-seamless"><code>seamless</code></dfn> must
@@ -57386,6 +57491,15 @@ interface <dfn>Window</dfn> {
assigned when its browsing context was created</a>.</dd>
+ <dt>If a <code>Document</code> is <span>an <code>iframe</code> <code
+ title="attr-iframe-srcdoc">srcdoc</code> document</span></dt>
+
+ <dd>The <span>origin</span> of the <code>Document</code> is the
+ <span>origin</span> of the <code>Document</code>'s <span>browsing
+ context</span>'s <span>browsing context container</span>'s
+ <code>Document</code>.</dd>
+
+
<dt>If a <code>Document</code> or image was obtained in some
other manner (e.g. a <code title="">data:</code> URL typed in by
the user, a <code>Document</code> created using the <code
@@ -94486,6 +94600,7 @@ interface <span>HTMLDocument</span> {
<td>text*</td>
<td><span title="global attributes">globals</span>;
<code title="attr-iframe-src">src</code>;
+ <code title="attr-iframe-srcdoc">srcdoc</code>;
<code title="attr-iframe-name">name</code>;
<code title="attr-iframe-sandbox">sandbox</code>;
<code title="attr-iframe-seamless">seamless</code>;
@@ -95347,6 +95462,11 @@ interface <span>HTMLDocument</span> {
<td> Hint that the <span>media resource</span> can be started automatically when the page is loaded
<td> <span>Boolean attribute</span>
<tr>
+ <th> <code title="">srcdoc</code>
+ <td> <code title="attr-iframe-srcdoc">iframe</code>
+ <td> A document to render in the <code>iframe</code>
+ <td> The source of <span>an <code>iframe</code> <code title="attr-iframe-srcdoc">srcdoc</code> document</span>*
+ <tr>
<th> <code title="">challenge</code>
<td> <code title="attr-keygen-challenge">keygen</code>
<td> String to package with the generated and signed public key

0 comments on commit f41d12b

Please sign in to comment.