1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-23 07:26:54 +00:00

Add parse tree helper for styling elements

This commit is contained in:
Jeremy Ruston 2012-12-20 09:21:58 +00:00
parent 36290c14fa
commit 5c2f698842

View File

@ -29,4 +29,14 @@ exports.addClassToParseTreeNode = function(node,classString) {
}
};
exports.addStyleToParseTreeNode = function(node,name,value) {
if(node.type === "element") {
node.attributes = node.attributes || {};
node.attributes["style"] = node.attributes["style"] || {type: "string", value: ""};
if(node.attributes["style"].type === "string") {
node.attributes["style"].value += name + ":" + value + ";";
}
}
};
})();