diff options
author | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-11-12 03:57:23 +0000 |
---|---|---|
committer | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-11-12 03:57:23 +0000 |
commit | d7707b1fb1ae0e23eb548ea44982a520b2e572a7 (patch) | |
tree | 5a1c9684b5813dd967379075e8b9b0cb43d5488d /ui/ui.core.js | |
parent | 657d31adaa9fb4fa94ab1bbc9581ae38ba1442eb (diff) | |
download | jquery-ui-d7707b1fb1ae0e23eb548ea44982a520b2e572a7.tar.gz jquery-ui-d7707b1fb1ae0e23eb548ea44982a520b2e572a7.zip |
Core and Sortable: $.ui.contains method moved into the core. This method could be util for another components.
Diffstat (limited to 'ui/ui.core.js')
-rw-r--r-- | ui/ui.core.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js index 1507fda0f..4e93c6b21 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -66,7 +66,19 @@ $.ui = { set[i][1].apply(instance.element, args); } } - } + } + }, + + contains: function(a, b) { + var safari2 = $.browser.safari && $.browser.version < 522; + if (a.contains && !safari2) { + return a.contains(b); + } + if (a.compareDocumentPosition) + return !!(a.compareDocumentPosition(b) & 16); + while (b = b.parentNode) + if (b == a) return true; + return false; }, cssCache: {}, @@ -80,7 +92,7 @@ $.ui = { //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')) || + (!(/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){} |