Commit 536c388f797d23a553f63806d14459218037fd1a
fix apply of classList
Matt McKegg committed on 7/8/2016, 3:00:51 AMParent: e75defac47630de9da141ca0ca89cba54a030464
Files changed
lib/apply-properties.js | changed |
lib/apply-properties.js | ||
---|---|---|
@@ -53,23 +53,22 @@ | ||
53 | 53 … | } |
54 | 54 … | } else if (key.slice(0, 3) === 'ev-') { |
55 | 55 … | target.addEventListener(key.slice(3), value, true) |
56 | 56 … | } else if (key === 'className' || key === 'classList') { |
57 | - if (Array.isArray(value)) { | |
58 | - value.forEach(function (v) { | |
57 … | + if (Array.isArray(valueOrObs)) { | |
58 … | + valueOrObs.forEach(function (v) { | |
59 | 59 … | classList.add(v) |
60 | 60 … | }) |
61 | 61 … | } else { |
62 | 62 … | classList.add(valueOrObs) |
63 | 63 … | } |
64 | 64 … | } else { |
65 | 65 … | target[key] = value |
66 … | + var obs = isObservable(valueOrObs) ? valueOrObs : null | |
67 … | + if (obs) { | |
68 … | + data.releases.push(bind(target, obs, key)) | |
69 … | + } | |
66 | 70 … | } |
67 | - | |
68 | - var obs = isObservable(valueOrObs) ? valueOrObs : null | |
69 | - if (obs) { | |
70 | - data.releases.push(bind(target, obs, key, namespace)) | |
71 | - } | |
72 | 71 … | } |
73 | 72 … | |
74 | 73 … | watch(classList, function (value) { |
75 | 74 … | value = [].concat.apply([], value).filter(present).join(' ') |
Built with git-ssb-web