AngleSharp by AngleSharp

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

 DocumentRequestProcessor

using AngleSharp.Dom; using AngleSharp.Extensions; using AngleSharp.Services; using System.Threading; using System.Threading.Tasks; namespace AngleSharp.Network.RequestProcessors { internal sealed class DocumentRequestProcessor : BaseRequestProcessor { private readonly IDocument _parentDocument; private readonly IConfiguration _configuration; public IDocument ChildDocument { get; set; } private DocumentRequestProcessor(IDocument document, IConfiguration configuration, IResourceLoader loader) : base(loader) { _parentDocument = document; _configuration = configuration; } internal static DocumentRequestProcessor Create(Element element) { Document owner = element.Owner; IConfiguration options = owner.Options; IResourceLoader loader = owner.Loader; if (options == null || loader == null) return null; return new DocumentRequestProcessor(owner, options, loader); } protected override async Task ProcessResponseAsync(IResponse response) { BrowsingContext context = new BrowsingContext(_parentDocument.Context, Sandboxes.None); CreateDocumentOptions options = new CreateDocumentOptions(response, _configuration, _parentDocument); IDocument document2 = ChildDocument = await _configuration.GetFactory<IDocumentFactory>().CreateAsync(context, options, CancellationToken.None).ConfigureAwait(false); } } }