| Index: Source/core/dom/ContainerNode.cpp
|
| diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
|
| index 7b16890ad209ea0002b0d0b750a6c7fd749dd882..2f162a0cb0305a279256f431cf7689ece6d524c5 100644
|
| --- a/Source/core/dom/ContainerNode.cpp
|
| +++ b/Source/core/dom/ContainerNode.cpp
|
| @@ -35,6 +35,7 @@
|
| #include "core/dom/NodeRareData.h"
|
| #include "core/dom/NodeRenderStyle.h"
|
| #include "core/dom/NodeTraversal.h"
|
| +#include "core/dom/SelectorQuery.h"
|
| #include "core/events/MutationEvent.h"
|
| #include "core/events/ThreadLocalEventNames.h"
|
| #include "core/html/HTMLCollection.h"
|
| @@ -910,6 +911,32 @@ Node *ContainerNode::childNode(unsigned index) const
|
| return n;
|
| }
|
|
|
| +PassRefPtr<Element> ContainerNode::querySelector(const AtomicString& selectors, ExceptionState& exceptionState)
|
| +{
|
| + if (selectors.isEmpty()) {
|
| + exceptionState.throwDOMException(SyntaxError, "The provided selector is empty.");
|
| + return 0;
|
| + }
|
| +
|
| + SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors, document(), exceptionState);
|
| + if (!selectorQuery)
|
| + return 0;
|
| + return selectorQuery->queryFirst(*this);
|
| +}
|
| +
|
| +PassRefPtr<NodeList> ContainerNode::querySelectorAll(const AtomicString& selectors, ExceptionState& exceptionState)
|
| +{
|
| + if (selectors.isEmpty()) {
|
| + exceptionState.throwDOMException(SyntaxError, "The provided selector is empty.");
|
| + return 0;
|
| + }
|
| +
|
| + SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors, document(), exceptionState);
|
| + if (!selectorQuery)
|
| + return 0;
|
| + return selectorQuery->queryAll(*this);
|
| +}
|
| +
|
| static void dispatchChildInsertionEvents(Node& child)
|
| {
|
| if (child.isInShadowTree())
|
|
|