diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 15d3f785b6e..dd82ec8cea8 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1124,6 +1124,10 @@ impl<'le> TElement for GeckoElement<'le> { where F: FnMut(&Atom), { + if !self.may_have_class() { + return; + } + snapshot_helpers::each_class(self.0, callback, Gecko_ClassOrClassList) }