Content deleted Content added
Mike Dillon (talk | contribs) m rollback |
Mike Dillon (talk | contribs) m this should fix the builder functions |
||
Line 1:
// <pre><nowiki>
function
var isType = function (o, t) { return typeof o == t };
var isBool = function (o) { return isType(o, typeof true); };
Line 14:
}
var isNode = function (o) { return isDefined(o) && o != null && isNumber(o.nodeType); }
// The tag names that will be created in the namespace
"bdo",▼
"script",▼
"object", "param",▼
"link", "meta",▼
"p", "pre",▼
"a",▼
"div", "span",▼
"ul", "ol", "li",▼
"img",▼
"hr",▼
"br",▼
"em", "strong", "sup", "sub", "tt", "abbr", "acronym",▼
"del", "ins", "cite", "blockquote",▼
"table", "tbody", "tfoot", "tr", "th", "td", "col", "colgroup", "caption",▼
"form", "input", "select", "option", "optgroup", "button",▼
"h1", "h2", "h3", "h4", "h5", "h6",▼
"label"▼
];
// Creates the DOM element
Line 100 ⟶ 122:
};
//
// Process attribute hash, if any and skip the argument count returned
var firstChild = processDomAttributes(elem, arguments);
// Process the remaining children, if any
for (var i = firstChild; i < arguments.length; i++) {
var child = arguments[i];
if (child == null) {
continue;
}
// Convert any non-DOM nodes to text nodes with toString()▼
if (!isNode(child)) {▼
child = document.createTextNode(child.toString());▼
}
elem.appendChild(child);
}
▲ // Convert any non-DOM nodes to text nodes with toString()
▲ if (!isNode(child)) {
▲ child = document.createTextNode(child.toString());
▲ }
▲ elem.appendChild(child);
▲ }
return elem;
};
};
// Populate the namespace
if (isUndefined(namespace)) namespace = {};
▲ "bdo",
▲ "script",
namespace[tags[i]] = createDomElementBuilder(tags[i]);
▲ "object", "param",
▲ "link", "meta",
▲ "p", "pre",
▲ "a",
▲ "div", "span",
▲ "ul", "ol", "li",
▲ "img",
▲ "hr",
▲ "br",
▲ "em", "strong", "sup", "sub", "tt", "abbr", "acronym",
▲ "del", "ins", "cite", "blockquote",
▲ "table", "tbody", "tfoot", "tr", "th", "td", "col", "colgroup", "caption",
▲ "form", "input", "select", "option", "optgroup", "button",
▲ "h1", "h2", "h3", "h4", "h5", "h6",
▲ "label"
// Return the namespace for those relying on anonymous creation
return namespace;
▲for (var i in easyDomTags) {
}
// Build the Easy DOM functions in an anonymous namespace
easyDom = buildEasyDomNamespace();
// Namespace pollution
// </nowiki></pre>
|