1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-17 23:34:50 +00:00

Fixed some confusing parameter names

This commit is contained in:
Jeremy Ruston 2012-03-11 19:08:50 +00:00
parent 34fb32b81c
commit f8f3b884a1

View File

@ -198,14 +198,14 @@ MacroNode.prototype.render = function(type) {
return output.join(""); return output.join("");
}; };
MacroNode.prototype.renderInDom = function(domNode,insertBefore) { MacroNode.prototype.renderInDom = function(parentDomNode,insertBefore) {
// Create the wrapper node for the macro // Create the wrapper node for the macro
var macroContainer = document.createElement(this.macro.wrapperTag || "span"); var macroContainer = document.createElement(this.macro.wrapperTag || "span");
this.domNode = macroContainer; this.domNode = macroContainer;
if(insertBefore) { if(insertBefore) {
domNode.insertBefore(macroContainer,insertBefore); parentDomNode.insertBefore(macroContainer,insertBefore);
} else { } else {
domNode.appendChild(macroContainer); parentDomNode.appendChild(macroContainer);
} }
// Add some debugging information to it // Add some debugging information to it
macroContainer.setAttribute("data-tw-macro",this.macroName); macroContainer.setAttribute("data-tw-macro",this.macroName);
@ -334,7 +334,7 @@ ElementNode.prototype.render = function(type) {
return output.join(""); return output.join("");
}; };
ElementNode.prototype.renderInDom = function(domNode) { ElementNode.prototype.renderInDom = function(parentDomNode,insertBefore) {
var element = document.createElement(this.type); var element = document.createElement(this.type);
if(this.attributes) { if(this.attributes) {
for(var a in this.attributes) { for(var a in this.attributes) {
@ -352,7 +352,11 @@ ElementNode.prototype.renderInDom = function(domNode) {
} }
} }
} }
domNode.appendChild(element); if(insertBefore) {
parentDomNode.insertBefore(element,insertBefore);
} else {
parentDomNode.appendChild(element);
}
this.domNode = element; this.domNode = element;
if(this.children) { if(this.children) {
for(var t=0; t<this.children.length; t++) { for(var t=0; t<this.children.length; t++) {