aboutsummaryrefslogtreecommitdiffstats
path: root/src/offset.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2010-09-05 10:17:18 -0400
committerJohn Resig <jeresig@gmail.com>2010-09-05 10:17:18 -0400
commit920099b29c1157b637f918cdc293e1c89e9cd4dc (patch)
treeac54f93e4c59379f003eec7e19b1a51b1e5a3645 /src/offset.js
parent2912f8ab9520e042e8b27865617e586e34a05704 (diff)
downloadjquery-920099b29c1157b637f918cdc293e1c89e9cd4dc.tar.gz
jquery-920099b29c1157b637f918cdc293e1c89e9cd4dc.zip
First pass at unifying the various CSS methods in jQuery (jQuery.style, jQuery.curCSS, and jQuery.css are now all under jQuery.css).
Diffstat (limited to 'src/offset.js')
-rw-r--r--src/offset.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/offset.js b/src/offset.js
index 0ce4c1979..bab253ba2 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -103,7 +103,7 @@ if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.offset = {
initialize: function() {
- var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0,
+ var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop", undefined, true) ) || 0,
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
@@ -142,25 +142,25 @@ jQuery.offset = {
jQuery.offset.initialize();
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
- top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0;
- left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0;
+ top += parseFloat( jQuery.css(body, "marginTop", undefined, true) ) || 0;
+ left += parseFloat( jQuery.css(body, "marginLeft", undefined, true) ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
- var position = jQuery.curCSS( elem, "position" );
+ var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
- var curElem = jQuery( elem ),
- curOffset = curElem.offset(),
- curCSSTop = jQuery.curCSS( elem, "top", true ),
- curCSSLeft = jQuery.curCSS( elem, "left", true ),
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curCSSTop = jQuery.css( elem, "top", undefined, true ),
+ curCSSLeft = jQuery.css( elem, "left", undefined, true ),
calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
props = {}, curPosition = {}, curTop, curLeft;
@@ -210,12 +210,12 @@ jQuery.fn.extend({
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0;
- offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0;
+ offset.top -= parseFloat( jQuery.css(elem, "marginTop", undefined, true) ) || 0;
+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft", undefined, true) ) || 0;
// Add offsetParent borders
- parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0;
- parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0;
+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth", undefined, true) ) || 0;
+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth", undefined, true) ) || 0;
// Subtract the two offsets
return {