Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function applyAttrs(target, props) {
const events = {};
props = Object.assign({}, props);
Object.keys(props).forEach((key) => {
if(key.indexOf('on') === 0) {
const eventName = key.slice(2).toLowerCase();
events[eventName] = props[key];
delete props[key];
}
});
if(typeof target === 'string') target = createNode(target, props);
else target.attr(props);
Object.keys(events).forEach((key) => {
target.__originalEvents = target.__originalEvents || {};
target.off(key, target.__originalEvents[key]);
target.on(key, events[key]);
target.__originalEvents[key] = events[key];
});
return target;
}
export function createElement(tagName) {
return createNode(tagName)
}
export function createElementNS(namespaceURI, qualifiedName) {
export function createElementNS(namespaceURI, qualifiedName) {
return createNode(qualifiedName)
}
export function createTextNode(text) {