David said:
kangax said:
David Mark wrote: [...]
The only recommendation I would make regarding that project is to
learn from it. The first lesson is that a general-purpose script is a
bad idea. There are silly mistakes to be found (some documented in
That probably depends on how one defines a general-purpose script.
Undoubtedly, a general purpose solution will always be less efficient
than a specific one. Nevertheless, I don't see how a collection of
low-level helpers (if such collection falls under the definition of
"general-purpose script") is a bad idea. Various getElement(s)?By*, XHR
and event handling wrappers, class manipulation, DOM traversal, etc. -
all come in useful when creating higher-level widgets.
Sure. I meant general-purpose and monolithic (like Prototype, jQuery,
etc.)
It's good to see some of the JS libraries, like YUI, realize that
modular approach is the sanest way to go. Now if only they didn't sniff
in their DOM module
<
http://github.com/yui/yui3/blob/0b9552b9cf1deb8b848b8b513d2a11fe43cb7...>
And their event module. YUI is junk too. Just bigger (and more
modular) junk.
[...]
Standards mode and HTML are a good starting point.
Absolutely.
[...]
Which mistakes are you talking about? I remember there were some
concerns in CWR threads about which properties should be tested and
which browsers should be supported.
There's at least one silly bug in the Flash module (related to
attributes of all things.) I just read some reports about IE8's
handling of clip styles, which tells me that a couple of the effects
will need updates. Certainly there are others.
I saw you posted a message in "My Library" group about "IE8 and clip"
but haven't had time to read it carefully yet.
That one isn't a big deal. A couple of special effects may be down in
IE8. Fix should be a couple of lines.
Glancing at the code quickly, I can see some mistakes in "Fork", but not
in "My Library" (except dependencies testing that I mentioned earlier
which appeared to be a non-issue).
That's another issue with large scripts. It is hard to spot little
mistakes. Trust me, there are some. I know I didn't patch the Flash
module, so it is still fouling up the "class" attribute of the
replacement OBJECT. That one is pretty silly, but I just don't have
time to mess with My Library right now.
It looks like back in '07 best practices already included solid
foundation of `isHost*` methods; nature of memory leaks in IE was
already researched well enough (to know that circular references should
be avoided); Which evolution are you talking about?
Lots of little things. Using My Library as an example, it is too
generalized, does too much to support ancient browsers, unnecessarily
attaches an unload listener to fix memory leaks that are never
created. Creates closures where none are needed, doesn't leverage QSA
(there's a five minute project), doesn't leverage built-in transitions
(except for IE), references getBoxObjectFor (thankfully not for
anything important), some modules create expandos (e.g. query), etc.
Unit tests is still an essential aspect of any serious
library/application. They are not meant as a guiding light for
trial-and-error development, of course; rather a way to maintain the
code safely and ensure system integrity.
Yes, they are very important. I leave that stuff to others, getting
involved only when things go wrong (thankfully that is rare.) That's
one of the reasons I find jQuery evangelists so amusing. They do seem
to spend a large percentage of their lives watching unit tests. They
must see progress meters in their sleep.
Software tends to be changed
with time, sometimes changes need to be done fast and there's no time to
analyze how and what they affect. Unit tests simply allow for a more
efficient development (Of course, making a system decoupled and modular
helps to reduce risk greatly

)
When I make a little change, it is nice to know that it is a little
change. Modularity is key, but what is missing from scripts like My
Library is interchangeability. As one of my clients mentioned
recently, it would be nice to have another set of checkboxes to
indicate the desired level of browser support. CWR started out as
interchangeable functions and I just picked the level of support that
I felt was best in 2007.