Claudio,

I don't know about the Builder class (I don't use it), but your solution may not work when creating an input element with a "name" attribute in IE due to an obscure IE bug.




TAG

On Jul 24, 2006, at 3:43 AM, Michael Siebert wrote:

Hi,
isnt this functionality already covered by script.aculo.us's Builer.node()? Sure thats not Prototype, but that Builder rocks IMHO.

greets

2006/7/24, Claudio Gamboa <[EMAIL PROTECTED]>:
Hi everybody

I wrote this new method for prototype Element.
I don't know why this does not exist yet.

With this method we can create a new element and it will be returned.

The patch is:

----------------------------- start ------------------------

--- prototype.orig.js   2006-07-24 03:14:58.000000000 +0100
+++ prototype.js    2006-07-24 02:48:08.000000000 +0100
@@ -921,6 +921,15 @@
     return $(element).style.display != 'none';
   },

+  create: function(tagname, prop) {
+     var elm = document.createElement(tagname);
+     $H(prop).each(function(pair) {
+        elm.setAttribute(pair[0], pair[1]);
+        }
+     );
+     return elm;
+  },
+
   toggle: function() {
     for (var i = 0; i < arguments.length; i++) {
       var element = $(arguments[i]);
@@ -2003,4 +2012,4 @@

     return [valueL, valueT];
   }
-}
\ No newline at end of file
+}


----------------------------- end -------------------------


HowTo:

first -  check http://pdvel.com/stuff/js/createelement/
then - view source :)


/**
* Claudio Gamboa
* gamboa(AT_NO_SPAM)pdvel.com
* gamboa(AT_NOT_SPAM)co.sapo.pt
*/
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs



--
Michael Siebert <[EMAIL PROTECTED]>

www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium
_______________________________________________
Rails-spinoffs mailing list

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to