children = c.doc().children();
expect(children.length).to.equal(1);
expect(children[0]).to.be.instanceOf(documentElement.DocumentNodeElement);
+
+ c = canvas.fromXML('<section><div></div><div></div></section>'),
+ children = c.doc().children();
+ expect(children.length).to.equal(2);
+ expect(children[0]).to.be.instanceOf(documentElement.DocumentNodeElement);
+ expect(children[1]).to.be.instanceOf(documentElement.DocumentNodeElement);
});
it('reports text nodes', function() {
var c = canvas.fromXML('<section>Alice</section>'),
var elementContent = this.$element.contents();
elementContent.each(function(idx) {
var element = documentElementFromHTMLElement(this);
- if(idx === 0 && elementContent.length > 1 && elementContent[1].nodeType === Node.ELEMENT_NODE && $.trim($(this).text()) === '')
+ if(idx === 0 && elementContent.length > 1 && elementContent[1].nodeType === Node.ELEMENT_NODE && (element instanceof DocumentTextElement) && $.trim($(this).text()) === '')
return true;
if(idx > 0 && element instanceof DocumentTextElement) {
if(toret[toret.length-1] instanceof DocumentNodeElement && $.trim($(this).text()) === '')