Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[giow] (2) Revamp the way that type='' on <link> is defined to actual…
…ly be accurate. Allow sniffing when the expected type is an image.

git-svn-id: http://svn.whatwg.org/webapps@1784 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 18, 2008
1 parent 50aef91 commit cf0d338
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 38 deletions.
59 changes: 41 additions & 18 deletions index
Expand Up @@ -7666,7 +7666,8 @@ background: transparent">blue&lt;/span>.&lt;/p></pre>
then the <code title=attr-link-media><a href="#media0">media</a></code>
attribute is prescriptive. The user agent must apply the external resource
to <span>views</span><!-- XXX xref --> while their state match the listed
media, and must not apply them otherwise.
media and the other relevant conditions apply, and must not apply them
otherwise.

<p id=default-media>The default, if the <code title=attr-link-media><a
href="#media0">media</a></code> attribute is omitted, is <code>all</code>,
Expand All @@ -7685,26 +7686,48 @@ background: transparent">blue&lt;/span>.&lt;/p></pre>
href="#refsRFC2046">[RFC2046]</a>

<p>For <a href="#links1" title="external resource link">external resource
links</a>, user agents may use the type given in this attribute to decide
whether or not to consider using the resource at all. If the UA does not
support the given MIME type for the given link relationship, then the UA
may opt not to download and apply the resource.
links</a>, the <code title=attr-link-type><a href="#type">type</a></code>
attribute is used as a hint to user agents so that they can avoid
downloading resources they do not support. If the attribute is present,
then the user agent must assume that the resource is of the given type. If
the attribute is omitted, but the external resource link type has a
default type defined, then the user agent must assume that the resource is
of that type. If the UA does not support the given MIME type for the given
link relationship, then the UA should not download the resource; if the UA
does support the given MIME type for the given link relationship, then the
UA should download the resource. If the attribute is omitted, and the
external resource link type does not have a default type defined, but the
user agent would fetch the resource if the type was known and supported,
then the user agent should fetch the resource under the assumption that it
will be supported.

<p>User agents must not consider the <code title=attr-link-type><a
href="#type">type</a></code> attribute authoritative &mdash; upon fetching
the resource, user agents must not use metadata included in the link to
the resource to determine its type.

<p>If the attribute is omitted, but the user agent would fetch the resource
if the type was known and supported, then the user agent must fetch the
resource and determine its type <a href="#content-type8"
title=Content-Type>from its Content-Type metadata</a> to determine if it
supports (and can apply) that external resource. If no type metadata is
specified, but the external resource link type has a default type defined,
then the user agent must assume that the resource is of that type.
the resource, user agents must not use the <code title=attr-link-type><a
href="#type">type</a></code> attribute to determine its actual type. Only
the actual type (as defined in the next paragraph) is used to determine
whether to <em>apply</em> the resource, not the aforementioned assumed
type.

<p>If the resource is expected to be an image, user agents may apply the <a
href="#content-type6" title="Content-Type sniffing: image">image sniffing
rules</a>, with the <var title="">official type</var> being the type
determined from the resource's <a href="#content-type8"
title=Content-Type>Content-Type metadata</a>, and use the resulting
sniffed type of the resource as if it was the actual type. Otherwise, if
the resource is not expected to be an image, or if the user agent opts not
to apply those rules, then the user agent must use the resource's <a
href="#content-type8" title=Content-Type>Content-Type metadata</a> to
determine the type of the resource. If there is no type metadata, but the
external resource link type has a default type defined, then the user
agent must assume that the resource is of that type.

<p>Once the user agent has established the type of the resource, the user
agent must apply the resource if it is of a supported type and the other
relevant conditions apply, and must ignore the resource otherwise.

<div class=example>
<p>If a document contains four style sheet links labeled as follows:</p>
<p>If a document contains style sheet links labeled as follows:</p>

<pre>&lt;link rel="stylesheet" href="A" type="text/plain"&gt;
&lt;link rel="stylesheet" href="B" type="text/css"&gt;
Expand Down Expand Up @@ -34085,8 +34108,8 @@ user reload must be equivalent to .reload()
<p>User agents must ignore any rows for image types that they do not
support.

<p>Otherwise, the <i>sniffed type</i> of the resource is the same as its
<var title="">official type</var>.
<p>Otherwise, the sniffed type of the resource is the same as its <var
title="">official type</var>.

