|
|
|
@ -39,6 +39,14 @@ define([], function () {
|
|
|
|
|
return cb(hj[0], hj[1], children);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var prependDot = function (token) {
|
|
|
|
|
return '.' + token;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var isTruthy = function (x) {
|
|
|
|
|
return x;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var DOM2HyperJSON = function(el){
|
|
|
|
|
if(!el.tagName && el.nodeType === Node.TEXT_NODE){
|
|
|
|
|
return el.textContent;
|
|
|
|
@ -73,7 +81,14 @@ define([], function () {
|
|
|
|
|
delete attributes.id;
|
|
|
|
|
}
|
|
|
|
|
if(attributes.class){
|
|
|
|
|
sel = sel +'.'+ attributes.class.replace(/ /g,".");
|
|
|
|
|
/* TODO this can be done with RegExps alone, and it will be faster
|
|
|
|
|
but this works and is a little less error prone, albeit slower
|
|
|
|
|
come back and speed it up when it comes time to optimize */
|
|
|
|
|
sel = sel +'.'+ attributes.class
|
|
|
|
|
.split(/\s+/)
|
|
|
|
|
.split(isTruthy)
|
|
|
|
|
.map(prependDot)
|
|
|
|
|
.join('');
|
|
|
|
|
delete attributes.class;
|
|
|
|
|
}
|
|
|
|
|
result.push(sel);
|
|
|
|
|