X Tutup
Skip to content

Commit dca7681

Browse files
mgoldmethvin
authored andcommitted
Improve CSS and Support: comments. Close jquerygh-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
1 parent 1b61026 commit dca7681

File tree

9 files changed

+25
-18
lines changed

9 files changed

+25
-18
lines changed

src/core.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ jQuery.extend({
409409
if ( obj == null ) {
410410
return String( obj );
411411
}
412-
// Support: Safari <=5.1 (functionish RegExp)
412+
// Support: Safari <= 5.1 (functionish RegExp)
413413
return typeof obj === "object" || typeof obj === "function" ?
414414
class2type[ core_toString.call(obj) ] || "object" :
415415
typeof obj;
@@ -424,9 +424,10 @@ jQuery.extend({
424424
return false;
425425
}
426426

427-
// Support: Firefox >16
427+
// Support: Firefox <20
428428
// The try/catch suppresses exceptions thrown when attempting to access
429429
// the "constructor" property of certain host objects, ie. |window.location|
430+
// https://bugzilla.mozilla.org/show_bug.cgi?id=814622
430431
try {
431432
if ( obj.constructor &&
432433
!core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {

src/css.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,8 @@ curCSS = function( elem, name, _computed ) {
295295
ret = jQuery.style( elem, name );
296296
}
297297

298-
// Support: Chrome <17, Safari 5.1
298+
// Support: Safari 5.1
299299
// A tribute to the "awesome hack by Dean Edwards"
300-
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
301300
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
302301
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
303302
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
@@ -484,10 +483,12 @@ jQuery.each([ "height", "width" ], function( i, name ) {
484483
// These hooks cannot be added until DOM ready because the support test
485484
// for it is not run until after DOM ready
486485
jQuery(function() {
486+
// Support: Android 2.3
487487
if ( !jQuery.support.reliableMarginRight ) {
488488
jQuery.cssHooks.marginRight = {
489489
get: function( elem, computed ) {
490490
if ( computed ) {
491+
// Support: Android 2.3
491492
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
492493
// Work around by temporarily setting element display to inline-block
493494
return jQuery.swap( elem, { "display": "inline-block" },

src/event.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ jQuery.event = {
508508
event[ prop ] = originalEvent[ prop ];
509509
}
510510

511-
// Support: Chrome 23+, Safari?
511+
// Support: Safari 6.0+, Chrome < 28
512512
// Target should not be a text node (#504, #13143)
513513
if ( event.target.nodeType === 3 ) {
514514
event.target = event.target.parentNode;
@@ -554,7 +554,8 @@ jQuery.event = {
554554
beforeunload: {
555555
postDispatch: function( event ) {
556556

557-
// Support: Firefox 10+
557+
// Support: Firefox 20+
558+
// Firefox doesn't alert if the returnValue field is not set.
558559
if ( event.result !== undefined ) {
559560
event.originalEvent.returnValue = event.result;
560561
}
@@ -685,7 +686,7 @@ jQuery.each({
685686
});
686687

687688
// Create "bubbling" focus and blur events
688-
// Support: Firefox 10+
689+
// Support: Firefox, Chrome, Safari
689690
if ( !jQuery.support.focusinBubbles ) {
690691
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
691692

src/manipulation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ jQuery.extend({
318318
clone = elem.cloneNode( true ),
319319
inPage = jQuery.contains( elem.ownerDocument, elem );
320320

321-
// Support: IE >=9
321+
// Support: IE >= 9
322322
// Fix Cloning issues
323323
if ( !jQuery.support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
324324

src/support.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jQuery.support = (function( support ) {
1212

1313
input.type = "checkbox";
1414

15+
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
1516
// Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
1617
support.checkOn = input.value !== "";
1718

@@ -38,7 +39,7 @@ jQuery.support = (function( support ) {
3839
support.optDisabled = !opt.disabled;
3940

4041
// Check if an input maintains its value after becoming a radio
41-
// Support: IE9, IE10, Opera
42+
// Support: IE9, IE10
4243
input = document.createElement("input");
4344
input.value = "t";
4445
input.type = "radio";
@@ -50,10 +51,11 @@ jQuery.support = (function( support ) {
5051

5152
fragment.appendChild( input );
5253

54+
// Support: Safari 5.1, Android 4.x, Android 2.3
5355
// old WebKit doesn't clone checked state correctly in fragments
5456
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
5557

56-
// Support: Firefox 17+
58+
// Support: Firefox, Chrome, Safari
5759
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
5860
support.focusinBubbles = "onfocusin" in window;
5961

@@ -64,7 +66,8 @@ jQuery.support = (function( support ) {
6466
// Run tests that need a body at doc ready
6567
jQuery(function() {
6668
var container, marginDiv,
67-
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
69+
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
70+
divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",
6871
body = document.getElementsByTagName("body")[ 0 ];
6972

7073
if ( !body ) {
@@ -78,7 +81,8 @@ jQuery.support = (function( support ) {
7881
// Check box-sizing and margin behavior.
7982
body.appendChild( container ).appendChild( div );
8083
div.innerHTML = "";
81-
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%;";
84+
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
85+
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%";
8286

8387
// Workaround failing boxSizing test due to offsetWidth returning wrong value
8488
// with some non-1 values of body zoom, ticket #13543
@@ -91,9 +95,9 @@ jQuery.support = (function( support ) {
9195
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
9296
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
9397

98+
// Support: Android 2.3
9499
// Check if div with explicit width and no margin-right incorrectly
95100
// gets computed margin-right based on width of container. (#3333)
96-
// Fails in WebKit before Feb 2011 nightlies
97101
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
98102
marginDiv = div.appendChild( document.createElement("div") );
99103
marginDiv.style.cssText = div.style.cssText = divReset;

test/unit/ajax.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,6 @@ module( "ajax", {
10451045
ok( jqXHR.statusText === "Hello" || jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" );
10461046
jQuery.ajax( url("data/statusText.php?status=404&text=World") ).fail(function( jqXHR, statusText ) {
10471047
strictEqual( statusText, "error", "callback status text ok for error" );
1048-
// ok( jqXHR.statusText === "World" || jQuery.browser.safari && jqXHR.statusText === "Not Found", "jqXHR status text ok for error (" + jqXHR.statusText + ")" );
10491048
start();
10501049
});
10511050
});

test/unit/css.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,8 @@ test("Do not append px (#9548, #12990)", function() {
775775
test("css('width') and css('height') should respect box-sizing, see #11004", function() {
776776
expect( 4 );
777777

778-
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>"),
778+
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
779+
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>"),
779780
el = el_dis.clone().appendTo("#qunit-fixture");
780781

781782
equal( el.css("width"), el.css("width", el.css("width")).css("width"), "css('width') is not respecting box-sizing, see #11004");

test/unit/dimensions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ test( "getters on non elements should return null", function() {
407407
test("setters with and without box-sizing:border-box", function(){
408408
expect(20);
409409

410-
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"),
410+
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
411+
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"),
411412
el = jQuery("<div style='width:100px;height:100px;margin:5px;padding:3px;border:4px solid white;'>test</div>").appendTo("#qunit-fixture"),
412413
expected = 100;
413414

test/unit/offset.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ var supportsScroll, supportsFixedPosition,
1818
supportsScroll = document.documentElement.scrollTop || document.body.scrollTop;
1919
forceScroll.detach();
2020

21-
// Safari subtracts parent border width here (which is 5px)
22-
supportsFixedPosition = checkFixed[0].offsetTop === 20 || checkFixed[0].offsetTop === 15;
21+
supportsFixedPosition = checkFixed[0].offsetTop === 20;
2322
checkFixed.remove();
2423
};
2524

0 commit comments

Comments
 (0)
X Tutup