diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-10-15 11:03:49 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-10-15 11:03:49 +0000 |
commit | fd1e9489280539ec1961ee2bcd3ea01adb1c740c (patch) | |
tree | c85a6862281e32b83bbb50c331798d93ee497506 /ui/ui.core.js | |
parent | 79d25190cd08381d081fca876cd8aeeb3eb7670a (diff) | |
download | jquery-ui-fd1e9489280539ec1961ee2bcd3ea01adb1c740c.tar.gz jquery-ui-fd1e9489280539ec1961ee2bcd3ea01adb1c740c.zip |
core: implemented experimental async dependency loading
Diffstat (limited to 'ui/ui.core.js')
-rw-r--r-- | ui/ui.core.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js index 877b0d023..41486529f 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -9,6 +9,31 @@ */ ;(function($) { + +/** Lazy loading stub functions **/ +var uiPath; +$("script").each(function() { + if((/ui/i).test(this.src)) { + var splitted = this.src.split('/'); splitted.pop(); + uiPath = splitted.join('/') + ( splitted.join('/') == '' ? '' : '/' ); + } +}); + +$.each( ("accordion,colorpicker,datepicker,dialog,draggable,droppable,magnifier,progressbar," + + "resizable,selectable,slider,sortable,spinner,tabs").split(","), function(i, name){ + + // Handle event binding + $.fn[name] = function(){ + + var selector = this, args = arguments; + $.getScript(uiPath+'ui.'+name+'.js', function() { + selector[name].apply(selector, args); + }); + + }; +}); + + /** jQuery core modifications and additions **/ var _remove = $.fn.remove; |