mirror of
https://codeberg.org/setop/elm-scripting
synced 2025-11-08 21:49:57 +00:00
feat: can pass content as flags
This commit is contained in:
8
dom.js
8
dom.js
@@ -5,6 +5,11 @@ function Node(parent, tag) {
|
||||
this.text = null;
|
||||
// attributes are stored directly on the node object
|
||||
// see https://github.com/elm/virtual-dom/blob/master/src/Elm/Kernel/VirtualDom.js#L511
|
||||
// but Html.Attributes.attribute/2 uses Element.setAttribute
|
||||
this.setAttribute = (key, val) => {
|
||||
// as of now, there is no check if key conflict with the ones defined by Dom implementation
|
||||
this[key] = val;
|
||||
}
|
||||
this.children = []; // List of Node
|
||||
this.replaceChild = (newNode, domNode) => {
|
||||
this.children[domNode.pos-1] = newNode;
|
||||
@@ -16,6 +21,9 @@ function Node(parent, tag) {
|
||||
this.appendChild = (node) => {
|
||||
node.pos = this.children.push(node);
|
||||
}
|
||||
this.replaceData = (offset, count, data) => {
|
||||
this.text = data; // elm runtime will always replace the whole text
|
||||
}
|
||||
this.dump = (d=0) => {
|
||||
if (this.text != null) {
|
||||
print(this.text);
|
||||
|
||||
Reference in New Issue
Block a user