Skip to content

Commit 212391c

Browse files
committed
More partial work on cssom-view.
1 parent e659ace commit 212391c

1 file changed

Lines changed: 64 additions & 62 deletions

File tree

cssom-view/Overview.bs

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -700,70 +700,68 @@ When asked to <dfn>evaluate media queries and report changes</dfn> for a {{Docum
700700
</ol>
701701

702702
<div class='example'>
703-
A simple piece of code that detects changes in the orientation of the viewport can be written as follows:
704-
<pre>function handleOrientationChange(event) {
705-
if(event.matches) // landscape
706-
&hellip;
707-
else
708-
&hellip;
709-
}
710-
var mql = matchMedia("(orientation:landscape)")
711-
mql.onchange = handleOrientationChange</pre>
703+
A simple piece of code that detects changes in the orientation of the viewport can be written as follows:
704+
705+
<pre>
706+
function handleOrientationChange(event) {
707+
if(event.matches) // landscape
708+
&hellip;
709+
else
710+
&hellip;
711+
}
712+
var mql = matchMedia("(orientation:landscape)");
713+
mql.onchange = handleOrientationChange;</pre>
712714
</div>
713715

714-
<pre class=idl>interface <dfn>MediaQueryList</dfn> : <span data-anolis-spec=dom>EventTarget</span> {
715-
readonly attribute DOMString <span title=dom-MediaQueryList-media>media</span>;
716-
readonly attribute boolean <span title=dom-MediaQueryList-matches>matches</span>;
717-
void <span title=dom-MediaQueryList-addListener>addListener</span>(<span data-anolis-spec=dom>EventListener</span>? listener);
718-
void <span title=dom-MediaQueryList-removeListener>removeListener</span>(<span data-anolis-spec=dom>EventListener</span>? listener);
719-
attribute <span data-anolis-spec=html>EventHandler</span> onchange;
720-
};</pre>
716+
<pre class=idl>
717+
interface MediaQueryList : EventTarget {
718+
readonly attribute DOMString media;
719+
readonly attribute boolean matches;
720+
void addListener(EventListener? listener);
721+
void removeListener(EventListener? listener);
722+
attribute EventHandler onchange;
723+
};
724+
</pre>
721725

722-
The <dfn title=dom-MediaQueryList-media><code>media</dfn> attribute must return
726+
The <dfn attribute for=MediaQueryList>media</dfn> attribute must return
723727
the associated <span title=concept-MediaQueryList-media>media</span>.
724728

725-
The <dfn title=dom-MediaQueryList-matches><code>matches</dfn> attribute must return
729+
The <dfn attribute for=MediaQueryList>matches</dfn> attribute must return
726730
the associated <a concept>matches state</a>. <!--fingerprint-->
727731

728-
The <dfn title=dom-MediaQueryList-addListener><code>addListener(<var>listener</var>)</dfn> method must run these steps:
732+
The <dfn method for=MediaQueryList>addListener(<var>listener</var>)</dfn> method must run these steps:
729733

730-
<ol>
731-
<li>If <var title="">listener</var> is null, terminate these steps.
732-
<li>Append an <span data-anolis-spec=dom title="concept-event-listener">event listener</span>
733-
to the associated list of
734-
<span data-anolis-spec=dom title="concept-event-listener">event listeners</span> with <b>type</b>
735-
set to <code>change</code>, <b>callback</b> set to <var title="">listener</var>, and
736-
<b>capture</b> set to false, unless there
737-
already is an <span data-anolis-spec=dom title="concept-event-listener">event listener</span> in
738-
that list with the same <b>type</b>, <b>callback</b>, and <b>capture</b>.
739-
</ol>
734+
1. If <var>listener</var> is null, terminate these steps.
735+
2. Append an <a>event listener</a> to the associated list of <a>event listeners</a>
736+
with <b>type</b> set to <code>change</code>,
737+
<b>callback</b> set to <var>listener</var>,
738+
and <b>capture</b> set to false,
739+
unless there already is an <a>event listener</a> in that list
740+
with the same <b>type</b>, <b>callback</b>, and <b>capture</b>.
740741

741-
The <dfn title=dom-MediaQueryList-removeListener><code>removeListener(<var>listener</var>)</dfn> method must run these steps:
742+
The <dfn method for=MediaQueryList>removeListener(<var>listener</var>)</dfn> method must run these steps:
742743

743-
<ol>
744-
<li>Remove an <span data-anolis-spec=dom title="concept-event-listener">event listener</span>
745-
from the associated list of
746-
<span data-anolis-spec=dom title="concept-event-listener">event listeners</span>, whose
747-
<b>type</b> is <code>change</code>, <b>callback</b> is <var title="">listener</var>, and
748-
<b>capture</b> is false.
749-
</ol>
744+
1. Remove an <a>event listener</a> from the associated list of <a>event listeners</a>,
745+
whose <b>type</b> is <code>change</code>,
746+
<b>callback</b> is <var>listener</var>,
747+
and <b>capture</b> is false.
750748

751-
<p class=note>This specification initially had a custom callback mechanism with <code title=dom-MediaQueryList-addListener>addListener</code> and
752-
<code title=dom-MediaQueryList-removeListener>removeListener</code>, and the callback was invoked with the associated media query list as argument.
749+
Note: This specification initially had a custom callback mechanism with {{addListener()}} and
750+
{{removeListener()}}, and the callback was invoked with the associated media query list as argument.
753751
Now the normal event mechanism is used instead.
754-
For backwards compatibility, the <code title=dom-MediaQueryList-addListener>addListener</code> and <code title=dom-MediaQueryList-removeListener>removeListener</code> methods
755-
are basically aliases for <code data-anolis-spec=dom title=dom-EventTarget-addEventListener>addEventListener</code> and <code data-anolis-spec=dom title=dom-EventTarget-removeEventListener>removeEventListener</code>, respectively,
752+
For backwards compatibility, the {{addListener()}} and {{removeListener()}} methods
753+
are basically aliases for {{addEventListener()}} and {{removeEventListener()}}, respectively,
756754
and the <code>change</code> event masquerades as a {{MediaQueryList}}.
757755

758-
The following are the <span data-anolis-spec=html>event handlers</span>
759-
(and their corresponding <span data-anolis-spec=html title="event handler event type">event handler event types</span>) that must be supported,
760-
as <span data-anolis-spec=html>event handler IDL attributes</span>, by all objects implementing the {{MediaQueryList}} interface:
756+
The following are the <a>event handlers</a>
757+
(and their corresponding <a>event handler event types</a>) that must be supported,
758+
as <a>event handler IDL attributes</a>, by all objects implementing the {{MediaQueryList}} interface:
761759

762760
<table class="complex data">
763761
<thead>
764762
<tr>
765-
<th><span data-anolis-spec=html title="event handlers">Event handler</span>
766-
<th><span data-anolis-spec=html>Event handler event type</span>
763+
<th><a>Event handler</a>
764+
<th><a>Event handler event type</a>
767765

768766

769767
<tbody>
@@ -774,33 +772,37 @@ as <span data-anolis-spec=html>event handler IDL attributes</span>, by all objec
774772

775773
</table>
776774

777-
<pre class=idl>[<span data-anolis-spec=dom title=concept-event-constructor>Constructor</span>(DOMString type, optional <span>MediaQueryListEventInit</span> eventInitDict)]
778-
interface <dfn>MediaQueryListEvent</dfn> : <span data-anolis-spec=dom>Event</span> {
779-
readonly attribute DOMString <span title=dom-MediaQueryListEvent-media>media</span>;
780-
readonly attribute boolean <span title=dom-MediaQueryListEvent-matches>matches</span>;
775+
<pre class=idl>
776+
[Constructor(DOMString type, optional MediaQueryListEventInit eventInitDict)]
777+
interface MediaQueryListEvent : Event {
778+
readonly attribute DOMString media;
779+
readonly attribute boolean matches;
781780
};
782781

783-
dictionary <dfn>MediaQueryListEventInit</dfn> : <span data-anolis-spec=dom>EventInit</span> {
782+
dictionary MediaQueryListEventInit : EventInit {
784783
DOMString media = "";
785784
boolean matches = false;
786-
};</pre>
785+
};
786+
</pre>
787787

788-
The <dfn title=dom-MediaQueryListEvent-media><code>media</dfn> attribute must return the value it was initialized to.
788+
The <dfn attribute for=MediaQueryListEvent>media</dfn> attribute must return the value it was initialized to.
789789

790-
The <dfn title=dom-MediaQueryListEvent-matches><code>matches</dfn> attribute must return the value it was initialized to.
790+
The <dfn attribute for=MediaQueryListEvent>matches</dfn> attribute must return the value it was initialized to.
791791

792792
<h3>The <code>Screen</code> Interface</h3>
793793

794794
As its name suggests, the <code>Screen</code> interface represents information about the screen of the output device.
795795

796-
<pre class=idl>interface <dfn>Screen</dfn> {
797-
readonly attribute double <span title=dom-Screen-availWidth>availWidth</span>;
798-
readonly attribute double <span title=dom-Screen-availHeight>availHeight</span>;
799-
readonly attribute double <span title=dom-Screen-width>width</span>;
800-
readonly attribute double <span title=dom-Screen-height>height</span>;
801-
readonly attribute unsigned long <span title=dom-Screen-colorDepth>colorDepth</span>;
802-
readonly attribute unsigned long <span title=dom-Screen-pixelDepth>pixelDepth</span>;
803-
};</pre>
796+
<pre class=idl>
797+
interface Screen {
798+
readonly attribute double availWidth;
799+
readonly attribute double availHeight;
800+
readonly attribute double width;
801+
readonly attribute double height;
802+
readonly attribute unsigned long colorDepth;
803+
readonly attribute unsigned long pixelDepth;
804+
};
805+
</pre>
804806

805807
The <dfn title=dom-Screen-availWidth><code>availWidth</dfn> attribute must return the available width of the rendering surface of the output device,
806808
in CSS pixels. <!--fingerprint-->

0 commit comments

Comments
 (0)