> As an alternative to introducing such a global variable, we could use
> closures for creating local aliases[1] within the respective modules.

Although it might seem innocuous (and even somewhat elegant), the
'local alias' technique for defining $(...) should probably be avoided
within TiddlyWiki, because it can still create conflicts with any
other JS libraries that already define the $(...) function as a simple
abbreviation for:
   var $=document.getElementById;

For example, let's suppose that a call to wikify() occurs within the
scope of a locally-defined alias where $(...) invokes the jQuery()
function.  In this case, all processing that falls within that scope
-- every macro handler, formatter, or inline script invoked during
rendering -- will attempt to use the jQuery function, even if that
handler, formatter or inline script doesn't actually apply a 'local
alias' wrapper itself or may even be using custom-written code that
calls upon $(...), expecting it to be invoking a simple non-jQuery
version of the function defined in some other plugin or JS library.

Fortunately, the jQuery team has provided the jQuery.noConflict()
function, which TiddlyWiki is currenlty invoking at the start of the
main() function in order to completely avoid this potentially fatal
conflict by telling jQuery *not* apply its own definition of $(...).

Even so, it would be good to have an abbreviation for "jQuery" would
save a considerable number of bytes in the TW core source code... If
the jQuery docs are using $j as an alternative abbreviation, then I
think that's what we should use as well.

-e

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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/TiddlyWikiDev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to