Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions cssom-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Former Editor: Glenn Adams, Cox Communications, Inc. http://www.cox.com, gle
Former Editor: Anne van Kesteren, Opera Software ASA http://www.opera.com, annevk@annevk.nl, https://annevankesteren.nl/
!Legacy issues list: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&amp;component=CSSOM&amp;resolution=---">Bugzilla</a>
Abstract: CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and of course CSS itself.
Ignored Terms: EmptyString, mediaText, cssText, InvalidCharacterError, SecurityError, SyntaxError, IndexSizeError, HierarchyRequestError, InvalidStateError, InvalidModificationError, NoModificationAllowedError, group of selectors, list of css page selectors, CSSCharsetRule, ProcessingInstruction, EventTarget, EventListener, Event, EventInit, Element, Range, Node, Text, style, CSSFontFaceRule, -webkit-transform
Ignored Terms: EmptyString, group of selectors, list of css page selectors, -webkit-transform
Ignored Vars: m1, m2, camel_cased_attribute, webkit_cased_attribute, dashed_attribute
Include Can I Use Panels: true
Can I Use URL: https://drafts.csswg.org/cssom/
Expand Down Expand Up @@ -107,7 +107,7 @@ urlPrefix: https://fetch.spec.whatwg.org/#concept-
spec:css-display-3; type:value; for:display; text:table
spec:css-color-4; type:property; text:color
spec:css-position-3; type:property; text:left
spec:html5; type:element; text:style
spec:html; type:element; text:style
spec:css-namespaces-3; type:dfn; text:namespace prefix
spec:dom; type:interface; text:Document
spec:html; type:dfn; text:ascii case-insensitive
Expand Down Expand Up @@ -309,18 +309,16 @@ typedef DOMString CSSOMString;
Media Queries {#media-queries}
==============================

Media queries are defined by the Media Queries specification. This
section defines various concepts around media queries, including their API
[=Media queries=] are defined by [[!MEDIAQUERIES]]. This
section defines various concepts around [=media queries=], including their API
and serialization form.

<!-- XXX ref -->


Parsing Media Queries {#parsing-media-queries}
----------------------------------------------

To <dfn export>parse a media query list</dfn> for a
given string <var>s</var> into a media query list is defined in
given string <var>s</var> into a [=media query list=] is defined in
the Media Queries specification. Return the list of media
queries that the algorithm defined there gives. <!-- XXX ref -->

Expand All @@ -345,25 +343,24 @@ To
run these steps:

<ol>
<li>If the media query list is empty, then return the empty string.
<li>If the [=media query list=] is empty, then return the empty string.

<li><a lt="serialize a media query">Serialize</a> each media query in the list of media queries, in the same order as they appear in the list of
media queries, and then <a lt="serialize a comma-separated list">serialize</a> the list.
<li><a lt="serialize a media query">Serialize</a> each media query in the list of media queries, in the same order as they appear in the [=media query list=], and then <a lt="serialize a comma-separated list">serialize</a> the list.
</ol>

To
<dfn export>serialize a media query</dfn> let
<var>s</var> be the empty string, run the steps below:

<ol>
<li>If the media query is negated append "<code>not</code>", followed
<li>If the [=media query=] is negated append "<code>not</code>", followed
by a single SPACE (U+0020), to <var>s</var>.

<li>Let <var>type</var> be the <a lt="serialize an identifier">serialization
as an identifier</a> of the media type of the media query,
as an identifier</a> of the [=media type=] of the [=media query=],
<a lt="ASCII lowercase">converted to ASCII lowercase</a>.

<li>If the media query does not contain media features append
<li>If the [=media query=] does not contain [=media features=] append
<var>type</var>, to <var>s</var>,
then return <var>s</var>.

Expand All @@ -372,13 +369,13 @@ To
single SPACE (U+0020), followed by "<code>and</code>", followed by a single SPACE
(U+0020), to <var>s</var>.

<li>Sort the media features in lexicographical order.
<li>Sort the [=media features=] in lexicographical order.

<li>
Then, for each media feature:
Then, for each [=media feature=]:

<ol>
<li>Append a "<code>(</code>" (U+0028), followed by the media feature
<li>Append a "<code>(</code>" (U+0028), followed by the [=media feature=]
name, <a lt="ASCII lowercase">converted to ASCII lowercase</a>,
to <var>s</var>.

Expand All @@ -390,7 +387,7 @@ To
<li>Append a "<code>)</code>" (U+0029) to
<var>s</var>.

<li>If this is not the last media feature append a single SPACE (U+0020),
<li>If this is not the last [=media feature=] append a single SPACE (U+0020),
followed by "<code>and</code>", followed by a single SPACE (U+0020), to
<var>s</var>.
</ol>
Expand Down