Just sort of curious ... of all the convenience that prototype offers,
why is the only method you "need" is Element.update()?

Anyway, try this...

(function() {
  function _$(args) {
    this.elements = [];
    for (var i = 0, len = args.length; i < len; ++i) {
      if (typeof args[i] == 'string') {
        this.elements.push( document.getElementById(args[i]) );
  _$.prototype = {
    update: function() {
      this.elements[0].innerHTML = arguments[0];
      return this;
  window.$ = function() {
    return new _$(arguments);

And a fragment to drop into a body...

<p id="p_content">
This is some content that starts in a &lt;p&gt;
<div id="div_content">
This is some content that starts in a &lt;div&gt;
window.onload = function () {

On Wed, Apr 29, 2009 at 4:33 PM, Bertrand <bertrand.char...@gmail.com> wrote:
> That would indeed be another interesting way of doing it. The only
> problem is that javascript is often used in environments where
> filesize is critical. In my case, I only use ONE function from the
> library, because I've found it to be th best way to achieve what I
> want to do: Element.update.
> But because I'm unable to sort the source code out, I have to either:
> Ditch Prototype altogether (which I don't really want to do)
> OR
> Make use of the whole library, which is a no-go for me as the minified
> +gzip version still weighs a solid 25kB (which isn't much, but still
> way too much for our needs).
> What bothers me here is the "one-size-fits-all" mentality, but
> complaining about it sure is easy when I'm not providing any code to
> fix the problem, I know it is, but still it bothers me that I'll have
> to end up not using update (which is a fantastic piece of code, like
> the rest of the library) just because it's so deeply intertwined with
> the rest of the codebase.
> What I was hinting at is something akin to what jqueryUI has on
> http://jqueryui.com/download but even more fine-grained (at function
> level if possible).
> >

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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to