LayoutFarm.WebDom.CssSimpleElementSelector.GetTopParentOrSelf C# (CSharp) Method

GetTopParentOrSelf() static private method

static private GetTopParentOrSelf ( CssSimpleElementSelector selector ) : CssElementSelector
selector CssSimpleElementSelector
return CssElementSelector
        static CssElementSelector GetTopParentOrSelf(CssSimpleElementSelector selector)
        {
            var parent = selector.Parent;
            if (parent == null)
            {
                return selector;
            }
            while (parent.Parent != null)
            {
                parent = parent.Parent;
            }
            return parent;
        }
    }