Skip to content

Commit 94f5b26

Browse files
committed
simplify media query listener model
1 parent f5342d5 commit 94f5b26

2 files changed

Lines changed: 32 additions & 64 deletions

File tree

cssom-view/Overview.html

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727

2828
<h1 id=cssom-view-module>CSSOM View Module</h1>
2929

30-
<h2 class="no-num no-toc" id=w3c-doctype>Editor's Draft 25 May 2010</h2>
30+
<h2 class="no-num no-toc" id=w3c-doctype>Editor's Draft 26 May 2010</h2>
3131

3232
<dl>
3333
<dt>This Version:
3434

3535
<dd><a
36-
href="http://www.w3.org/TR/2010/ED-cssom-view-20100525/">http://www.w3.org/TR/2010/ED-cssom-view-20100525/</a>
36+
href="http://www.w3.org/TR/2010/ED-cssom-view-20100526/">http://www.w3.org/TR/2010/ED-cssom-view-20100526/</a>
3737

3838
<dt>Latest Version:
3939

@@ -257,10 +257,9 @@ <h3 id=terminology><span class=secno>2.2. </span>Terminology</h3>
257257
<p><dfn id=mouseevent><code>MouseEvent</code></dfn> is defined in DOM Level
258258
2 Events. [<cite><a href="#ref-dom2events">DOM2Events</a></cite>]
259259

260-
<p> <dfn id=compare-media-queries>Compare media queries</dfn>, <dfn
261-
id=parse-a-media-query>parse a media query</dfn>, and <dfn
262-
id=serialize-a-media-query>serialize a media query</dfn> are defined by
263-
the CSSOM. [<cite><a href="#ref-cssom">CSSOM</a></cite>]
260+
<p> <dfn id=compare-media-queries>Compare media queries</dfn> and <dfn
261+
id=parse-a-media-query>parse a media query</dfn> are defined by the CSSOM.
262+
[<cite><a href="#ref-cssom">CSSOM</a></cite>]
264263

265264
<p> <dfn id=html-element>HTML element</dfn>, <dfn
266265
id=htmlelement><code>HTMLElement</code></dfn>, <dfn id=queue-a-task>queue
@@ -484,13 +483,13 @@ <h3 id=the-stylemedia-interface><span class=secno>4.1. </span>The <code
484483
readonly attribute DOMString <a href="#dom-stylemedia-type" title=dom-StyleMedia-type>type</a>;
485484
boolean <a href="#dom-stylemedia-matchmedium" title=dom-StyleMedia-matchMedium>matchMedium</a>(DOMString <var title="">medium</var>);
486485

487-
void <a href="#dom-StyleMedia-addMediumListener" title=dom-StyleMedia-addMediumListener>addMediumListener</a>(DOMString <var title="">medium</var>, <a href="#mediaquerycallback">MediaQueryCallback</a> <var title="">mediumcallback</var>);
488-
void <a href="#dom-StyleMedia-removeMediumListener" title=dom-StyleMedia-removeMediumListener>removeMediumListener</a>(DOMString <var title="">medium</var>, <a href="#mediaquerycallback">MediaQueryCallback</a> <var title="">mediumcallback</var>);
486+
void <a href="#dom-StyleMedia-addMediumListener" title=dom-StyleMedia-addMediumListener>addMediumListener</a>(DOMString <var title="">medium</var>, <a href="#booleancallback">BooleanCallback</a> <var title="">mediumcallback</var>);
487+
void <a href="#dom-StyleMedia-removeMediumListener" title=dom-StyleMedia-removeMediumListener>removeMediumListener</a>(DOMString <var title="">medium</var>, <a href="#booleancallback">BooleanCallback</a> <var title="">mediumcallback</var>);
489488
};
490489

