Example #1
0
        public void HtmlChildrenNotAllowed()
        {
            Assert.IsTrue(HtmlData.HtmlChildrenNotAllowed("br"));
            Assert.IsTrue(HtmlData.HtmlChildrenNotAllowed("link"));

            Assert.IsTrue(HtmlData.HtmlChildrenNotAllowed("textarea"));
            Assert.IsTrue(HtmlData.HtmlChildrenNotAllowed("script"));
            Assert.IsTrue(HtmlData.HtmlChildrenNotAllowed("style"));

            Assert.IsFalse(HtmlData.HtmlChildrenNotAllowed("div"));
            Assert.IsFalse(HtmlData.HtmlChildrenNotAllowed("p"));
            Assert.IsFalse(HtmlData.HtmlChildrenNotAllowed("option"));
            Assert.IsFalse(HtmlData.HtmlChildrenNotAllowed("random"));
        }
        /// <summary>
        /// Renders all the children of the passed node.
        /// </summary>
        ///
        /// <param name="element">
        /// The element.
        /// </param>

        protected virtual void ParseChildren(IDomObject element)
        {
            if (element.HasChildren)
            {
                foreach (IDomObject el in element.ChildNodes.Reverse())
                {
                    NodeStackElement nodeStackEl = new NodeStackElement(el, el.NodeType == NodeType.TEXT_NODE && HtmlData.HtmlChildrenNotAllowed(element.NodeNameID), false);
                    OutputStack.Push(nodeStackEl);
                }
            }
        }