|
|
@ -4,16 +4,6 @@ define([], function () {
|
|
|
|
return Object.prototype.toString.call(A)==='[object Array]';
|
|
|
|
return Object.prototype.toString.call(A)==='[object Array]';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var parseStyle = function(el){
|
|
|
|
|
|
|
|
var style = el.style;
|
|
|
|
|
|
|
|
var output = {};
|
|
|
|
|
|
|
|
for (var i = 0; i < style.length; ++i) {
|
|
|
|
|
|
|
|
var item = style.item(i);
|
|
|
|
|
|
|
|
output[item] = style[item];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return output;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var callOnHyperJSON = function (hj, cb) {
|
|
|
|
var callOnHyperJSON = function (hj, cb) {
|
|
|
|
var children;
|
|
|
|
var children;
|
|
|
|
|
|
|
|
|
|
|
@ -23,9 +13,7 @@ define([], function () {
|
|
|
|
// if the child is an array, recurse
|
|
|
|
// if the child is an array, recurse
|
|
|
|
return callOnHyperJSON(child, cb);
|
|
|
|
return callOnHyperJSON(child, cb);
|
|
|
|
} else if (typeof (child) === 'string') {
|
|
|
|
} else if (typeof (child) === 'string') {
|
|
|
|
// string nodes have leading and trailing quotes
|
|
|
|
return child;
|
|
|
|
// don't strip them!
|
|
|
|
|
|
|
|
return child; //child.replace(/(^"|"$)/g,"");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// the above branches should cover all methods
|
|
|
|
// the above branches should cover all methods
|
|
|
|
// if we hit this, there is a problem
|
|
|
|
// if we hit this, there is a problem
|
|
|
@ -39,16 +27,6 @@ define([], function () {
|
|
|
|
return cb(hj[0], hj[1], children);
|
|
|
|
return cb(hj[0], hj[1], children);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var classify = function (token) {
|
|
|
|
|
|
|
|
return '.' + token.trim();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var isValidClass = function (x) {
|
|
|
|
|
|
|
|
if (x && /\S/.test(x)) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var isTruthy = function (x) {
|
|
|
|
var isTruthy = function (x) {
|
|
|
|
return x;
|
|
|
|
return x;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -71,15 +49,10 @@ define([], function () {
|
|
|
|
|
|
|
|
|
|
|
|
var i = 0;
|
|
|
|
var i = 0;
|
|
|
|
for(;i < el.attributes.length; i++){
|
|
|
|
for(;i < el.attributes.length; i++){
|
|
|
|
var attr = el.attributes[i];
|
|
|
|
var attr = el.attributes[i];
|
|
|
|
if(attr.name && attr.value){
|
|
|
|
if(attr.name && attr.value){
|
|
|
|
if(attr.name === "style"){
|
|
|
|
attributes[attr.name] = attr.value;
|
|
|
|
attributes.style = parseStyle(el);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
attributes[attr.name] = attr.value;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// this should never be longer than three elements
|
|
|
|
// this should never be longer than three elements
|
|
|
|