User:Mike Dillon/Scripts/easydom.js: Difference between revisions

Content deleted Content added
update to code from dev; adds attribute handler functions, options to change namespace and tag names, special handling for "style" in IE
fix broken browsers without createElementNS
 
(7 intermediate revisions by the same user not shown)
Line 17:
// Default tag names to be installed into the namespace as functions
var defaultTagNames = [
"tablebdo", "tbodyscript", "tfootstyle", "trobject", "thparam", "tdiframe", "collink", "colgroupmeta", "captionp",
"bdo",
"pre", "a", "div", "span", "ul", "ol", "li", "img", "hr", "br", "em", "strong",
"script",
"emsup", "strongsub", "suptt", "subabbr", "ttacronym", "abbrdel", "acronymins", "cite", "blockquote",
"object", "param",
"code", "table", "tbody", "tfoot", "tr", "th", "td", "col", "colgroup", "caption",
"iframe",
"link", "meta",
"p", "pre",
"a",
"div", "span",
"ul", "ol", "li",
"img",
"hr",
"br",
"em", "strong", "sup", "sub", "tt", "abbr", "acronym",
"del", "ins", "cite", "blockquote", "code",
"table", "tbody", "tfoot", "tr", "th", "td", "col", "colgroup", "caption",
"form", "input", "select", "option", "optgroup", "button", "textarea",
"h1", "h2", "h3", "h4", "h5", "h6", "label", "canvas", "fieldset", "legend"
"label",
"canvas"
];
 
Line 53 ⟶ 40:
var settings = {
"namespaceUri": "http://www.w3.org/1999/xhtml",
 
"invokeFunctions": true,
 
"tagNames": defaultTagNames,
 
"eventTypes": defaultEventTypes
};
Line 66 ⟶ 50:
settings[p] = options[p];
}
}
 
// If the browser doesn't understand createElementNS, fake it (God help them...)
if (isUndefined(document.createElementNS)) {
document.createElementNS = function (ns, name) {
return document.createElement(name);
"bdo",};
}
 
// Creates the DOM element
var createDomElement = function(name) {
var elem =return document.createElementNS(settings.namespaceUri, name);
return elem;
};