This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const reconcileProps = (vElement, element) => { | |
Object.keys(vElement.props).forEach(prop => { | |
const eventMatch = prop.match(/^on([A-Z]\w+)/); | |
if (eventMatch) { | |
// TODO: need a way to remove event listeners when they change or are removed | |
element.addEventListener(eventMatch[1].toLowerCase(), vElement.props[prop]); | |
} else if (element[prop] !== vElement.props[prop]) { | |
element[prop] = vElement.props[prop]; // eslint-disable-line no-param-reassign | |
} | |
}); |