mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Fix handling of orderedattributes when adding classes/styles
Fixes issue referred to in https://github.com/Jermolene/TiddlyWiki5/pull/6877#issuecomment-1277590200
This commit is contained in:
parent
cfd894e6fb
commit
8f079e2d45
@ -65,11 +65,9 @@ exports.addClassToParseTreeNode = function(node,classString) {
|
|||||||
// If the class attribute does not exist, we must create it first.
|
// If the class attribute does not exist, we must create it first.
|
||||||
attribute = {name: "class", type: "string", value: ""};
|
attribute = {name: "class", type: "string", value: ""};
|
||||||
node.attributes["class"] = attribute;
|
node.attributes["class"] = attribute;
|
||||||
if(node.orderedAttributes) {
|
node.orderedAttributes = node.orderedAttributes || [];
|
||||||
// If there are orderedAttributes, we've got to add them there too.
|
|
||||||
node.orderedAttributes.push(attribute);
|
node.orderedAttributes.push(attribute);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(attribute.type === "string") {
|
if(attribute.type === "string") {
|
||||||
if(attribute.value !== "") {
|
if(attribute.value !== "") {
|
||||||
classes = attribute.value.split(" ");
|
classes = attribute.value.split(" ");
|
||||||
@ -88,11 +86,9 @@ exports.addStyleToParseTreeNode = function(node,name,value) {
|
|||||||
if(!attribute) {
|
if(!attribute) {
|
||||||
attribute = {name: "style", type: "string", value: ""};
|
attribute = {name: "style", type: "string", value: ""};
|
||||||
node.attributes.style = attribute;
|
node.attributes.style = attribute;
|
||||||
if(node.orderedAttributes) {
|
node.orderedAttributes = node.orderedAttributes || [];
|
||||||
// If there are orderedAttributes, we've got to add them there too.
|
|
||||||
node.orderedAttributes.push(attribute);
|
node.orderedAttributes.push(attribute);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(attribute.type === "string") {
|
if(attribute.type === "string") {
|
||||||
attribute.value += name + ":" + value + ";";
|
attribute.value += name + ":" + value + ";";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user