Fork me on GitHub
Subscribe 3

Ticket #304 (open enhancement)

Add jQuery

  • Created: 2011-02-22 12:21:14
  • Reported by: Reines
  • Assigned to: None
  • Milestone: 2.0-alpha2
  • Component: javascript
  • Priority: normal

Make use of the jQuery library for various javascript effects, as well as providing it for any plugins which wish to use it.

History

Reines 2011-02-25 00:47:45

  • Milestone changed from 2.0-beta1 to 2.0-alpha2.

llaumgui 2011-03-09 13:07:25

Allow to get jQuery from a Google CDN cold be a good idea : http://code.google.com/intl/fr/apis/lib … tml#jquery

Reines 2011-04-16 21:23:59

Might be worth considering handling this in a way similar to wordpress (wp_enqueue_script()).

Franz 2012-01-26 12:56:57

Hmm... isn't that a very theme-specific thing?

What I mean is that the easiest thing would probably be to let themes simply include jQuery (e.g. from Google's CDN) if they need it.

Reines 2012-01-26 14:46:18

I guess the issue is when an extension wants to use jQuery - should they rely on the theme having it available or load it themselves? Either way if they get it wrong it wont work - hence WordPress provide a method to load it only if it isn't already loaded.

This probably shouldn't be specific to jQuery - rather a function to loading any javascript-script, but only if it isn't already. See: wp_enqueue_script.

Franz 2012-01-26 15:03:51

So does that mean we would include jQuery with the core?

Reines 2012-01-26 15:35:37

Not necessarily, though we could if we wanted. For example we might have a load_script($alias, $path) function in the core that would require the path given - in which case it would be loaded from the path given by whatever called it first (theme/extension/whatever).

Alternatively we could include jquery in the core or even just the path to it on a CDN, and simply have a load_script($alias [, $path]) function, where the $path is optional, and an error is thrown if none is given and it isn't a known library.