From b9acf02d4d0392e76db731e15bb40b6f4f199e50 Mon Sep 17 00:00:00 2001 From: Pauli Date: Tue, 21 Apr 2015 10:53:25 +0800 Subject: [PATCH 1/2] fix issue if there is not end space of className --- src/js/marka.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/js/marka.js b/src/js/marka.js index 4d9dc10..9c8e7ef 100644 --- a/src/js/marka.js +++ b/src/js/marka.js @@ -310,8 +310,7 @@ setTimeout(function() { // Change class - i.className = i.className.replace(' ', ' ').replace(/marka-icon-[\w-]+/, ''); - i.className += 'marka-icon-'+icon+' '; + i.className = i.className.replace(' ', ' ').replace(/marka-icon-[\w-]+/g, '') + ' marka-icon-'+icon; if ('sizeValue' in el) { i.setAttribute('style', 'width:'+el.sizeValue+'px;height:'+el.sizeValue+'px;'); @@ -320,7 +319,7 @@ // Show icon if it's not shown if (i.className.indexOf('marka-set') === -1) { setTimeout(function() { - i.className += 'marka-set '; + i.className += ' marka-set'; }, 200); } @@ -355,8 +354,7 @@ Marka.prototype.rotate = function(direction) { applyFunc(this.elements, function(i) { - i.className = i.className.replace(' ', ' ').replace(/marka-rotate-[\w]+/, ''); - i.className += 'marka-rotate-'+direction+' '; + i.className = i.className.replace(' ', ' ').replace(/marka-rotate-[\w]+/g, '') + ' marka-rotate-'+direction; }); return this; @@ -364,4 +362,4 @@ window.Marka = Marka; -})(window); \ No newline at end of file +})(window); From 25408ae54365867dd80e1f36e72293937c9bb769 Mon Sep 17 00:00:00 2001 From: Pauli Date: Tue, 21 Apr 2015 10:54:36 +0800 Subject: [PATCH 2/2] Update marka.js --- src/js/marka.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/marka.js b/src/js/marka.js index 9c8e7ef..d9e6ba4 100644 --- a/src/js/marka.js +++ b/src/js/marka.js @@ -265,7 +265,7 @@ setBackground(i); if (i.className.indexOf('marka') === -1) { - i.className += ' marka '; + i.className += ' marka'; } });