(function() {
var element, nameTest;
try {
nameTest = document.createElement('');
nameTest = nameTest.tagName.toLowerCase() == 'div' && nameTest.name == 'Prototype_test';
} catch (e) { nameTest = false }
this.Element = Object.extend(function(tagName, attributes) {
var cache = Element.cache;
tagName = tagName.toLowerCase();
if (nameTest && attributes && attributes.name) {
element = document.createElement('<' + tagName + ' name="' + attributes.name + '">');
delete attributes.name;
} else {
if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
element = cache[tagName].cloneNode(false);
}
if (attributes) Element.writeAttribute(element, attributes);
return Element.extend(element);
}, this.Element || { });
this.Element.cache = { };
}).call(window);