From 37325f1bdcd7ab0678b842e66cf044badfdad71b Mon Sep 17 00:00:00 2001 From: Miha Zupan Date: Fri, 18 Jan 2019 18:27:58 +0100 Subject: [PATCH] Use existing Descantants(ContainerInline) implementation --- .../Syntax/MarkdownObjectExtensions.cs | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/Markdig/Syntax/MarkdownObjectExtensions.cs b/src/Markdig/Syntax/MarkdownObjectExtensions.cs index 4875ae09..64433392 100644 --- a/src/Markdig/Syntax/MarkdownObjectExtensions.cs +++ b/src/Markdig/Syntax/MarkdownObjectExtensions.cs @@ -77,29 +77,7 @@ namespace Markdig.Syntax /// An iteration over the descendant elements /// public static IEnumerable Descendants(this ContainerInline inline) where T : Inline - { - var child = inline.FirstChild; - while (child != null) - { - var next = child.NextSibling; - T childT = child as T; - if (childT != null) - { - yield return childT; - } - - ContainerInline subContainer = child as ContainerInline; - if (subContainer != null) - { - foreach (var sub in subContainer.Descendants()) - { - yield return sub; - } - } - - child = next; - } - } + => inline.FindDescendants(); /// /// Iterates over the descendant elements for the specified markdown element and filters by the type {T}.