You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ResponsiveImages.html
+41-11Lines changed: 41 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -60,16 +60,36 @@
60
60
<p>Through the combination of a new <code>picture</code> element and a new the <code>srcset</code> attribute for the existing <code>source</code> element, this specification adds functionality to HTML that allows authors to list a range of images which may be suitable for a range of device capabilities and different usage scenarios. The ability to adapt content to the constraints and capabilities of devices and different usage scenarios is commonly referred to as "responsive design".
61
61
This allows user agents to be more responsive to a wide spectrum of browsing scenarios, ranging from simple mobile devices to desktop browsers scenarios, when selecting which image resources to download and display for an end-user. This includes, but is not limited to, the selection of images most suited for either high or low density displays and screen resolutions on range of devices, are well as responsive selection of images based on printer's dpi and color reproduction capabilities.</p>
62
62
</section>
63
+
64
+
<sectionid="goals">
65
+
<h1>Goals</h1>
66
+
<p>The overarching goal is to give developers a way to provide user agents with sufficient information about each image, and applicable media, so that the user agent can select the most appropriate one for a dynamically changing browsing situations. This includes, but is not limited to, different screen pixel width/height, pixel densities, environmental lighting conditions, and potentially even situations where the network bandwith changes dymamically. By providing a graded set of image sources, UA discretion could similarly apply to situations where the network bandwith changes dymamically. Based on user settings and network latency calculated by the user agent, the UA may have the option of selecting lower density image sources.</p>
67
+
<p>In addition, this proposal is being worked on with the following goals in mind:</p>
68
+
<ul>
69
+
<li>Will degrade gracefully on older user agents.</li>
70
+
<li>Can be polyfilled.</li>
71
+
<li>Retains, at a minimum, the same level of accessibility as current <code>img</code> element - and we may even be able to do better! </li>
72
+
<li>Adhere to common conventions around for content, markup, behavior, and styling.</li>
73
+
<li>Provides a purely client-side solution that can rely on scripts, but doesn’t require it. Similarly, this solution must not require the use of any server-side technologies to reliably deliver content tailored for the end user’s browsing situation.</li>
74
+
<li>Supports use cases where authors need to explicitly define different image versions as opposed to simply different resolutions of the same image.</li>
75
+
<li>Provides a consistent and predictable pattern for delivering alternate media sources based on client context.</li>
76
+
<li>Supports succinct but understandable mark-up. </li>
77
+
<li>Don't repeat yourself: If the same image is used multiple times on a single page, it would be useful to define the resource selection in a single place in the document and have this affect all instances of the image</li>
78
+
</ul>
79
+
</section>
80
+
63
81
64
82
<sectionid="sotd">
65
83
<p>This document was proposed by the <ahref="http://www.w3.org/community/respimg/">Responsive Images Community Group</a> as a solution to <ahref="https://www.w3.org/Bugs/Public/show_bug.cgi?id=18384">bug 18384</a>.</p>
66
84
</section>
85
+
86
+
67
87
<sectionid="conformance">
68
88
<p>This specification describes the conformance criteria for <dfntitle="user agent">user agents</dfn> (relevant to implementors) and <dfntitle="document">documents</dfn> (relevant to authors and authoring tool implementors).</p>
69
89
<p>Implementations that use ECMAScript to expose the APIs defined in this specification MUST implement them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]].</p>
70
90
</section>
71
91
<sectionid="definitions">
72
-
<h2>Definitions</h2>
92
+
<h1>Definitions</h1>
73
93
<p>The following terms are used throughout this specification so they are gathered here for the readers convenience. The following list of terms is not exhaustive; other terms are defined throughout this specification.</p>
74
94
<p>The follow terms are defined by the<cite></cite>[[!HTML5]] specification: <dfn><ahref="http://www.w3.org/TR/html5/the-img-element.html#the-img-element"><code>img</code> element</a></dfn>, <dfn><ahref="http://www.w3.org/TR/html5/the-source-element.html#the-source-element"><code>source</code> element</a></dfn>, <dfn><ahref="http://www.w3.org/TR/html5/media-elements.html#media-resource"><code>media</code> resource</a></dfn>, <dfn><ahref="http://www.w3.org/TR/html5/content-models.html#fallback-content">fallback content</a></dfn>, <dfn><ahref="http://www.w3.org/TR/html5/urls.html#valid-non-empty-url-potentially-surrounded-by-spaces">valid non-empty URL potentially surrounded by spaces</a></dfn> and <dfn><ahref="http://www.w3.org/TR/html5/common-microsyntaxes.html#valid-media-query">valid media query</a></dfn>.</p>
75
95
<p>The <dfn><ahref="http://dev.w3.org/csswg/css4-images/#image-set-notation">image-set notation</a></dfn> microsyntax is defined by the<cite> CSS Image Values and Replaced Content Module Level 4 Specification</cite> [[!CSS4-IMAGES]].</p>
NamedConstructor=Picture(unsigned long width, unsigned long height)]
123
+
HTMLPictureElement : HTMLImageElement{
124
+
readonly attribute DOMString media;
125
+
}</pre>
126
+
127
+
</dd>
100
128
</dl>
101
129
<p>The <code><dfn>picture</dfn></code> element used for displaying an image that can come from a range of sources (see <code>srcset</code> attribute). Which image the user agent displays depends on the
102
130
<a>algorithm for deriving the source image</a>. </p>
103
-
<p>The <a>chosen image</a> is the embedded content. </p>
104
-
<p>The <code>crossorigin</code> attribute is a <ahref="http://dev.w3.org/html5/spec/urls.html#cors-settings-attribute">CORS settings attribute</a>. Its purpose is to allow images from third-party sites that allow cross-origin access to be used with <ahref="http://dev.w3.org/html5/spec/the-canvas-element.html#the-canvas-element">canvas</a>.</p>
105
-
<p>The <dfn>width</dfn> and <dfn>height</dfn> attributes represent the dimensions of the visual content of the element (the width and height respectively, relative to the nominal direction of the output medium), in CSS pixels. They are in every way the same as those of an <code>img</code> element. The value of attributes, if specified, are <ahref="http://dev.w3.org/html5/spec/single-page.html#valid-non-negative-integer" title="valid non-negative integer">valid non-negative integers</a>.</p>
106
-
<p>For user agents that don't support the <code>picture</code> element, an author can provide an <code>img</code> element as <a>fallback content</a>. User agents SHOULD NOT show this content to the user: it is intended for legacy user agents that do not support <code>picture</code>, so that a legacy <code>img</code> element can be shown instead.</p>
131
+
<p>On getting the <code>media</code> attribute, the user agent MUST return the </p>
132
+
<p>The <a>chosen image</a> is the embedded content. </p>
133
+
<p>For user agents that don't support the <code>picture</code> element, an author can provide an <code>img</code> element as <a>fallback content</a>. User agents SHOULD NOT show this content to the user: it is intended for legacy user agents that do not support <code>picture</code>, so that a legacy <code>img</code> element can be shown instead.</p>
107
134
<p>Authoring requirement: as with the <code>img</code> element, documents must not use the <code>picture</code> element as a layout tool. In particular, picture elements should not be used to display transparent images, as they rarely convey meaning and rarely add anything useful to the document. </p>
<p>The overarching goal is to give developers a way to provide user agents with sufficient information about each image, and applicable media, so that the user agent can select the most appropriate one for a dynamically changing browsing situations. This includes, but is not limited to, different screen pixel width/height, pixel densities, environmental lighting conditions, and potentially even situations where the network bandwith changes dymamically. By providing a graded set of image sources, UA discretion could similarly apply to situations where the network bandwith changes dymamically. Based on user settings and network latency calculated by the user agent, the UA may have the option of selecting lower density image sources.</p>
@@ -224,6 +252,10 @@ <h1>Goals</h1>
224
252
</ul>
225
253
</section>
226
254
<h1>Use Cases </h1>
255
+
=======
256
+
257
+
<h1>Use Cases </h1>
258
+
>>>>>>> Cosmetic changes and removed some attribute defs that are not inherited from HTMLImageInterface
227
259
<p>There are many use cases that are supported as listed below. There are two primary use cases:</p>
228
260
<ol>
229
261
<li>The need for different image sources at different viewport sizes in responsive web designs.</li>
@@ -290,11 +322,9 @@ <h2 class="informative-subhed">Gray Scale and High Contrast Modes</h2>
0 commit comments