So Marius debunked my "improvement" to escapeHTML but did prove that
other methods can be much faster.
However, what are your thoughts on removing the usage of escapeHTML from
_attributes altogether? I think Builder.node needs to be optimized for
speed as much as possible since it is something that could be called
thousands of times easily. I will be looking into the usage of cloneNode
to help alleviate this, but the code probably won't be as neat and I
won't always be able to use cloneNode.
Thanks,
Colin
Thomas Fuchs wrote:
Am 04.01.2007 um 13:19 schrieb Colin Mollenhour:
On 2), why can't the escapeHTML function create a div node and a
text node once one the first call and reuse it on subsequent calls?
Also, is this not a leak?
------------For reference---------
escapeHTML: function() {
var div = document.createElement('div');
var text = document.createTextNode(this);
div.appendChild(text);
return div.innerHTML;
},
----------------------------------
That's something we'd need to measure. The text node creation
wouldn't go away, and reusing the div node would mean to empty it out
before adding the text node. I don't really think that it would make
a real difference.
Best,
Thomas
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---