js.foresight-devtools
Version:
Visual debugging tools for ForesightJS - mouse trajectory prediction and element interaction visualization
17 lines (16 loc) • 595 B
JavaScript
export function createAndAppendElement(tag, parent, attributes) {
var element = document.createElement(tag);
if (attributes.id)
element.id = attributes.id;
if (attributes.className)
element.className = attributes.className;
if (attributes.data)
element.setAttribute("data-value", attributes.data);
return parent.appendChild(element);
}
export function createAndAppendStyle(styleSheet, parent, id) {
var element = document.createElement("style");
element.textContent = styleSheet;
element.id = id;
return parent.appendChild(element);
}