Exemplo n.º 1
0
 protected virtual bool IsSelectableElement(HtmlElement element)
 {
     return true; // (true || (element.Name.ToLower() != "body"));
 }
Exemplo n.º 2
0
        public ArrayList GetParentHierarchy(object o)
        {
            NativeMethods.IHTMLElement current = this.GetHtmlElement(o);
            if (current == null)
            {
                return null;
            }

            string tagName = current.GetTagName().ToLower();
            if (tagName.Equals("body"))
            {
                return null;
            }

            ArrayList ancestors = new ArrayList();

            current = current.GetParentElement();
            while ((current != null) && (current.GetTagName().ToLower().Equals("body") == false))
            {
                HtmlElement element = new HtmlElement(current, this.control);
                if (IsSelectableElement(element))
                {
                    ancestors.Add(element);
                }
                current = current.GetParentElement();
            }

            // Don't add the body tag to the hierarchy if we aren't in full document mode
            if (current != null)
            {
                HtmlElement element = new HtmlElement(current, this.control);
                if (IsSelectableElement(element))
                {
                    ancestors.Add(element);
                }
            }

            return ancestors;
        }