summaryrefslogtreecommitdiffstats
path: root/dom/html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/html')
-rw-r--r--dom/html/HTMLSlotElement.cpp11
-rw-r--r--dom/html/HTMLSlotElement.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/dom/html/HTMLSlotElement.cpp b/dom/html/HTMLSlotElement.cpp
index 18b8ef87b..1c17037af 100644
--- a/dom/html/HTMLSlotElement.cpp
+++ b/dom/html/HTMLSlotElement.cpp
@@ -168,6 +168,17 @@ HTMLSlotElement::AssignedNodes(const AssignedNodesOptions& aOptions,
aNodes = mAssignedNodes;
}
+void HTMLSlotElement::AssignedElements(const AssignedNodesOptions& aOptions,
+ nsTArray<RefPtr<Element>>& aElements) {
+ AutoTArray<RefPtr<nsINode>, 128> assignedNodes;
+ AssignedNodes(aOptions, assignedNodes);
+ for (const RefPtr<nsINode>& assignedNode : assignedNodes) {
+ if (assignedNode->IsElement()) {
+ aElements.AppendElement(assignedNode->AsElement());
+ }
+ }
+}
+
const nsTArray<RefPtr<nsINode>>&
HTMLSlotElement::AssignedNodes() const
{
diff --git a/dom/html/HTMLSlotElement.h b/dom/html/HTMLSlotElement.h
index 0494a654e..51affc2af 100644
--- a/dom/html/HTMLSlotElement.h
+++ b/dom/html/HTMLSlotElement.h
@@ -55,6 +55,9 @@ public:
void AssignedNodes(const AssignedNodesOptions& aOptions,
nsTArray<RefPtr<nsINode>>& aNodes);
+ void AssignedElements(const AssignedNodesOptions& aOptions,
+ nsTArray<RefPtr<Element>>& aNodes);
+
// Helper methods
const nsTArray<RefPtr<nsINode>>& AssignedNodes() const;
void InsertAssignedNode(uint32_t aIndex, nsINode* aNode);