You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<dfn for=ContainerQueryList>document</dfn> set on creation.
1793
+
1794
+
A {{ContainerQueryList}} object has an associated
1795
+
<dfn for=ContainerQueryList>container</dfn> which is the
1796
+
<a lt='serialize a container query list'>serialized</a>
1797
+
form of the associated [=ContainerQueryList/container query list=].
1798
+
1799
+
A {{ContainerQueryList}} object has an associated
1800
+
<dfn for=ContainerQueryList>matches state</dfn>
1801
+
which is true if the associated [=ContainerQueryList/container query list=]
1802
+
matches the state of the <a for=ContainerQueryList>document</a>, and false otherwise.
1803
+
1804
+
1805
+
When asked to <dfn export>evaluate container queries and report changes</dfn>
1806
+
for a {{Document}}<var>doc</var>, run these steps:
1807
+
1808
+
<ol>
1809
+
1810
+
<li>
1811
+
1812
+
For each {{ContainerQueryList}} object <var>target</var> that has <var>doc</var> as its <a for=ContainerQueryList>document</a>, in the order they were created, oldest first, run these substeps:
1813
+
1814
+
<ol>
1815
+
1816
+
<li>If <var>target</var>'s <a>matches state</a> has changed since the last time these steps were run,
1817
+
<a>fire an event</a> named <a event>change</a> at <var>target</var>
1818
+
using {{ContainerQueryListEvent}},
1819
+
with its {{Event/isTrusted}} attribute initialized to true,
1820
+
its {{ContainerQueryList/container}} attribute initialized to <var>target</var>'s <a>container</a>,
1821
+
and its {{ContainerQueryListEvent/matches}} attribute initialized to <var>target</var>'s <a>matches state</a>. <!--fingerprint-->
1822
+
1823
+
</ol>
1824
+
1825
+
</ol>
1826
+
1827
+
<div class='example'>
1828
+
A simple piece of code that detects changes in the overflow in any of a series of elements can be written as follows:
1829
+
1830
+
<pre highlight=javascript>
1831
+
function handleOverflowChange(event) {
1832
+
if(event.matches) // the thing overflowed
1833
+
…
1834
+
else
1835
+
…
1836
+
}
1837
+
var cql = matchContainer("(scroll-state(scrollable))");
1838
+
cql.onchange = handleOverflowChange;
1839
+
</pre>
1840
+
</div>
1841
+
1842
+
<pre class=idl>
1843
+
[Exposed=Window]
1844
+
interface ContainerQueryList : EventTarget {
1845
+
readonly attribute CSSOMString container;
1846
+
readonly attribute boolean matches;
1847
+
attribute EventHandler onchange;
1848
+
};
1849
+
</pre>
1850
+
1851
+
The <dfn attribute for=ContainerQueryList>container</dfn> attribute must return
1852
+
the associated <a>container</a>.
1853
+
1854
+
The <dfn attribute for=ContainerQueryList>matches</dfn> attribute must return
1855
+
the associated <a>matches state</a>. <!--fingerprint-->
1856
+
1857
+
The following are the <a>event handlers</a> (and their corresponding
1858
+
<a>event handler event types</a>) that must be supported, as
1859
+
<a>event handler IDL attributes</a>, by all objects implementing the
0 commit comments