expect(c.doc().getWlxmlTag()).to.equal('section');
});
+ describe('root element', function() {
+ it('has no parent', function() {
+ var c = canvas.fromXML('<section></section>');
+ expect(c.doc().parent()).to.be.null;
+ });
+ });
+
describe('DocumentTextElement', function() {
it('can have its content set', function() {
var c = canvas.fromXML('<section>Alice</section>'),
return this.$element;
},
parent: function() {
- return documentElementFromHTMLElement(this.$element.parent()[0], this.canvas);
+ var parents = this.$element.parents('[wlxml-tag]');
+ if(parents.length)
+ return documentElementFromHTMLElement(parents[0], this.canvas);
+ return null;
},
sameNode: function(other) {