Commit dca76812 authored by Michał Gołębiowski's avatar Michał Gołębiowski Committed by Dave Methvin

Improve CSS and `Support:` comments. Close gh-1220.

1) corrected box-sizing rules order - the unprefixed value should always be the last one
2) removed last semi-colons in CSS rules
3) updated support comments

code review changes + more consistent comment spacing
parent 1b610266
...@@ -409,7 +409,7 @@ jQuery.extend({ ...@@ -409,7 +409,7 @@ jQuery.extend({
if ( obj == null ) { if ( obj == null ) {
return String( obj ); return String( obj );
} }
// Support: Safari <=5.1 (functionish RegExp) // Support: Safari <= 5.1 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ? return typeof obj === "object" || typeof obj === "function" ?
class2type[ core_toString.call(obj) ] || "object" : class2type[ core_toString.call(obj) ] || "object" :
typeof obj; typeof obj;
...@@ -424,9 +424,10 @@ jQuery.extend({ ...@@ -424,9 +424,10 @@ jQuery.extend({
return false; return false;
} }
// Support: Firefox >16 // Support: Firefox <20
// The try/catch suppresses exceptions thrown when attempting to access // The try/catch suppresses exceptions thrown when attempting to access
// the "constructor" property of certain host objects, ie. |window.location| // the "constructor" property of certain host objects, ie. |window.location|
// https://bugzilla.mozilla.org/show_bug.cgi?id=814622
try { try {
if ( obj.constructor && if ( obj.constructor &&
!core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { !core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
......
...@@ -295,9 +295,8 @@ curCSS = function( elem, name, _computed ) { ...@@ -295,9 +295,8 @@ curCSS = function( elem, name, _computed ) {
ret = jQuery.style( elem, name ); ret = jQuery.style( elem, name );
} }
// Support: Chrome <17, Safari 5.1 // Support: Safari 5.1
// A tribute to the "awesome hack by Dean Edwards" // A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
...@@ -484,10 +483,12 @@ jQuery.each([ "height", "width" ], function( i, name ) { ...@@ -484,10 +483,12 @@ jQuery.each([ "height", "width" ], function( i, name ) {
// These hooks cannot be added until DOM ready because the support test // These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready // for it is not run until after DOM ready
jQuery(function() { jQuery(function() {
// Support: Android 2.3
if ( !jQuery.support.reliableMarginRight ) { if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = { jQuery.cssHooks.marginRight = {
get: function( elem, computed ) { get: function( elem, computed ) {
if ( computed ) { if ( computed ) {
// Support: Android 2.3
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block // Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" }, return jQuery.swap( elem, { "display": "inline-block" },
......
...@@ -508,7 +508,7 @@ jQuery.event = { ...@@ -508,7 +508,7 @@ jQuery.event = {
event[ prop ] = originalEvent[ prop ]; event[ prop ] = originalEvent[ prop ];
} }
// Support: Chrome 23+, Safari? // Support: Safari 6.0+, Chrome < 28
// Target should not be a text node (#504, #13143) // Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) { if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode; event.target = event.target.parentNode;
...@@ -554,7 +554,8 @@ jQuery.event = { ...@@ -554,7 +554,8 @@ jQuery.event = {
beforeunload: { beforeunload: {
postDispatch: function( event ) { postDispatch: function( event ) {
// Support: Firefox 10+ // Support: Firefox 20+
// Firefox doesn't alert if the returnValue field is not set.
if ( event.result !== undefined ) { if ( event.result !== undefined ) {
event.originalEvent.returnValue = event.result; event.originalEvent.returnValue = event.result;
} }
...@@ -685,7 +686,7 @@ jQuery.each({ ...@@ -685,7 +686,7 @@ jQuery.each({
}); });
// Create "bubbling" focus and blur events // Create "bubbling" focus and blur events
// Support: Firefox 10+ // Support: Firefox, Chrome, Safari
if ( !jQuery.support.focusinBubbles ) { if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
......
...@@ -318,7 +318,7 @@ jQuery.extend({ ...@@ -318,7 +318,7 @@ jQuery.extend({
clone = elem.cloneNode( true ), clone = elem.cloneNode( true ),
inPage = jQuery.contains( elem.ownerDocument, elem ); inPage = jQuery.contains( elem.ownerDocument, elem );
// Support: IE >=9 // Support: IE >= 9
// Fix Cloning issues // Fix Cloning issues
if ( !jQuery.support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { if ( !jQuery.support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
......
...@@ -12,6 +12,7 @@ jQuery.support = (function( support ) { ...@@ -12,6 +12,7 @@ jQuery.support = (function( support ) {
input.type = "checkbox"; input.type = "checkbox";
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
// Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere) // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
support.checkOn = input.value !== ""; support.checkOn = input.value !== "";
...@@ -38,7 +39,7 @@ jQuery.support = (function( support ) { ...@@ -38,7 +39,7 @@ jQuery.support = (function( support ) {
support.optDisabled = !opt.disabled; support.optDisabled = !opt.disabled;
// Check if an input maintains its value after becoming a radio // Check if an input maintains its value after becoming a radio
// Support: IE9, IE10, Opera // Support: IE9, IE10
input = document.createElement("input"); input = document.createElement("input");
input.value = "t"; input.value = "t";
input.type = "radio"; input.type = "radio";
...@@ -50,10 +51,11 @@ jQuery.support = (function( support ) { ...@@ -50,10 +51,11 @@ jQuery.support = (function( support ) {
fragment.appendChild( input ); fragment.appendChild( input );
// Support: Safari 5.1, Android 4.x, Android 2.3
// old WebKit doesn't clone checked state correctly in fragments // old WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: Firefox 17+ // Support: Firefox, Chrome, Safari
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
support.focusinBubbles = "onfocusin" in window; support.focusinBubbles = "onfocusin" in window;
...@@ -64,7 +66,8 @@ jQuery.support = (function( support ) { ...@@ -64,7 +66,8 @@ jQuery.support = (function( support ) {
// Run tests that need a body at doc ready // Run tests that need a body at doc ready
jQuery(function() { jQuery(function() {
var container, marginDiv, var container, marginDiv,
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",
body = document.getElementsByTagName("body")[ 0 ]; body = document.getElementsByTagName("body")[ 0 ];
if ( !body ) { if ( !body ) {
...@@ -78,7 +81,8 @@ jQuery.support = (function( support ) { ...@@ -78,7 +81,8 @@ jQuery.support = (function( support ) {
// Check box-sizing and margin behavior. // Check box-sizing and margin behavior.
body.appendChild( container ).appendChild( div ); body.appendChild( container ).appendChild( div );
div.innerHTML = ""; div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%";
// Workaround failing boxSizing test due to offsetWidth returning wrong value // Workaround failing boxSizing test due to offsetWidth returning wrong value
// with some non-1 values of body zoom, ticket #13543 // with some non-1 values of body zoom, ticket #13543
...@@ -91,9 +95,9 @@ jQuery.support = (function( support ) { ...@@ -91,9 +95,9 @@ jQuery.support = (function( support ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Support: Android 2.3
// Check if div with explicit width and no margin-right incorrectly // Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. (#3333) // gets computed margin-right based on width of container. (#3333)
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = div.appendChild( document.createElement("div") ); marginDiv = div.appendChild( document.createElement("div") );
marginDiv.style.cssText = div.style.cssText = divReset; marginDiv.style.cssText = div.style.cssText = divReset;
......
...@@ -1045,7 +1045,6 @@ module( "ajax", { ...@@ -1045,7 +1045,6 @@ module( "ajax", {
ok( jqXHR.statusText === "Hello" || jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" ); ok( jqXHR.statusText === "Hello" || jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" );
jQuery.ajax( url("data/statusText.php?status=404&text=World") ).fail(function( jqXHR, statusText ) { jQuery.ajax( url("data/statusText.php?status=404&text=World") ).fail(function( jqXHR, statusText ) {
strictEqual( statusText, "error", "callback status text ok for error" ); strictEqual( statusText, "error", "callback status text ok for error" );
// ok( jqXHR.statusText === "World" || jQuery.browser.safari && jqXHR.statusText === "Not Found", "jqXHR status text ok for error (" + jqXHR.statusText + ")" );
start(); start();
}); });
}); });
......
...@@ -775,7 +775,8 @@ test("Do not append px (#9548, #12990)", function() { ...@@ -775,7 +775,8 @@ test("Do not append px (#9548, #12990)", function() {
test("css('width') and css('height') should respect box-sizing, see #11004", function() { test("css('width') and css('height') should respect box-sizing, see #11004", function() {
expect( 4 ); expect( 4 );
var el_dis = jQuery("<div style='width:300px;height:300px;margin:2px;padding:2px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;'>test</div>"), // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
var el_dis = jQuery("<div style='width:300px;height:300px;margin:2px;padding:2px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;'>test</div>"),
el = el_dis.clone().appendTo("#qunit-fixture"); el = el_dis.clone().appendTo("#qunit-fixture");
equal( el.css("width"), el.css("width", el.css("width")).css("width"), "css('width') is not respecting box-sizing, see #11004"); equal( el.css("width"), el.css("width", el.css("width")).css("width"), "css('width') is not respecting box-sizing, see #11004");
......
...@@ -407,7 +407,8 @@ test( "getters on non elements should return null", function() { ...@@ -407,7 +407,8 @@ test( "getters on non elements should return null", function() {
test("setters with and without box-sizing:border-box", function(){ test("setters with and without box-sizing:border-box", function(){
expect(20); expect(20);
var el_bb = jQuery("<div style='width:114px;height:114px;margin:5px;padding:3px;border:4px solid white;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;'>test</div>").appendTo("#qunit-fixture"), // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
var el_bb = jQuery("<div style='width:114px;height:114px;margin:5px;padding:3px;border:4px solid white;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;'>test</div>").appendTo("#qunit-fixture"),
el = jQuery("<div style='width:100px;height:100px;margin:5px;padding:3px;border:4px solid white;'>test</div>").appendTo("#qunit-fixture"), el = jQuery("<div style='width:100px;height:100px;margin:5px;padding:3px;border:4px solid white;'>test</div>").appendTo("#qunit-fixture"),
expected = 100; expected = 100;
......
...@@ -18,8 +18,7 @@ var supportsScroll, supportsFixedPosition, ...@@ -18,8 +18,7 @@ var supportsScroll, supportsFixedPosition,
supportsScroll = document.documentElement.scrollTop || document.body.scrollTop; supportsScroll = document.documentElement.scrollTop || document.body.scrollTop;
forceScroll.detach(); forceScroll.detach();
// Safari subtracts parent border width here (which is 5px) supportsFixedPosition = checkFixed[0].offsetTop === 20;
supportsFixedPosition = checkFixed[0].offsetTop === 20 || checkFixed[0].offsetTop === 15;
checkFixed.remove(); checkFixed.remove();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment