jeefo_component
Advanced tools
Comparing version 0.0.8 to 0.0.9
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
* File Name : collect_components.js | ||
* Created at : 2017-08-10 | ||
* Updated at : 2017-09-13 | ||
* Updated at : 2017-09-14 | ||
* Author : jeefo | ||
@@ -12,2 +12,3 @@ * Purpose : | ||
parser = require("jeefo_template/parser"), | ||
shived = {}, | ||
Directive = require("./directive"), | ||
@@ -20,14 +21,2 @@ Component = require("./component"), | ||
combine_pairs = function (pairs, other) { | ||
for (var i = 0, keys = other.keys; i < keys.length; ++i) { | ||
pairs.set(keys[i], other.values[keys[i]]); | ||
} | ||
}, | ||
combine_classes = function (class_list, other_list) { | ||
for (var i = 0; i < other_list.length; ++i) { | ||
class_list.add(other_list[i]); | ||
} | ||
}, | ||
transclude = function (nodes, children) { | ||
@@ -71,10 +60,3 @@ transcluder.find(nodes); | ||
var nodes = parser(template), other = nodes[0]; | ||
// Reason why other's property first is, we want keep other's order | ||
combine_pairs(other.attrs, node.attrs); | ||
combine_pairs(other.events, node.events); | ||
combine_classes(other.class_list, node.class_list.list); | ||
return other; | ||
return parser(template); | ||
}; | ||
@@ -84,3 +66,3 @@ | ||
var i = 0, component = new Component(parent), | ||
j, keys, name, attrs, other, _parent, directive; | ||
j, keys, name, attrs, others, _parent, directive; | ||
@@ -116,13 +98,10 @@ for (; i < nodes.length; ++i) { | ||
other = combine_template(component.definition.template || "div", nodes[i]); | ||
if (component.definition.template) { | ||
others = combine_template(component.definition.template, nodes[i]); | ||
if (nodes[i] !== other) { | ||
if (other.children.length) { | ||
transclude(other.children, nodes[i].children); | ||
} else { | ||
other.children = nodes[i].children; | ||
if (nodes[i] !== others) { | ||
transclude(others, nodes[i].children); | ||
nodes[i].children = others; | ||
} | ||
} | ||
nodes[i] = other; | ||
} | ||
@@ -142,2 +121,10 @@ | ||
if (component.name && ! shived[component.name]) { | ||
document.createElement(component.name); | ||
shived[component.name] = true; | ||
} | ||
if (! nodes[i].name) { | ||
nodes[i].name = component.name || "div"; | ||
} | ||
if (component.name || nodes[i].events.keys.length || component.directives.length) { | ||
@@ -144,0 +131,0 @@ counter.increment(); |
{ | ||
"name": "jeefo_component", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Part of jeefo framework", | ||
@@ -5,0 +5,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34248
1114