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 |