Skip to content

Commit 06b0261

Browse files
zcorpanrubberyuzu
authored and
rubberyuzu
committed
Re-add <source media> for media elements
Fixes whatwg#6363
1 parent b51d890 commit 06b0261

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

source

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28130,10 +28130,10 @@ interface <dfn interface>HTMLPictureElement</dfn> : <span>HTMLElement</span> {
2813028130
<dt><span data-x="concept-element-attributes">Content attributes</span>:</dt>
2813128131
<dd><span>Global attributes</span></dd>
2813228132
<dd><code data-x="attr-source-type">type</code></dd>
28133-
<dd><code data-x="attr-source-src">src</code> (in <code>video</code> or <code>audio</code>)</dd>
28133+
<dd><code data-x="attr-source-media">media</code></dd>
28134+
<dd><code data-x="attr-source-src">src</code> (in <code>audio</code> or <code>video</code>)</dd>
2813428135
<dd><code data-x="attr-source-srcset">srcset</code> (in <code>picture</code>)</dd>
2813528136
<dd><code data-x="attr-source-sizes">sizes</code> (in <code>picture</code>)</dd>
28136-
<dd><code data-x="attr-source-media">media</code> (in <code>picture</code>)</dd>
2813728137
<dd><code data-x="attr-dim-width">width</code> (in <code>picture</code>)</dd>
2813828138
<dd><code data-x="attr-dim-height">height</code> (in <code>picture</code>)</dd>
2813928139
<dt><span
@@ -28166,6 +28166,17 @@ interface <dfn interface>HTMLSourceElement</dfn> : <span>HTMLElement</span> {
2816628166
<p>The <dfn element-attr for="source" data-x="attr-source-type"><code>type</code></dfn> attribute
2816728167
may be present. If present, the value must be a <span>valid MIME type string</span>.</p>
2816828168

28169+
<p>The <dfn element-attr for="source" data-x="attr-source-media"><code>media</code></dfn>
28170+
attribute may also be present. If present, the value must contain a <span>valid media query
28171+
list</span>. The user agent will skip to the next <code>source</code> element if the value does
28172+
not <span data-x="matches the environment">match the environment</span>.</p>
28173+
28174+
<p class="note">The <code data-x="attr-source-media">media</code> attribute is only evaluated
28175+
once during the <span data-x="concept-media-load-algorithm">resource selection algorithm</span>
28176+
for <span data-x="media element">media elements</span>. In contrast, when using the
28177+
<code>picture</code> element, the user agent will <a href="#img-environment-changes">react to
28178+
changes in the environment</a>.</p>
28179+
2816928180
<p>The remainder of the requirements depend on whether the parent is a <code>picture</code>
2817028181
element or a <span>media element</span>:</p>
2817128182

@@ -28190,11 +28201,6 @@ interface <dfn interface>HTMLSourceElement</dfn> : <span>HTMLElement</span> {
2819028201
attribute</span>, which contributes the <span>source size</span> to the <span>source set</span>,
2819128202
if the <code>source</code> element is selected.</p>
2819228203

28193-
<p>The <dfn element-attr for="source" data-x="attr-source-media"><code>media</code></dfn>
28194-
attribute may also be present. If present, the value must contain a <span>valid media query
28195-
list</span>. The user agent will skip to the next <code>source</code> element if the value does
28196-
not <span data-x="matches the environment">match the environment</span>.</p>
28197-
2819828204
<p>The <code>source</code> element supports <span>dimension attributes</span>. The
2819928205
<code>img</code> element can use the <code data-x="attr-dim-width">width</code> and <code
2820028206
data-x="attr-dim-height">height</code> attributes of a <code>source</code> element, instead of
@@ -28333,9 +28339,8 @@ interface <dfn interface>HTMLSourceElement</dfn> : <span>HTMLElement</span> {
2833328339
</dl>
2833428340
</div>
2833528341

28336-
<p>The <code data-x="attr-source-srcset">srcset</code>, <code
28337-
data-x="attr-source-sizes">sizes</code>, and <code data-x="attr-source-media">media</code>
28338-
attributes must not be present.</p>
28342+
<p>The <code data-x="attr-source-srcset">srcset</code> and <code
28343+
data-x="attr-source-sizes">sizes</code> attributes must not be present.</p>
2833928344
</dd>
2834028345
</dl>
2834128346

@@ -35715,6 +35720,11 @@ interface <dfn interface>MediaError</dfn> {
3571535720
<span>synchronous section</span>, and jump down to the <i>failed with elements</i> step
3571635721
below.</p></li>
3571735722

35723+
<li><p>&#x231B; If <var>candidate</var> has a <code data-x="attr-source-media">media</code>
35724+
attribute whose value does not <span data-x="matches the environment">match the
35725+
environment</span>, then end the <span>synchronous section</span>, and jump down to the
35726+
<i>failed with elements</i> step below.</p></li>
35727+
3571835728
<li><p>&#x231B; Let <var>urlString</var> and <var>urlRecord</var> be the <span>resulting URL
3571935729
string</span> and the <span>resulting URL record</span>, respectively, that would have
3572035730
resulted from <span data-x="parse a url">parsing</span> the <span>URL</span> specified by
@@ -130649,11 +130659,11 @@ interface <dfn interface>External</dfn> {
130649130659
<code>audio</code></td>
130650130660
<td>empty</td>
130651130661
<td><span data-x="global attributes">globals</span>;
130652-
<code data-x="attr-source-src">src</code>;
130653130662
<code data-x="attr-source-type">type</code>;
130663+
<code data-x="attr-source-media">media</code>;
130664+
<code data-x="attr-source-src">src</code>;
130654130665
<code data-x="attr-source-srcset">srcset</code>;
130655130666
<code data-x="attr-source-sizes">sizes</code>;
130656-
<code data-x="attr-source-media">media</code>;
130657130667
<code data-x="attr-dim-width">width</code>;
130658130668
<code data-x="attr-dim-height">height</code></td>
130659130669
<td><code>HTMLSourceElement</code></td>
@@ -131978,7 +131988,7 @@ interface <dfn interface>External</dfn> {
131978131988
<th> <code data-x="">media</code>
131979131989
<td> <code data-x="attr-link-media">link</code>;
131980131990
<code data-x="attr-meta-media">meta</code>;
131981-
<code data-x="attr-source-media">source</code> (in <code>picture</code>);
131991+
<code data-x="attr-source-media">source</code>;
131982131992
<code data-x="attr-style-media">style</code>
131983131993
<td> Applicable media
131984131994
<td> <span>Valid media query list</span>

0 commit comments

Comments
 (0)