From 405592153112bc5e761a355916bbb32aa42d72c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 15 Aug 2008 00:34:18 +0000 Subject: [PATCH] Core: Moved UI core code below jQuery modification code. --- ui/ui.core.js | 122 +++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 60 deletions(-) diff --git a/ui/ui.core.js b/ui/ui.core.js index 2ad091bcfa5..0277266daf1 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -9,66 +9,6 @@ */ ;(function($) { -$.ui = { - plugin: { - add: function(module, option, set) { - var proto = $.ui[module].prototype; - for(var i in set) { - proto.plugins[i] = proto.plugins[i] || []; - proto.plugins[i].push([option, set[i]]); - } - }, - call: function(instance, name, args) { - var set = instance.plugins[name]; - if(!set) { return; } - - for (var i = 0; i < set.length; i++) { - if (instance.options[set[i][0]]) { - set[i][1].apply(instance.element, args); - } - } - } - }, - cssCache: {}, - css: function(name) { - if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; } - var tmp = $('
').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body'); - - //if (!$.browser.safari) - //tmp.appendTo('body'); - - //Opera and Safari set width and height to 0px instead of auto - //Safari returns rgba(0,0,0,0) when bgcolor is not set - $.ui.cssCache[name] = !!( - (!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || - !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))) - ); - try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){} - return $.ui.cssCache[name]; - }, - disableSelection: function(el) { - $(el).attr('unselectable', 'on').css('MozUserSelect', 'none').bind('selectstart', function() { return false; }); - }, - enableSelection: function(el) { - $(el).attr('unselectable', 'off').css('MozUserSelect', '').unbind('selectstart'); - }, - hasScroll: function(e, a) { - var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', - has = false; - - if (e[scroll] > 0) { return true; } - - // TODO: determine which cases actually cause this to happen - // if the element doesn't have the scroll set, see if it's possible to - // set the scroll - e[scroll] = 1; - has = (e[scroll] > 0); - e[scroll] = 0; - return has; - } -}; - - /** jQuery core modifications and additions **/ // This adds a selector to check if data exists. @@ -184,6 +124,68 @@ $.widget.defaults = { }; +/** jQuery UI core **/ + +$.ui = { + plugin: { + add: function(module, option, set) { + var proto = $.ui[module].prototype; + for(var i in set) { + proto.plugins[i] = proto.plugins[i] || []; + proto.plugins[i].push([option, set[i]]); + } + }, + call: function(instance, name, args) { + var set = instance.plugins[name]; + if(!set) { return; } + + for (var i = 0; i < set.length; i++) { + if (instance.options[set[i][0]]) { + set[i][1].apply(instance.element, args); + } + } + } + }, + cssCache: {}, + css: function(name) { + if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; } + var tmp = $('
').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body'); + + //if (!$.browser.safari) + //tmp.appendTo('body'); + + //Opera and Safari set width and height to 0px instead of auto + //Safari returns rgba(0,0,0,0) when bgcolor is not set + $.ui.cssCache[name] = !!( + (!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || + !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))) + ); + try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){} + return $.ui.cssCache[name]; + }, + disableSelection: function(el) { + $(el).attr('unselectable', 'on').css('MozUserSelect', 'none').bind('selectstart', function() { return false; }); + }, + enableSelection: function(el) { + $(el).attr('unselectable', 'off').css('MozUserSelect', '').unbind('selectstart'); + }, + hasScroll: function(e, a) { + var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', + has = false; + + if (e[scroll] > 0) { return true; } + + // TODO: determine which cases actually cause this to happen + // if the element doesn't have the scroll set, see if it's possible to + // set the scroll + e[scroll] = 1; + has = (e[scroll] > 0); + e[scroll] = 0; + return has; + } +}; + + /** Mouse Interaction Plugin **/ $.ui.mouse = {