On Mar 6, 7:07 am, RobG <[email protected]> wrote:
[...]
> The differences are in the browsers' implementation of setAttribute,
> For example, using setAttribute with any of the intrinsic event
> handlers.
Setting intrinsic event handlers was never supported, as far as I
remember, although some users did indeed try to set them and wondered
why it wouldn't work. As much as I'd hate to have another "exception",
this "deficiency" should simply be stated in a documentation. From the
API perspective, it would probably be nice to have such support, but
realistically it's pretty much impossible to implement; When a string
is passed to `writeAttribute` it's practically impossible to tell
whether this string corresponds to an event attribute (and so a simple
property assignment should be performed). MSHTML, for example, defines
a great deal of non-standard proprietary events; other browsers
probably do the same thing. This rules out the possibility of some
kind of static hash table to perform a test against. Determining event-
like attributes by testing attribute name against /^on/ obviously
fails miserable when given a custom property of the same pattern (e.g.
"on_myapp_started"). Gotta love browser scripting...
I personally almost always use simple property assignment, because I
know what works and what doesn't; the speed benefits of `element.title
= 'foo'` vs. $(element).writeAttribute('title', 'foo') are quite
noticeable - no need to extend an element (that's O(N) in MSHTML), no
need to call a method, no need to perform testing/translation/mapping
inside that method, and so on and so forth.
But then I miss on unified API, of course : )
Oh well.
[...]
--
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
-~----------~----~----~----~------~----~------~--~---