491490
[Callback=FunctionOnly, NoInterfaceObject]
492-
interface <dfn id=mediaquerycallback>MediaQueryCallback</dfn> {
493-
void <span>handleEvent</span>(<a href="#mediaquerychange">MediaQueryChange</a> <var title="">mediaquerychange</var>);
491+
interface <dfn id=booleancallback>BooleanCallback</dfn> {
492+
void <span>handleEvent</span>(boolean <var title="">arg</var>);
494493
};</pre>
495494

496495
<p>The <dfn id=dom-stylemedia-type
@@ -537,9 +536,9 @@ <h3 id=the-stylemedia-interface><span class=secno>4.1. </span>The <code
537536
<pre><code>var isColorDevice = styleMedia.matchMedium("(color)")</code></pre>
538537
</div>
539538

540-
<p>Each <a href="#window"><code>Window</code></a> has an associated <dfn
541-
id=list-of-media-query-listeners>list of media query listeners</dfn>. Each
542-
listener consists of a media query and a callback.
539+
<p>Each <a href="#window"><code>Window</code></a> has an associated ordered
540+
<dfn id=list-of-media-query-listeners>list of media query listeners</dfn>.
541+
Each listener consists of a media query and a callback.
543542

544543
<p class=note>Due to the rules for <a
545544
href="#dom-StyleMedia-addMediumListener"><code
@@ -606,26 +605,10 @@ <h3 id=the-stylemedia-interface><span class=secno>4.1. </span>The <code
606605
changes in evaluation then for each media query of which the evaluation
607606
changes, in the order of the <a href="#list-of-media-query-listeners">list
608607
of media query listeners</a>, <a href="#queue-a-task">queue a task</a>
609-
that invokes the associated callback, passing as argument a <a
610-
href="#mediaquerychange"><code>MediaQueryChange</code></a> object.
611-
612-
<pre class=idl>[NoInterfaceObject]
613-
interface <dfn id=mediaquerychange>MediaQueryChange</dfn> {
614-
readonly attribute DOMString <a href="#dom-mediaquerychange-mediatext" title=dom-MediaQueryChange-mediaText>mediaText</a>;
615-
readonly attribute boolean <a href="#dom-mediaquerychange-matches" title=dom-MediaQueryChange-matches>matches</a>;
616-
};</pre>
617-
618-
<p>The <dfn id=dom-mediaquerychange-mediatext
619-
title=dom-MediaQueryChange-mediaText><code>mediaText</code></dfn>
620-
attribute <em class=ct>must</em> return a <a
621-
href="#serialize-a-media-query" title="serialize a media
622-
query">serialization</a> of the media query.
623-
624-
<p>The <dfn id=dom-mediaquerychange-matches
625-
title=dom-MediaQueryChange-matches><code>matches</code></dfn> attribute
626-
<em class=ct>must</em> return whether the media query matches the state of
627-
the rendered <a href="#document"><code>Document</code></a> at the time the
628-
<a href="#task">task</a> was <a href="#queue-a-task" title="queue a
608+
that invokes the associated callback, passing as argument whether the
609+
media query matches the state of the rendered <a
610+
href="#document"><code>Document</code></a> at the time the <a
611+
href="#task">task</a> was <a href="#queue-a-task" title="queue a
629612
task">queued</a>.
630613

631614
<h3 id=the-screen-interface><span class=secno>4.2. </span>The <code
@@ -1546,10 +1529,10 @@ <h2 class=no-num id=references>References</h2>
15461529
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>
15471530

15481531
<p>The editor would like to thank Alexey Feldgendler, Bj&ouml;rn
1549-
H&ouml;hrmann, David Vest, Garrett Smith, Hallvord R. M. Steen, Maciej
1550-
Stachowiak, Michael Dyck, Mike Wilson, Morten Stenshorne, Peter-Paul Koch,
1551-
Rachel Kmetz, Robert O'Callahan, Sam Weinig, Simon Pieters, Sylvain
1552-
Galineau, Tarquin Wilton-Jones, Thomas Moore, and Xiaomei
1532+
H&ouml;hrmann, David Vest, Garrett Smith, Hallvord R. M. Steen, Luiz
1533+
Agostini, Maciej Stachowiak, Michael Dyck, Mike Wilson, Morten Stenshorne,
1534+
Peter-Paul Koch, Rachel Kmetz, Robert O'Callahan, Sam Weinig, Simon
1535+
Pieters, Sylvain Galineau, Tarquin Wilton-Jones, Thomas Moore, and Xiaomei
15531536
Ji<!-- should actually use real name here --> for their contributions to
15541537
this document.
15551538

cssom-view/Overview.src.html

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ <h3 id="terminology">Terminology</h3>
128128
[<cite><span>DOM2Events</span></cite>]</p>
129129

130130
<p>
131-
<dfn>Compare media queries</dfn>,
132-
<dfn>parse a media query</dfn>, and
133-
<dfn>serialize a media query</dfn>
131+
<dfn>Compare media queries</dfn> and
132+
<dfn>parse a media query</dfn>
134133
are defined by the CSSOM. [<cite><span>CSSOM</span></cite>]</p>
135134

136135
<p>
@@ -348,13 +347,13 @@ <h3 id="the-stylemedia-interface">The <code title="">StyleMedia</code> Interface
348347
readonly attribute DOMString <span title="dom-StyleMedia-type">type</span>;
349348
boolean <span title="dom-StyleMedia-matchMedium">matchMedium</span>(DOMString <var title="">medium</var>);
350349

351-
void <span title="dom-StyleMedia-addMediumListener">addMediumListener</span>(DOMString <var title="">medium</var>, <span>MediaQueryCallback</span> <var title="">mediumcallback</var>);
352-
void <span title="dom-StyleMedia-removeMediumListener">removeMediumListener</span>(DOMString <var title="">medium</var>, <span>MediaQueryCallback</span> <var title="">mediumcallback</var>);
350+
void <span title="dom-StyleMedia-addMediumListener">addMediumListener</span>(DOMString <var title="">medium</var>, <span>BooleanCallback</span> <var title="">mediumcallback</var>);
351+
void <span title="dom-StyleMedia-removeMediumListener">removeMediumListener</span>(DOMString <var title="">medium</var>, <span>BooleanCallback</span> <var title="">mediumcallback</var>);
353352
};
354353

