Skip to content

Commit b0b525e

Browse files
author
Simon Pieters
committed
[cssom-view] Hide MediaQueryListEvent from workers. Avoid invoking DOM's methods directly. Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=25304
1 parent ab1e448 commit b0b525e

File tree

2 files changed

+46
-18
lines changed

2 files changed

+46
-18
lines changed

cssom-view/Overview.html

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<h1>CSSOM View Module</h1>
1818

19-
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 7 June 2014</h2>
19+
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 9 June 2014</h2>
2020

2121
<dl>
2222

@@ -83,7 +83,7 @@ <h2 class="no-num no-toc" id="sotd">Status of This Document</h2>
8383
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
8484
index at http://www.w3.org/TR/.</a></em>
8585

86-
<p>This is the 7 June 2014 Editor's Draft of CSSOM View. Please send
86+
<p>This is the 9 June 2014 Editor's Draft of CSSOM View. Please send
8787
comments to
8888
<a href="mailto:www-style@w3.org?subject=%5Bcssom-view%5D%20">www-style@w3.org</a>
8989
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
@@ -866,13 +866,28 @@ <h3 id="the-mediaquerylist-interface"><span class="secno">5.2 </span>The <code t
866866
<p>The <dfn id="dom-mediaquerylist-matches" title="dom-MediaQueryList-matches"><code>matches</code></dfn> attribute must return
867867
the associated <a href="#concept-mediaquerylist-matches" title="concept-MediaQueryList-matches">matches state</a>. <!--fingerprint--></p>
868868

869-
<p>When the <dfn id="dom-mediaquerylist-addlistener" title="dom-MediaQueryList-addListener"><code>addListener(<var>listener</var>)</code></dfn> method is invoked
870-
the user agent must invoke the <code class="external" data-anolis-spec="dom" title="dom-EventTarget-addEventListener"><a href="http://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener">addEventListener</a></code> method
871-
with <code title="">change</code> as the first argument and <var>listener</var> as the second argument.</p>
869+
<p>The <dfn id="dom-mediaquerylist-addlistener" title="dom-MediaQueryList-addListener"><code>addListener(<var>listener</var>)</code></dfn> method must run these steps:</p>
872870

873-
<p>When the <dfn id="dom-mediaquerylist-removelistener" title="dom-MediaQueryList-removeListener"><code>removeListener(<var>listener</var>)</code></dfn> method is invoked
874-
the user agent must invoke the <code class="external" data-anolis-spec="dom" title="dom-EventTarget-removeEventListener"><a href="http://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener">removeEventListener</a></code> method
875-
with <code title="">change</code> as the first argument and <var>listener</var> as the second argument.</p>
871+
<ol>
872+
<li><p>If <var title="">listener</var> is null, terminate these steps.
873+
<li><p>Append an <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listener</a>
874+
to the associated list of
875+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listeners</a> with <b>type</b>
876+
set to <code title="">change</code>, <b>callback</b> set to <var title="">listener</var>, and
877+
<b>capture</b> set to false, unless there
878+
already is an <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listener</a> in
879+
that list with the same <b>type</b>, <b>callback</b>, and <b>capture</b>.
880+
</ol>
881+
882+
<p>The <dfn id="dom-mediaquerylist-removelistener" title="dom-MediaQueryList-removeListener"><code>removeListener(<var>listener</var>)</code></dfn> method must run these steps:</p>
883+
884+
<ol>
885+
<li><p>Remove an <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listener</a>
886+
from the associated list of
887+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listeners</a>, whose
888+
<b>type</b> is <code title="">change</code>, <b>callback</b> is <var title="">listener</var>, and
889+
<b>capture</b> is false.</p>
890+
</ol>
876891

877892
<p class="note">This specification initially had a custom callback mechanism with <code title="dom-MediaQueryList-addListener"><a href="#dom-mediaquerylist-addlistener">addListener</a></code> and
878893
<code title="dom-MediaQueryList-removeListener"><a href="#dom-mediaquerylist-removelistener">removeListener</a></code>, and the callback was invoked with the associated media query list as argument.
@@ -900,8 +915,7 @@ <h3 id="the-mediaquerylist-interface"><span class="secno">5.2 </span>The <code t
900915
</tbody>
901916
</table>
902917

