On Mar 6, 8:16 pm, Tobie Langel <tobie.lan...@gmail.com> wrote:
> > writeAttribute does not fix cross browser differences in the
> > implementation of setAttribute.
>
> How so? What's missing? File bugs! :)

The differences are in the browsers' implementation of setAttribute,
For example, using setAttribute with any of the intrinsic event
handlers.

>
> > Feel free to recommend otherwise but I'd like to see some reasons why.
>
> There's one simple reason: forward compatibility.
>
> Prototype 2.0 will stop extending prototype's of HTMLElement,
> therefore, using the dot property to set or retrieve attributes will
> no longer work (that is, until getters and setters are supported in
> all browsers).

You'll have to fill me in on that, I have no idea what is in version
2.0.  There is no mention of it on the Prototype.js web site (a search
on Prototype 2.0 returns no results)

Are you saying Prototype.js will go the way of jQuery and return an
object that has a reference to an element or elements as one of its
properties?  That means jQuery shaddows all the DOM methods (which I
guess Prototype.js already does quite a bit of).


> On top of that, using a unified API is always a good thing.

You said in a previous post:

>> The only area where you should not be using writeAttribute is:
>> - When you want to store anything but a string (use the new storage
>> API or expandos directly).
>> - For setting or getting the value attribute of Form elements (use
>> FormElement#(get|set)Value instead).

So there are now 3 APIs - these two plus writeAttribute - when no API
is necessary at all.  I could count the use of observe too to replace
the buggy setAttribute('onclick', fn) in IE but that's probably going
too far. :-)

> Premature
> optimization isn't.

The fact that it is faster is a pleasant side effect of using the most
reliable, well supported method.  It is not the sole criterion.


--
Rob
--~--~---------~--~----~------------~-------~--~----~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to