355354
[Callback=FunctionOnly, NoInterfaceObject]
356-
interface <dfn id="mediaquerycallback">MediaQueryCallback</dfn> {
357-
void <span>handleEvent</span>(<span>MediaQueryChange</span> <var title="">mediaquerychange</var>);
355+
interface <dfn id="booleancallback">BooleanCallback</dfn> {
356+
void <span>handleEvent</span>(boolean <var title="">arg</var>);
358357
};</pre>
359358

360359
<p>The
@@ -395,7 +394,7 @@ <h3 id="the-stylemedia-interface">The <code title="">StyleMedia</code> Interface
395394
<pre><code>var isColorDevice = styleMedia.matchMedium("(color)")</code></pre>
396395
</div>
397396

398-
<p>Each <code>Window</code> has an associated
397+
<p>Each <code>Window</code> has an associated ordered
399398
<dfn>list of media query listeners</dfn>. Each listener consists of a
400399
media query and a callback.</p>
401400

@@ -451,26 +450,11 @@ <h3 id="the-stylemedia-interface">The <code title="">StyleMedia</code> Interface
451450
<span>list of media query listeners</span> changes in evaluation then for
452451
each media query of which the evaluation changes, in the order of the
453452
<span>list of media query listeners</span>, <span>queue a task</span> that
454-
invokes the associated callback, passing as argument a
455-
<code>MediaQueryChange</code> object.</p>
456-
457-
<pre class="idl">[NoInterfaceObject]
458-
interface <dfn id="mediaquerychange">MediaQueryChange</dfn> {
459-
readonly attribute DOMString <span title="dom-MediaQueryChange-mediaText">mediaText</span>;
460-
readonly attribute boolean <span title="dom-MediaQueryChange-matches">matches</span>;
461-
};</pre>
453+
invokes the associated callback, passing as argument whether the
454+
media query matches the state of the rendered <code>Document</code> at the
455+
time the <span>task</span> was
456+
<span title="queue a task">queued</span>.</p>
462457

463-
<p>The
464-
<dfn id="dom-mediaquerychange-mediatext" title="dom-MediaQueryChange-mediaText"><code>mediaText</code></dfn>
465-
attribute <em class="ct">must</em> return a
466-
<span title="serialize a media query">serialization</span> of the
467-
media query.</p>
468-
469-
<p>The
470-
<dfn id="dom-mediaquerychange-matches" title="dom-MediaQueryChange-matches"><code>matches</code></dfn>
471-
attribute <em class="ct">must</em> return whether the media query matches
472-
the state of the rendered <code>Document</code> at the time the
473-
<span>task</span> was <span title="queue a task">queued</span>.</p>
474458

475459

476460
<h3 id="the-screen-interface">The <code title="">Screen</code> Interface</h3>
@@ -1334,6 +1318,7 @@ <h2 class="no-num">Acknowledgments</h2>
13341318
David Vest,
13351319
Garrett Smith,
13361320
Hallvord R. M. Steen,
1321+
Luiz Agostini,
13371322
Maciej Stachowiak,
13381323
Michael Dyck,
13391324
Mike Wilson,

0 commit comments

Comments
 (0)