Handle shared attributes object in hyperscript (#1941)

This commit is contained in:
Ilya Sarantsev 2017-08-21 18:55:42 +03:00 committed by Pierre-Yves Gérardy
parent b38367aa30
commit 0986140ed5
3 changed files with 30 additions and 0 deletions

View file

@ -28,6 +28,18 @@ function execSelector(state, attrs, children) {
var hasAttrs = false, childList, text
var className = attrs.className || attrs.class
if (Object.keys(state.attrs).length && Object.keys(attrs).length) {
var newAttrs = {}
for(var key in attrs) {
if (hasOwn.call(attrs, key)) {
newAttrs[key] = attrs[key]
}
}
attrs = newAttrs
}
for (var key in state.attrs) {
if (hasOwn.call(state.attrs, key)) {
attrs[key] = state.attrs[key]