diff --git a/Source/Element/Element.js b/Source/Element/Element.js
index 5dfb122b7..af6c3cddd 100644
--- a/Source/Element/Element.js
+++ b/Source/Element/Element.js
@@ -114,18 +114,35 @@ Elements.implement({
});
+(function(){
+
+/**/
+var createElementAcceptsHTML;
+try {
+ var x = document.createElement('');
+ createElementAcceptsHTML = (x.name == 'x');
+} catch(e){}
+
+var escapeQuotes = function(html){
+ return ('' + html).replace(/&/g,'&').replace(/"/g,'"');
+};
+/**/
+
Document.implement({
newElement: function(tag, props){
- if (Browser.Engine.trident && props){
- ['name', 'type', 'checked'].each(function(attribute){
- if (!props[attribute]) return;
- tag += ' ' + attribute + '="' + props[attribute] + '"';
- if (attribute != 'checked') delete props[attribute];
- });
- tag = '<' + tag + '>';
+ if (props && props.checked != null) props.defaultChecked = props.checked;
+ /**/// Fix for readonly name and type properties in IE < 8
+ if (createElementAcceptsHTML && props){
+ tag = '<' + tag;
+ if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"';
+ if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"';
+ tag += '>';
+ delete props.name;
+ delete props.type;
}
- return document.id(this.createElement(tag)).set(props);
+ /**/
+ return this.id(this.createElement(tag)).set(props);
},
newTextNode: function(text){
@@ -177,6 +194,8 @@ Document.implement({
});
+})();
+
if (window.$ == null) Window.implement({
$: function(el, nc){
return document.id(el, nc, this.document);