public HtmlSelectable(string html, string relativeUri = null, bool removeOutboundLinks = true) { var document = new HtmlDocument { OptionAutoCloseOnEnd = true }; document.LoadHtml(html); if (!string.IsNullOrWhiteSpace(relativeUri)) { HtmlUtils.FixAllRelativeHref(document, relativeUri); if (removeOutboundLinks) { var host = new Uri(relativeUri).Host; var parts = host.Split('.'); var domainPattern = string.Join("\\.", parts); HtmlUtils.RemoveOutboundLinks(document, domainPattern); } } _node = document.DocumentNode; }