-
Notifications
You must be signed in to change notification settings - Fork 0
/
dcis.js
67 lines (59 loc) · 1.86 KB
/
dcis.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var Component, dc;
module.exports = dc = require("domcom");
Component = dc.Component;
Component.prototype.publish = function(transport) {
return console.log("published");
};
Component.prototype.refresh = function(transport) {
return console.log("refresh");
};
Component.prototype.pull = function(transport) {};
Component.prototype.push = function(transport) {};
Text.prototype.push = function(transport) {};
Tag.prototype.processAttrs = function(attrs) {
var className, generator, handler, key, props, style, styles, v, v0, value, _i, _j, _len, _len1, _ref;
className = this.className, style = this.style, props = this.props;
for (key in attrs) {
value = attrs[key];
if (key === 'style') {
styles = styleFrom(value);
for (key in styles) {
value = styles[key];
this.setProp(key, value, style, 'Style');
}
} else if (key === 'class' || key === 'className') {
className.extend(value);
} else if (key.slice(0, 2) === 'on') {
if (!value) {
continue;
} else if (typeof value === 'function') {
this.bindOne(key, value);
} else {
v0 = value[0];
if (v0 === 'before' || v0 === 'after') {
_ref = value.slice(1);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
v = _ref[_i];
this.bindOne(key, v, v0 === 'before');
}
} else {
for (_j = 0, _len1 = value.length; _j < _len1; _j++) {
v = value[_j];
this.bindOne(key, v);
}
}
}
} else if (key[0] === '$') {
generator = directiveRegistry[key];
if (value instanceof Array) {
handler = generator.apply(null, value);
} else {
handler = generator.apply(null, [value]);
}
handler(this);
} else {
this.setProp(key, value, props, 'Props');
}
}
return this;
};