8000 Allow pingback/prefetch/stylesheet links in body · whatwg/html@179983e · GitHub
[go: up one dir, main page]

Skip to content

Commit 179983e

Browse files
igrigorikzcorpan
authored andcommitted
Allow pingback/prefetch/stylesheet links in body
Some external links augment the current document and should not be restricted to metadata content. For example, the server may want to emit a prefetch link within body content based on the generated content (well after the head section was flushed). Similarly, the position of a rel=stylesheet link in body can act as an optimization and signal to the user agent that DOM content above it may be painted - see [1]. However, note that this update does not define or change how or when CSS is applied - that's a separate discussion. All current browsers allow and process external resource links in body, this update reflects what's implemented and being used by developers. [1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=27303#c37 PR: #616
1 parent 32e3822 commit 179983e

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

source

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9456,7 +9456,7 @@ interface <dfn>HTMLUnknownElement</dfn> : <span>HTMLElement</span> { };</pre>
94569456
<li><code>kbd</code></li>
94579457
<li><code>keygen</code></li>
94589458
<li><code>label</code></li>
9459-
<li><code>link</code> (if the <code data-x="attr-itemprop">itemprop</code> attribute is present)</li>
9459+
<li><code>link</code> (if it is <span>allowed in the body</span>)</li>
94609460
<li><code>main</code></li>
94619461
<li><code>map</code></li>
94629462
<li><code>mark</code></li>
@@ -9573,7 +9573,7 @@ interface <dfn>HTMLUnknownElement</dfn> : <span>HTMLElement</span> { };</pre>
95739573
<li><code>kbd</code></li>
95749574
<li><code>keygen</code></li>
95759575
<li><code>label</code></li>
9576-
<li><code>link</code> (if the <code data-x="attr-itemprop">itemprop</code> attribute is present)</li>
9576+
<li><code>link</code> (if it is <span>allowed in the body</span>)</li>
95779577
<li><code>map</code></li>
95789578
<li><code>mark</code></li>
95799579
<li><code>math</code></li>
@@ -11721,12 +11721,12 @@ gave me some of the songs they wrote. I love sharing my music.&lt;/p>
1172111721
<dl class="element">
1172211722
<dt><span data-x="concept-element-categories">Categories</span>:</dt>
1172311723
<dd><span>Metadata content</span>.</dd>
11724-
<dd>If the <code data-x="attr-itemprop">itemprop</code> attribute is present: <span>flow content</span>.</dd>
11725-
<dd>If the <code data-x="attr-itemprop">itemprop</code> attribute is present: <span>phrasing content</span>.</dd>
11724+
<dd>If the element is <span>allowed in the body</span>: <span>flow content</span>.</dd>
11725+
<dd>If the element is <span>allowed in the body</span>: <span>phrasing content</span>.</dd>
1172611726
<dt><span data-x="concept-element-contexts">Contexts in which this element can be used</span>:</dt>
1172711727
<dd>Where <span>metadata content</span> is expected.</dd>
1172811728
<dd>In a <code>noscript</code> element that is a child of a <code>head</code> element.</dd>
11729-
<dd>If the <code data-x="attr-itemprop">itemprop</code> attribute is present: where <span>phrasing content</span> is expected.</dd>
11729+
<dd>If the element is <span>allowed in the body</span>: where <span>phrasing content</span> is expected.</dd>
1173011730
<dt><span data-x="concept-element-content-model">Content model</span>:</dt>
1173111731
<dd><span data-x="concept-content-nothing">Nothing</span>.</dd>
1173211732
<dt><span data-x="concept-element-attributes">Content attributes</span>:</dt>
@@ -11765,19 +11765,24 @@ gave me some of the songs they wrote. I love sharing my music.&lt;/p>
1176511765
<p>A <code>link</code> element must have either a <code data-x="attr-link-rel">rel</code> attribute
1176611766
or an <code data-x="attr-itemprop">itemprop</code> attribute, but not both.</p>
1176711767

11768-
<p class="note">If the <code data-x="attr-link-rel">rel</code> attribute is used, the element is
11769-
restricted to the <code>head</code> element. When used with the <code
11770-
data-x="attr-itemprop">itemprop</code> attribute, the element can be used both in the
11771-
<code>head</code> element and in the <code>body</code> of the page, subject to the constraints of
11772-
the microdata model.</p>
11773-
1177411768
<p>The types of link indicated (the relationships) are given by the value of the <dfn><code data-x="attr-link-rel">rel</code></dfn> attribute, which, if present, must have a value that
1177511769
is a <span>set of space-separated tokens</span>. The <a href="#linkTypes">allowed keywords and
1177611770
their meanings</a> are defined in a later section. <span w-nodev>If the <code
1177711771
data-x="attr-link-rel">rel</code> attribute is absent, has no keywords, or if none of the keywords
1177811772
used are allowed according to the definitions in this specification, then the element does not
1177911773
create any links.</span></p>
1178011774

11775+
<p>If a <code>link</code> element has an <code data-x="attr-itemprop">itemprop</code> attribute,
11776+
or has a <code data-x="attr-link-rel">rel</code> attribute that contains only keywords that are
11777+
<span>body-ok</span>, then the element is said to be <dfn>allowed in the body</dfn>. This means
11778+
that the element can be used where <span>phrasing content</span> is expected.</p>
11779+
11780+
<p class="note">If the <code data-x="attr-link-rel">rel</code> attribute is used, the element can
11781+
only sometimes be used in the <code>body</code> of the page. When used with the <code
11782+
data-x="attr-itemprop">itemprop</code> attribute, the element can be used both in the
11783+
<code>head</code> element and in the <code>body</code> of the page, subject to the constraints of
11784+
the microdata model.</p>
11785+
1178111786
<p>Two categories of links can be created using the <code>link</code> element: <span
1178211787
data-x="external resource link">Links to external resources</span> and <span
1178311788
data-x="hyperlink">hyperlinks</span>. The <a href="#linkTypes">link types section</a> defines
@@ -21518,6 +21523,9 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
2151821523
<p>Link types are always <span>ASCII case-insensitive</span><span w-nodev>, and must be
2151921524
compared as such</span>.</p>
2152021525

21526+
<p>Certain keywords are said to be <dfn>body-ok</dfn>. This affects whether <code>link</code>
21527+
elements are <span>allowed in the body</span>.
21528+
2152121529
<p class="example">Thus, <code data-x="">rel="next"</code> is the same as <code
2152221530
data-x="">rel="NEXT"</code>.</p>
2152321531

@@ -22149,7 +22157,7 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
2214922157

2215022158
<p>The <code data-x="rel-pingback">pingback</code> keyword may be used with <code>link</code>
2215122159
elements. This keyword creates an <span data-x="external resource link">external resource
22152-
link</span>.</p>
22160+
link</span>. This keyword is <span>body-ok</span>.</p>
2215322161

2215422162
<p>For the semantics of the <code data-x="rel-pingback">pingback</code> keyword, see the Pingback
2215522163
1.0 specification. <ref spec=PINGBACK></p>
@@ -22159,7 +22167,7 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
2215922167

2216022168
<p>The <code data-x="rel-prefetch">prefetch</code> keyword may be used with <code>link</code>,
2216122169
<code>a</code>, and <code>area</code> elements. This keyword creates an <span data-x="external
22162-
resource link">external resource link</span>.</p>
22170+
resource link">external resource link</span>. This keyword is <span>body-ok</span>.</p>
2216322171

2216422172
<p>The <code data-x="rel-prefetch">prefetch</code> keyword indicates that preemptively fetching and
2216522173
caching the specified resource is likely to be beneficial, as it is highly likely that the user
@@ -22187,7 +22195,8 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
2218722195

2218822196
<p>The <code data-x="rel-stylesheet">stylesheet</code> keyword may be used with <code>link</code>
2218922197
elements. This keyword creates an <span data-x="external resource link">external resource
22190-
link</span> that contributes to the styling processing model.</p>
22198+
link</span> that contributes to the styling processing model. This keyword is
22199+
<span>body-ok</span>.</p>
2219122200

2219222201
<p>The specified resource is a resource that describes how to present the document. Exactly how
2219322202
the resource is to be processed depends on the actual type of the resource.</p>
@@ -114105,7 +114114,7 @@ if (s = prompt('What is your name?')) {
114105114114
<span data-x="text content">Text</span>
114106114115
<td>
114107114116
<code>area</code> (if it is a descendant of a <code>map</code> element);
114108-
<code>link</code> (if the <code data-x="attr-itemprop">itemprop</code> attribute is present);
114117+
<code>link</code> (if it is <span>allowed in the body</span>);
114109114118
<code>meta</code> (if the <code data-x="attr-itemprop">itemprop</code> attribute is present);
114110114119
<code>style</code> (if the <code data-x="attr-style-scoped">scoped</code> attribute is present)
114111114120

@@ -114191,7 +114200,7 @@ if (s = prompt('What is your name?')) {
114191114200
<span data-x="text content">Text</span>
114192114201
<td>
114193114202
<code>area</code> (if it is a descendant of a <code>map</code> element);
114194-
<code>link</code> (if the <code data-x="attr-itemprop">itemprop</code> attribute is present);
114203+
<code>link</code> (if it is <span>allowed in the body</span>);
114195114204
<code>meta</code> (if the <code data-x="attr-itemprop">itemprop</code> attribute is present)
114196114205

114197114206
<tr>

0 commit comments

Comments
 (0)
0