Remvoing wlxml class information from DocumentNodeElement
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 10 Jul 2013 11:00:28 +0000 (13:00 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 10 Jul 2013 11:00:28 +0000 (13:00 +0200)
modules/documentCanvas/canvas/canvas.test3.js
modules/documentCanvas/canvas/documentElement.js

index e122a1a..3b251f6 100644 (file)
@@ -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;
             });
         });
     });
index e18f856..88287b8 100644 (file)
@@ -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')))