RESOLVED FIXED 215635
[CSS Selector] Unknown combinator is not addressed correctly in |CSSSelectorParser::consumeComplexSelector|
https://bugs.webkit.org/show_bug.cgi?id=215635
Summary [CSS Selector] Unknown combinator is not addressed correctly in |CSSSelectorP...
Joonghun Park
Reported 2020-08-18 18:34:26 PDT
CSS Selector unknown combinator is not addressed properly. For example, as in https://jsfiddle.net/zhp5o1a7/, if execute below code, <html> <style>@supports selector(A | .B) { #test {color: red}}</style> <div id="test">test</div> <script>console.log(CSS.supports("selector(A | .B)"));</script> </html> @supports selector(A | .B) function indicates that A | .B is supported css selector. If I put some printf statements like this, bool CSSSelectorParser::supportsComplexSelector(CSSParserTokenRange range, const CSSParserContext& context) { range.consumeWhitespace(); CSSSelectorParser parser(context, nullptr); printf("CSSSelectorParser::supportsComplexSelector: %s\n", range.serialize().utf8().data()); auto parserSelector = parser.consumeComplexSelector(range); if (parser.m_failedParsing || !range.atEnd() || !parserSelector) return false; auto complexSelector = parserSelector->releaseSelector(); printf("complexSelector: %s\n", complexSelector->value().string().utf8().data()); ASSERT(complexSelector); if (containsUnknownWebKitPseudoElements(*complexSelector)) return false; return true; } below logs are printed. CSSSelectorParser::supportsComplexSelector: A | .B complexSelector: B So, it seems that |CSSSelectorParser::consumeComplexSelector| doesn't address the unknown combinator correctly.
Attachments
Radar WebKit Bug Importer
Comment 1 2020-08-19 15:24:27 PDT
Ahmad Saleem
Comment 2 2023-05-12 09:29:38 PDT
I am able to reproduce this bug in WebKit ToT (mini browser), it shows 'red' text and in console, it shows 'true'. While Chrome Canary 115 and Firefox Nightly 115 show 'false' and not 'red' color text.
EWS
Comment 3 2023-05-19 04:51:21 PDT
Committed 264246@main (cef7548f6339): <https://commits.webkit.org/264246@main> Reviewed commits have been landed. Closing PR #14009 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.