polydor wrote:
> Hi,
>
> I want to make a huge table using Prototype. my script has 2900 calls
> to Element.update. These calls lasts 4 seconds, which is a lot. This
> is mainly taken up by the regular expressions in the function, to
> identify scripts inside the body I want to insert in the node. By
> just removing these script-related code out of the update-function, I
> have a huge performance boost.
>
> I don't want to customize my local prototype.js file, but want to
> override the function. I tried something like this:
>
> Element.Methods.update = function(element, content) {
> element = $(element);
> if (content && content.toElement) content = content.toElement();
> if (Object.isElement(content)) return element.update().insert
> (content);
> content = Object.toHTML(content);
> element.innerHTML = content;
> // element.innerHTML = content.stripScripts();
> // content.evalScripts.bind(content).defer();
> return element;
> };
>
> This didn't change my method.
>
> Adding a new method
> Element.Methods.simpleUpdate = function(element, content) {
> ...
> or
> Object.extend(Element, {
> simpleUpdate: function(element, content) {
> ...
>
> doesn't work either.
>
> How can I get it work, or is there an alternative in which I don't
> have to use the update-function, besides updating it by changing the
> innerHTML property myself.
Is there a reason you wish to use `update` over just assigning to
`innerHTML` directly? I would suggest to go with the latter one, but
if you must:
Element.addMethods({
update: function(){ ... }
});
P.S. Also, don't forget that Element#update (among others) is
redefined for IE later during initialization time.
--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---