AngleSharp by Florian Rappl

<PackageReference Include="AngleSharp" Version="0.9.1" />

.NET API 1,208,832 bytes

 HtmlSlotElement

Represents an HTML slot element.
using AngleSharp.Dom.Css; using AngleSharp.Extensions; using AngleSharp.Html; using System.Collections.Generic; using System.Linq; namespace AngleSharp.Dom.Html { internal sealed class HtmlSlotElement : HtmlElement, IHtmlSlotElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle { public string Name { get { return GetOwnAttribute(AttributeNames.Name); } set { SetOwnAttribute(AttributeNames.Name, value); } } public HtmlSlotElement(Document owner, string prefix = null) : base(owner, Tags.Slot, prefix, NodeFlags.None) { } public IEnumerable<INode> GetDistributedNodes() { IShadowRoot ancestor = this.GetAncestor<IShadowRoot>(); if (ancestor != null) { IElement host = ancestor.Host; List<INode> list = new List<INode>(); { foreach (INode childNode in host.ChildNodes) { if (object.ReferenceEquals(GetAssignedSlot(childNode), this)) { HtmlSlotElement htmlSlotElement = childNode as HtmlSlotElement; if (htmlSlotElement != null) list.AddRange(htmlSlotElement.GetDistributedNodes()); else list.Add(childNode); } } return list; } } return Enumerable.Empty<INode>(); } private static IElement GetAssignedSlot(INode node) { switch (node.NodeType) { case NodeType.Text: return ((IText)node).AssignedSlot; case NodeType.Element: return ((IElement)node).AssignedSlot; default: return null; } } } }