]> source.dussan.org Git - jquery.git/commitdiff
Improve CSS and `Support:` comments. Close gh-1220.
authorMichał Gołębiowski <m.goleb@gmail.com>
Thu, 4 Apr 2013 20:04:39 +0000 (22:04 +0200)
committerDave Methvin <dave.methvin@gmail.com>
Sat, 6 Apr 2013 21:09:52 +0000 (17:09 -0400)
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

src/core.js
src/css.js
src/event.js
src/manipulation.js
src/support.js
test/unit/ajax.js
test/unit/css.js
test/unit/dimensions.js
test/unit/offset.js

index 9a288fa1b11511742ada646f0d94074e067ad223..a35e79893ffca913c932826d2926aff4324bb9d0 100644 (file)
@@ -409,7 +409,7 @@ jQuery.extend({
                if ( obj == null ) {
                        return String( obj );
                }
-               // Support: Safari <=5.1 (functionish RegExp)
+               // Support: Safari <= 5.1 (functionish RegExp)
                return typeof obj === "object" || typeof obj === "function" ?
                        class2type[ core_toString.call(obj) ] || "object" :
                        typeof obj;
@@ -424,9 +424,10 @@ jQuery.extend({
                        return false;
                }
 
-               // Support: Firefox >16
+               // Support: Firefox <20
                // The try/catch suppresses exceptions thrown when attempting to access
                // the "constructor" property of certain host objects, ie. |window.location|
+               // https://bugzilla.mozilla.org/show_bug.cgi?id=814622
                try {
                        if ( obj.constructor &&
                                        !core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
index 522982b3f772d775df1c72e5032bca2d3225a933..bbd56ad7bbbd8df0d2184d58c01d9e101bbcef87 100644 (file)
@@ -295,9 +295,8 @@ curCSS = function( elem, name, _computed ) {
                        ret = jQuery.style( elem, name );
                }
 
-               // Support: Chrome <17, Safari 5.1
+               // Support: Safari 5.1
                // 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
                // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
                if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
@@ -484,10 +483,12 @@ jQuery.each([ "height", "width" ], function( i, name ) {
 // These hooks cannot be added until DOM ready because the support test
 // for it is not run until after DOM ready
 jQuery(function() {
+       // Support: Android 2.3
        if ( !jQuery.support.reliableMarginRight ) {
                jQuery.cssHooks.marginRight = {
                        get: function( elem, computed ) {
                                if ( computed ) {
+                                       // Support: Android 2.3
                                        // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
                                        // Work around by temporarily setting element display to inline-block
                                        return jQuery.swap( elem, { "display": "inline-block" },
index a9620e2415839e79691b7691660fd6f44af4bbff..45e82ccc4d50eb615afb74f0ae6731ffefb7dc24 100644 (file)
@@ -508,7 +508,7 @@ jQuery.event = {
                        event[ prop ] = originalEvent[ prop ];
                }
 
-               // Support: Chrome 23+, Safari?
+               // Support: Safari 6.0+, Chrome < 28
                // Target should not be a text node (#504, #13143)
                if ( event.target.nodeType === 3 ) {
                        event.target = event.target.parentNode;
@@ -554,7 +554,8 @@ jQuery.event = {
                beforeunload: {
                        postDispatch: function( event ) {
 
-                               // Support: Firefox 10+
+                               // Support: Firefox 20+
+                               // Firefox doesn't alert if the returnValue field is not set.
                                if ( event.result !== undefined ) {
                                        event.originalEvent.returnValue = event.result;
                                }
@@ -685,7 +686,7 @@ jQuery.each({
 });
 
 // Create "bubbling" focus and blur events
-// Support: Firefox 10+
+// Support: Firefox, Chrome, Safari
 if ( !jQuery.support.focusinBubbles ) {
        jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
 
index f3c729fdfb04738d03cd1a13516775d95be2b97d..8f042269425e48e0c30821dc4d381a410fb561ce 100644 (file)
@@ -318,7 +318,7 @@ jQuery.extend({
                        clone = elem.cloneNode( true ),
                        inPage = jQuery.contains( elem.ownerDocument, elem );
 
-               // Support: IE >=9
+               // Support: IE >= 9
                // Fix Cloning issues
                if ( !jQuery.support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
 
index 52f832f427f7c90a521995931bc169f0f2cb7738..a28fb971fd352baa7e32842704bd8f3d3208f93c 100644 (file)
@@ -12,6 +12,7 @@ jQuery.support = (function( support ) {
 
        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)
        support.checkOn = input.value !== "";
 
@@ -38,7 +39,7 @@ jQuery.support = (function( support ) {
        support.optDisabled = !opt.disabled;
 
        // Check if an input maintains its value after becoming a radio
-       // Support: IE9, IE10, Opera
+       // Support: IE9, IE10
        input = document.createElement("input");
        input.value = "t";
        input.type = "radio";
@@ -50,10 +51,11 @@ jQuery.support = (function( support ) {
 
        fragment.appendChild( input );
 
+       // Support: Safari 5.1, Android 4.x, Android 2.3
        // old WebKit doesn't clone checked state correctly in fragments
        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)
        support.focusinBubbles = "onfocusin" in window;
 
@@ -64,7 +66,8 @@ jQuery.support = (function( support ) {
        // Run tests that need a body at doc ready
        jQuery(function() {
                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 ];
 
                if ( !body ) {
@@ -78,7 +81,8 @@ jQuery.support = (function( support ) {
                // Check box-sizing and margin behavior.
                body.appendChild( container ).appendChild( div );
                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
                // with some non-1 values of body zoom, ticket #13543
@@ -91,9 +95,9 @@ jQuery.support = (function( support ) {
                        support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
                        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
                        // 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
                        marginDiv = div.appendChild( document.createElement("div") );
                        marginDiv.style.cssText = div.style.cssText = divReset;
index a0a2abf4aac85023b2790966abd1bbe65f9ec0d6..0de0da05f0c6aa9d246d3be0b0223d829721d899 100644 (file)
@@ -1045,7 +1045,6 @@ module( "ajax", {
                        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 ) {
                                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();
                        });
                });
index dc851f745776180c588da8bbce42ee44830e7938..8a2ecfb60d1a1d303f951c9d0cd096393963d294 100644 (file)
@@ -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() {
        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");
 
        equal( el.css("width"), el.css("width", el.css("width")).css("width"), "css('width') is not respecting box-sizing, see #11004");
index bcb7b7f2c530a4e966b6c93320b17e09571a1828..c7d1281f2df64ef3a0dfe325cb18cafaaaddb6d8 100644 (file)
@@ -407,7 +407,8 @@ test( "getters on non elements should return null", function() {
 test("setters with and without box-sizing:border-box", function(){
        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"),
                expected = 100;
 
index 08b90c3b8a8d925cf17d31a5032bdd63267cfbd4..0d8bcc726c7c6ca4804fb235d1fa73b1f8dee3f9 100644 (file)
@@ -18,8 +18,7 @@ var supportsScroll, supportsFixedPosition,
                supportsScroll = document.documentElement.scrollTop || document.body.scrollTop;
                forceScroll.detach();
 
-               // Safari subtracts parent border width here (which is 5px)
-               supportsFixedPosition = checkFixed[0].offsetTop === 20 || checkFixed[0].offsetTop === 15;
+               supportsFixedPosition = checkFixed[0].offsetTop === 20;
                checkFixed.remove();
        };