/// <summary> /// Searches for the table which embedds the given element. /// If the start element is a TABLE element, this one is returned. /// </summary> public static HtmlTable FindEmbeddingTable(this IHtmlElement start) { start.Require(x => start != null); if (start.TagName == "TABLE") { return(new HtmlTable(start)); } var table = start.FindParent(p => p.TagName == "TABLE"); return(table == null ? null : new HtmlTable(table)); }
/// <summary> /// Returns the TR element embedding the given element. /// If the given element itself is a TR, this one is returned. /// </summary> public static IHtmlElement GetEmbeddingTR(IHtmlElement e) { e.Require(x => e != null); if (e.TagName == "TR") { return(e); } else { var parent = e.FindParent(p => p.TagName == "TR", p => e.IsTableOrTBody()); return(parent == null ? null : parent); } }
/// <summary> /// Returns the TR element embedding the given element. /// If the given element itself is a TR, this one is returned. /// </summary> public static IHtmlElement GetEmbeddingTR( IHtmlElement e ) { e.Require( x => e != null ); if ( e.TagName == "TR" ) { return e; } else { var parent = e.FindParent( p => p.TagName == "TR", p => e.IsTableOrTBody() ); return (parent == null ? null : parent); } }