<h4 id=content-type3><span class=secno>4.10.4 </span><dfn
id=content-type7>Content-Type sniffing: feed or HTML</dfn></h4>
Expand Down
63 changes: 43 additions & 20 deletions source
Expand Up @@ -6041,7 +6041,8 @@ background: transparent">blue&lt;/span>.&lt;/p></pre>
then the <code title="attr-link-media">media</code> attribute is
prescriptive. The user agent must apply the external resource to
<span>views</span><!-- XXX xref --> while their state match the
listed media, and must not apply them otherwise.</p>
listed media and the other relevant conditions apply, and must not
apply them otherwise.</p>

<p id="default-media">The default, if the <code
title="attr-link-media">media</code> attribute is omitted, is
Expand All @@ -6059,30 +6060,52 @@ background: transparent">blue&lt;/span>.&lt;/p></pre>
href="#refsRFC2046">[RFC2046]</a></p>

<p>For <span title="external resource link">external resource
links</span>, user agents may use the type given in this attribute
to decide whether or not to consider using the resource at all. If
the UA does not support the given MIME type for the given link
relationship, then the UA may opt not to download and apply the
resource.</p>
links</span>, the <code title="attr-link-type">type</code> attribute
is used as a hint to user agents so that they can avoid downloading
resources they do not support. If the attribute is present, then the
user agent must assume that the resource is of the given type. If
the attribute is omitted, but the external resource link type has a
default type defined, then the user agent must assume that the
resource is of that type. If the UA does not support the given MIME
type for the given link relationship, then the UA should not
download the resource; if the UA does support the given MIME type
for the given link relationship, then the UA should download the
resource. If the attribute is omitted, and the external resource
link type does not have a default type defined, but the user agent
would fetch the resource if the type was known and supported, then
the user agent should fetch the resource under the assumption that
it will be supported.</p>

<p>User agents must not consider the <code
title="attr-link-type">type</code> attribute authoritative &mdash;
upon fetching the resource, user agents must not use metadata
included in the link to the resource to determine its type.</p>

<p>If the attribute is omitted, but the user agent would fetch the
resource if the type was known and supported, then the user agent
must fetch the resource and determine its type <span
title="Content-Type">from its Content-Type metadata</span> to
determine if it supports (and can apply) that external resource. If
no type metadata is specified, but the external resource link type
has a default type defined, then the user agent must assume that the
resource is of that type.</p>
upon fetching the resource, user agents must not use the <code
title="attr-link-type">type</code> attribute to determine its actual
type. Only the actual type (as defined in the next paragraph) is
used to determine whether to <em>apply</em> the resource, not the
aforementioned assumed type.</p>

<p>If the resource is expected to be an image, user agents may apply
the <span title="Content-Type sniffing: image">image sniffing
rules</span>, with the <var title="">official type</var> being the
type determined from the resource's <span
title="Content-Type">Content-Type metadata</span>, and use the
resulting sniffed type of the resource as if it was the actual
type. Otherwise, if the resource is not expected to be an image, or
if the user agent opts not to apply those rules, then the user agent
must use the resource's <span title="Content-Type">Content-Type
metadata</span> to determine the type of the resource. If there is
no type metadata, but the external resource link type has a default
type defined, then the user agent must assume that the resource is
of that type.</p>

<p>Once the user agent has established the type of the resource, the
user agent must apply the resource if it is of a supported type and
the other relevant conditions apply, and must ignore the resource
otherwise.</p>

<div class="example">

<p>If a document contains four style sheet links labeled as
follows:</p>
<p>If a document contains style sheet links labeled as follows:</p>

<pre>&lt;link rel="stylesheet" href="A" type="text/plain"&gt;
&lt;link rel="stylesheet" href="B" type="text/css"&gt;
Expand Down Expand Up @@ -31802,7 +31825,7 @@ user reload must be equivalent to .reload()
<p>User agents must ignore any rows for image types that they do not
support.</p>

<p>Otherwise, the <i>sniffed type</i> of the resource is the same as
<p>Otherwise, the sniffed type of the resource is the same as
its <var title="">official type</var>.</p>


Expand Down

0 comments on commit cf0d338

Please sign in to comment.