Skip to content

Commit a2fa045

Browse files
committed
fix :class plain string order consistency
1 parent daab3c5 commit a2fa045

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/directives/internal/class.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ function setObjectClasses (el, obj) {
7272
function stringToObject (value) {
7373
var res = {}
7474
var keys = value.trim().split(/\s+/)
75-
var i = keys.length
76-
while (i--) {
75+
for (var i = 0, l = keys.length; i < l; i++) {
7776
res[keys[i]] = true
7877
}
7978
return res

test/unit/specs/directives/internal/class_spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ describe(':class', function () {
1313
dir.update('test')
1414
expect(el.className).toBe('haha test')
1515
dir.update('what now test')
16-
expect(el.className).toBe('haha test now what')
16+
expect(el.className).toBe('haha what now test')
1717
dir.update('ok cool')
18-
expect(el.className).toBe('haha cool ok')
18+
expect(el.className).toBe('haha ok cool')
1919
dir.update()
2020
expect(el.className).toBe('haha')
2121
})

0 commit comments

Comments
 (0)