Esempio n. 1
0
        static bool ProcessElement(DomNode item)
        {
            // Always retain html > head and doctype
            // (Unfortunately, we must since we can't tell whether the
            // document is being used as a master.)
            if (item.NodeType == DomNodeType.DocumentType)
            {
                item.Retain();
                return(true);
            }
            if (item.NodeName == "head")
            {
                item.Retain();

                // TODO Head can be retained in such a way that its
                // children don't need retaining (performance)
                foreach (var m in ((DomElement)item).Elements)
                {
                    m.Retain();
                }
                return(true);
            }
            if (ConsiderChildren(item) ||
                (item.IsElement && item is HxlElement))
            {
                item.Retain();
                return(true);
            }
            else
            {
                return(false);
            }
        }