I wanted to make a DOM in a proper way, and not just updating
innerHTML myself, but I already refactored my code and make a whole
<table>-string and then updating the DIV container, which is much
faster than using the update-function.
Nevertheless, when encountering this, I wanted to know what I did
wrong. thanks for your feedback.
Paul
On Nov 19, 4:43 pm, EMoreth <[EMAIL PROTECTED]> wrote:
> I had this kind of problem some time ago..
>
> I had a table that was generated by javascript showing values that
> were added to the database from all users. So when the administrator
> needed to get the full table it took years to load.
>
> This kind of thing is generally only text data, with no "script" tags
> that needed to be evaluated (this consumes a lot if time on
> Prototype.Element.update method).
>
> Check if you can change some if your update codes to innerHTML's,
> probably lots of them will don't need to be evaluated ass javascript
> scripts.
>
> In the case you are adding Object Elements try element.wrap
> ('span').innerHTML this still intends to be faster than update()
> (again for not evaluating script tags).
>
> EMoreth
>
> On 19 nov, 09:33, kangax <[EMAIL PROTECTED]> wrote:
>
> > 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- Ocultar texto entre aspas -
>
> > - Mostrar texto entre aspas -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---