From 00d1285a2038e326246c5f5ff3bca7728f67925b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 10 Jul 2013 13:00:28 +0200 Subject: [PATCH] Remvoing wlxml class information from DocumentNodeElement --- modules/documentCanvas/canvas/canvas.test3.js | 2 ++ modules/documentCanvas/canvas/documentElement.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/documentCanvas/canvas/canvas.test3.js b/modules/documentCanvas/canvas/canvas.test3.js index e122a1a..3b251f6 100644 --- a/modules/documentCanvas/canvas/canvas.test3.js +++ b/modules/documentCanvas/canvas/canvas.test3.js @@ -103,6 +103,8 @@ describe('Canvas', function() { expect(section.getWlxmlClass()).to.equal('some.class'); section.setWlxmlClass('some.other.class'); expect(section.getWlxmlClass()).to.equal('some.other.class'); + section.setWlxmlClass(null); + expect(section.getWlxmlClass()).to.be.undefined; }); }); }); diff --git a/modules/documentCanvas/canvas/documentElement.js b/modules/documentCanvas/canvas/documentElement.js index e18f856..88287b8 100644 --- a/modules/documentCanvas/canvas/documentElement.js +++ b/modules/documentCanvas/canvas/documentElement.js @@ -112,10 +112,16 @@ $.extend(DocumentNodeElement.prototype, { this.$element.attr('wlxml-tag', tag); }, getWlxmlClass: function() { - return this.$element.attr('wlxml-class').replace('-', '.'); + var klass = this.$element.attr('wlxml-class'); + if(klass) + return klass.replace('-', '.'); + return undefined; }, setWlxmlClass: function(klass) { - this.$element.attr('wlxml-class', klass); + if(klass) + this.$element.attr('wlxml-class', klass); + else + this.$element.removeAttr('wlxml-class'); }, is: function(what) { if(what === 'list' && _.contains(['list-items', 'list-items-enum'], this.$element.attr('wlxml-class'))) -- 2.20.1