mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 12:18:25 +00:00
LibWeb: Make empty media query lists evaluate to true
This commit is contained in:
@@ -51,10 +51,14 @@ String MediaQueryList::media() const
|
||||
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-matches
|
||||
bool MediaQueryList::matches() const
|
||||
{
|
||||
if (m_media.is_empty())
|
||||
return true;
|
||||
|
||||
for (auto& media : m_media) {
|
||||
if (media->matches())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,6 +68,9 @@ bool MediaQueryList::evaluate()
|
||||
if (!window)
|
||||
return false;
|
||||
|
||||
if (m_media.is_empty())
|
||||
return true;
|
||||
|
||||
bool now_matches = false;
|
||||
for (auto& media : m_media) {
|
||||
now_matches = now_matches || media->evaluate(*window);
|
||||
|
||||
Reference in New Issue
Block a user