inline bool matchesTagName(const QualifiedName& tagName, const Element& element) { if (tagName == anyQName()) return true; if (element.hasLocalName(tagName.localName())) return true; // Non-html elements in html documents are normalized to their camel-cased // version during parsing if applicable. Yet, type selectors are lower-cased // for selectors in html documents. Compare the upper case converted names // instead to allow matching SVG elements like foreignObject. if (!element.isHTMLElement() && element.document().isHTMLDocument()) return element.tagQName().localNameUpper() == tagName.localNameUpper(); return false; }