903-
<pre class="idl">[<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-event-constructor" title="concept-event-constructor">Constructor</a>(DOMString type, optional <a href="#mediaquerylisteventinit">MediaQueryListEventInit</a> eventInitDict),
904-
Exposed=Window,Worker]
918+
<pre class="idl">[<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-event-constructor" title="concept-event-constructor">Constructor</a>(DOMString type, optional <a href="#mediaquerylisteventinit">MediaQueryListEventInit</a> eventInitDict)]
905919
interface <dfn id="mediaquerylistevent">MediaQueryListEvent</dfn> : <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#event">Event</a> {
906920
readonly attribute DOMString <a href="#dom-mediaquerylistevent-media" title="dom-MediaQueryListEvent-media">media</a>;
907921
readonly attribute boolean <a href="#dom-mediaquerylistevent-matches" title="dom-MediaQueryListEvent-matches">matches</a>;

cssom-view/Overview.src.html

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -823,13 +823,28 @@ <h3>The <code title>MediaQueryList</code> Interface</h3>
823823
<p>The <dfn title=dom-MediaQueryList-matches><code>matches</code></dfn> attribute must return
824824
the associated <span title=concept-MediaQueryList-matches>matches state</span>. <!--fingerprint--></p>
825825

826-
<p>When the <dfn title=dom-MediaQueryList-addListener><code>addListener(<var>listener</var>)</code></dfn> method is invoked
827-
the user agent must invoke the <code data-anolis-spec=dom title=dom-EventTarget-addEventListener>addEventListener</code> method
828-
with <code title>change</code> as the first argument and <var>listener</var> as the second argument.</p>
826+
<p>The <dfn title=dom-MediaQueryList-addListener><code>addListener(<var>listener</var>)</code></dfn> method must run these steps:</p>
829827

830-
<p>When the <dfn title=dom-MediaQueryList-removeListener><code>removeListener(<var>listener</var>)</code></dfn> method is invoked
831-
the user agent must invoke the <code data-anolis-spec=dom title=dom-EventTarget-removeEventListener>removeEventListener</code> method
832-
with <code title>change</code> as the first argument and <var>listener</var> as the second argument.</p>
828+
<ol>
829+
<li><p>If <var title="">listener</var> is null, terminate these steps.
830+
<li><p>Append an <span data-anolis-spec=dom title="concept-event-listener">event listener</span>
831+
to the associated list of
832+
<span data-anolis-spec=dom title="concept-event-listener">event listeners</span> with <b>type</b>
833+
set to <code title>change</code>, <b>callback</b> set to <var title="">listener</var>, and
834+
<b>capture</b> set to false, unless there
835+
already is an <span data-anolis-spec=dom title="concept-event-listener">event listener</span> in
836+
that list with the same <b>type</b>, <b>callback</b>, and <b>capture</b>.
837+
</ol>
838+
839+
<p>The <dfn title=dom-MediaQueryList-removeListener><code>removeListener(<var>listener</var>)</code></dfn> method must run these steps:</p>
840+
841+
<ol>
842+
<li><p>Remove an <span data-anolis-spec=dom title="concept-event-listener">event listener</span>
843+
from the associated list of
844+
<span data-anolis-spec=dom title="concept-event-listener">event listeners</span>, whose
845+
<b>type</b> is <code title>change</code>, <b>callback</b> is <var title="">listener</var>, and
846+
<b>capture</b> is false.</p>
847+
</ol>
833848

834849
<p class=note>This specification initially had a custom callback mechanism with <code title=dom-MediaQueryList-addListener>addListener</code> and
835850
<code title=dom-MediaQueryList-removeListener>removeListener</code>, and the callback was invoked with the associated media query list as argument.
@@ -857,8 +872,7 @@ <h3>The <code title>MediaQueryList</code> Interface</h3>
857872
</tbody>
858873
</table>
859874

860-
<pre class=idl>[<span data-anolis-spec=dom title=concept-event-constructor>Constructor</span>(DOMString type, optional <span>MediaQueryListEventInit</span> eventInitDict),
861-
Exposed=Window,Worker]
875+
<pre class=idl>[<span data-anolis-spec=dom title=concept-event-constructor>Constructor</span>(DOMString type, optional <span>MediaQueryListEventInit</span> eventInitDict)]
862876
interface <dfn>MediaQueryListEvent</dfn> : <span data-anolis-spec=dom>Event</span> {
863877
readonly attribute DOMString <span title=dom-MediaQueryListEvent-media>media</span>;
864878
readonly attribute boolean <span title=dom-MediaQueryListEvent-matches>matches</span>;

0 commit comments

Comments
 (0)