Bug 189146 - Add assignedElements to HTMLSlotElement
Summary: Add assignedElements to HTMLSlotElement
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks: 148695
  Show dependency treegraph
 
Reported: 2018-08-29 22:30 PDT by Ryosuke Niwa
Modified: 2018-08-30 19:26 PDT (History)
10 users (show)

See Also:


Attachments
Adds the method (7.44 KB, patch)
2018-08-29 22:43 PDT, Ryosuke Niwa
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2018-08-29 22:30:09 PDT
Add a variant of assignedNodes which returns elements.
Added in https://github.com/whatwg/html/pull/2269.
Comment 1 Ryosuke Niwa 2018-08-29 22:43:33 PDT
Created attachment 348485 [details]
Adds the method
Comment 2 Radar WebKit Bug Importer 2018-08-29 22:44:31 PDT
<rdar://problem/43872965>
Comment 3 Darin Adler 2018-08-30 09:03:57 PDT
Comment on attachment 348485 [details]
Adds the method

View in context: https://bugs.webkit.org/attachment.cgi?id=348485&action=review

> Source/WebCore/html/HTMLSlotElement.h:43
>      Vector<Node*> assignedNodes(const AssignedNodesOptions&) const;
> +    Vector<Ref<Element>> assignedElements(const AssignedNodesOptions&) const;

Why does assignedNodes return Node* instead of Ref<Node>? Why not make the two consistent?
Comment 4 Ryosuke Niwa 2018-08-30 18:58:48 PDT
(In reply to Darin Adler from comment #3)
> Comment on attachment 348485 [details]
> Adds the method
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=348485&action=review
> 
> > Source/WebCore/html/HTMLSlotElement.h:43
> >      Vector<Node*> assignedNodes(const AssignedNodesOptions&) const;
> > +    Vector<Ref<Element>> assignedElements(const AssignedNodesOptions&) const;
> 
> Why does assignedNodes return Node* instead of Ref<Node>? Why not make the
> two consistent?

That's a good point. Since we're making a copy in both cases, we should probably always return Vector<Ref<~>>. Will fix before landing.
Comment 5 Ryosuke Niwa 2018-08-30 19:26:28 PDT
Committed r235535: <https://trac.webkit.org/changeset/235535>