-
Notifications
You must be signed in to change notification settings - Fork 0
/
setAttribute.js
46 lines (46 loc) · 1.01 KB
/
setAttribute.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module.exports = {
name: "setAttribute",
ns: "dom",
title: "Set Attribute",
async: true,
description: "Adds a new attribute or changes the value of an existing attribute on the specified element.",
expose: ["document"],
phrases: {
active: "Setting attribute: {{input.attribute}}"
},
ports: {
input: {
element: {
title: "Element",
type: "HTMLElement",
async: true,
fn: function __ELEMENT__(data, source, state, input, $, output) {
var r = function() {
$.element.setAttribute($.attribute, $.value);
output({
element: $.get('element')
});
}.call(this);
return {
state: state,
return: r
};
}
},
attribute: {
title: "Attribute",
type: "string"
},
value: {
title: "Value",
type: "string"
}
},
output: {
element: {
type: "HTMLElement"
}
}
},
state: {}
}