示例#1
0
        public void ParentsTextNode()
        {
            CQ dom = CQ.Create("<div>abc <a href=\"\">def</a> ghi</div>", HtmlParsingMode.Content);
            CQ textNodes = new CQ(dom.Select("*").Contents().Where(item => item.NodeType == NodeType.TEXT_NODE));
            
            var p = textNodes.Parents();

            CollectionAssert.AreEquivalent(
                new IDomObject[] { dom["div"][0], dom["a"][0] }, p
                );


        }