Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp

Issue 2505543004: Let querySelector(All) match (nth-)last with unclosed parent. (Closed)
Patch Set: Added expectation file Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/SelectorChecker.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
index 7c82d08268d3d0989ffb9ffd8d13fb2bcb1ce532..08bdb3565fd04e953f5d46a787dd43a299ece458 100644
--- a/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
+++ b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
@@ -6,6 +6,7 @@
#include "core/css/parser/CSSParser.h"
#include "core/dom/Document.h"
+#include "core/html/HTMLDocument.h"
#include "core/html/HTMLHtmlElement.h"
#include "testing/gtest/include/gtest/gtest.h"
#include <memory>
@@ -34,4 +35,22 @@ TEST(SelectorQueryTest, NotMatchingPseudoElement) {
EXPECT_NE(nullptr, elm);
}
+TEST(SelectorQueryTest, LastOfTypeNotFinishedParsing) {
+ Document* document = HTMLDocument::create();
+ HTMLHtmlElement* html = HTMLHtmlElement::create(*document);
+ document->appendChild(html);
+ document->documentElement()->setInnerHTML(
+ "<body><p></p><p id=last></p></body>", ASSERT_NO_EXCEPTION);
+
+ document->body()->beginParsingChildren();
+
+ CSSSelectorList selectorList = CSSParser::parseSelector(
+ CSSParserContext(*document, nullptr), nullptr, "p:last-of-type");
+ std::unique_ptr<SelectorQuery> query =
+ SelectorQuery::adopt(std::move(selectorList));
+ Element* elm = query->queryFirst(*document);
+ ASSERT_TRUE(elm);
+ EXPECT_EQ("last", elm->idForStyleResolution());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/SelectorChecker.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698