WebString canonicalizeSelector(WebString webSelector, WebSelectorType restriction)
{
    CSSSelectorList selectorList = CSSParser::parseSelector(strictCSSParserContext(), nullptr, webSelector);

    if (restriction == WebSelectorTypeCompound) {
        for (const CSSSelector* selector = selectorList.first(); selector; selector = selectorList.next(*selector)) {
            if (!selector->isCompound())
                return WebString();
        }
    }
    return selectorList.selectorsText();
}