mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #6724, though the Mobile Safari wound remains. Closes gh-764.
This commit is contained in:
parent
7778c77222
commit
ca48d49040
@ -28,14 +28,13 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
|
|||||||
|
|
||||||
jQuery.fn[ type ] = function( value ) {
|
jQuery.fn[ type ] = function( value ) {
|
||||||
return jQuery.access( this, function( elem, type, value ) {
|
return jQuery.access( this, function( elem, type, value ) {
|
||||||
var doc, docElemProp, orig, ret;
|
var doc, orig, ret;
|
||||||
|
|
||||||
if ( jQuery.isWindow( elem ) ) {
|
if ( jQuery.isWindow( elem ) ) {
|
||||||
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
|
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
|
||||||
doc = elem.document;
|
// isn't a whole lot we can do. See pull request at this URL for discussion:
|
||||||
docElemProp = doc.documentElement[ clientProp ];
|
// https://github.com/jquery/jquery/pull/764
|
||||||
return jQuery.support.boxModel && docElemProp ||
|
return elem.document.documentElement[ clientProp ];
|
||||||
doc.body && doc.body[ clientProp ] || docElemProp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get document width or height
|
// Get document width or height
|
||||||
|
@ -9,7 +9,7 @@ function fn( val ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testWidth( val ) {
|
function testWidth( val ) {
|
||||||
expect(8);
|
expect(9);
|
||||||
|
|
||||||
var $div = jQuery("#nothiddendiv");
|
var $div = jQuery("#nothiddendiv");
|
||||||
$div.width( val(30) );
|
$div.width( val(30) );
|
||||||
@ -34,6 +34,8 @@ function testWidth( val ) {
|
|||||||
equal( blah.width( val(10) ), blah, "Make sure that setting a width on an empty set returns the set." );
|
equal( blah.width( val(10) ), blah, "Make sure that setting a width on an empty set returns the set." );
|
||||||
equal( blah.width(), null, "Make sure 'null' is returned on an empty set");
|
equal( blah.width(), null, "Make sure 'null' is returned on an empty set");
|
||||||
|
|
||||||
|
equal( jQuery(window).width(), document.documentElement.clientWidth, "Window width is equal to width reported by window/document." );
|
||||||
|
|
||||||
jQuery.removeData($div[0], "olddisplay", true);
|
jQuery.removeData($div[0], "olddisplay", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +65,7 @@ test("width(Function(args))", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function testHeight( val ) {
|
function testHeight( val ) {
|
||||||
expect(8);
|
expect(9);
|
||||||
|
|
||||||
var $div = jQuery("#nothiddendiv");
|
var $div = jQuery("#nothiddendiv");
|
||||||
$div.height( val(30) );
|
$div.height( val(30) );
|
||||||
@ -88,6 +90,8 @@ function testHeight( val ) {
|
|||||||
equal( blah.height( val(10) ), blah, "Make sure that setting a height on an empty set returns the set." );
|
equal( blah.height( val(10) ), blah, "Make sure that setting a height on an empty set returns the set." );
|
||||||
equal( blah.height(), null, "Make sure 'null' is returned on an empty set");
|
equal( blah.height(), null, "Make sure 'null' is returned on an empty set");
|
||||||
|
|
||||||
|
equal( jQuery(window).height(), document.documentElement.clientHeight, "Window width is equal to width reported by window/document." );
|
||||||
|
|
||||||
jQuery.removeData($div[0], "olddisplay", true);
|
jQuery.removeData($div[0], "olddisplay", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user