From 73158618131bd3b67e0a152000754c0d39b2519e Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Thu, 15 Aug 2013 20:38:48 -0400 Subject: [PATCH] Specify support as a dependency wherever it is used. Optimize module order to save 15 bytes. Conflicts: src/css.js src/manipulation.js src/offset.js src/support.js --- README.md | 2 +- src/ajax/xhr.js | 3 ++- src/attributes/attr.js | 3 ++- src/attributes/prop.js | 3 ++- src/attributes/val.js | 3 ++- src/css.js | 3 ++- src/jquery.js | 4 ++-- src/manipulation.js | 3 ++- src/offset.js | 5 +++-- src/support.js | 4 +++- 10 files changed, 21 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1ce0b0d8b..65cb95d7f 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Some example modules that can be excluded are: - **offset**: The `.offset()`, `.position()`, `.offsetParent()`, `.scrollLeft()`, and `.scrollTop()` methods. - **wrap**: The `.wrap()`, `.wrapAll()`, `.wrapInner()`, and `.unwrap()` methods. - **exports/amd**: Exclude the AMD definition. -- **core/ready**: Exclude the ready module if you place your scripts at the end of the body. Any ready callbacks will simply be called immediately. +- **core/ready**: Exclude the ready module if you place your scripts at the end of the body. Any ready callbacks bound with `jQuery()` will simply be called immediately. However, `jQuery(document).ready()` will not be a function and `.on("ready", ...)` or similar will not be triggered. - **deferred**: Exclude jQuery.Deferred. This also removes jQuery.Callbacks. *Note* that modules that depend on jQuery.Deferred(AJAX, effects, core/ready) will not be removed and will still expect jQuery.Deferred to be there. Include your own jQuery.Deferred implementation or exclude those modules as well (`grunt custom:-deferred,-ajax,-effects,-core/ready`). - **support**: Excluding the support module is not recommended, but possible. It's your responsibility to either remove modules that use jQuery.support (many of them) or replace the values wherever jQuery.support is used. This is mainly only useful when building a barebones version of jQuery. diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index 637df0082..ab5bd5e1e 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -1,6 +1,7 @@ define([ "../core", - "../ajax" + "../ajax", + "../support" ], function( jQuery ) { var xhrCallbacks, xhrSupported, diff --git a/src/attributes/attr.js b/src/attributes/attr.js index 96bfb756f..b282d1123 100644 --- a/src/attributes/attr.js +++ b/src/attributes/attr.js @@ -2,7 +2,8 @@ define([ "../core", "../var/rnotwhite", "../var/strundefined", - "../selector" + "../selector", + "../support" ], function( jQuery, rnotwhite, strundefined ) { var nodeHook, boolHook, diff --git a/src/attributes/prop.js b/src/attributes/prop.js index a517b0d3a..490f2ef4a 100644 --- a/src/attributes/prop.js +++ b/src/attributes/prop.js @@ -1,5 +1,6 @@ define([ - "../core" + "../core", + "../support" ], function( jQuery ) { var rfocusable = /^(?:input|select|textarea|button|object)$/i, diff --git a/src/attributes/val.js b/src/attributes/val.js index 58fe56c3c..074d23f8c 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -1,5 +1,6 @@ define([ - "../core" + "../core", + "../support" ], function( jQuery ) { var rreturn = /\r/g; diff --git a/src/css.js b/src/css.js index ad345b062..86399aa51 100644 --- a/src/css.js +++ b/src/css.js @@ -5,7 +5,8 @@ define([ "./css/var/isHidden", "./css/defaultDisplay", "./core/swap", - "./selector" // contains + "./selector", // contains + "./support" ], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay ) { var getStyles, curCSS, diff --git a/src/jquery.js b/src/jquery.js index ce3ad8e2f..644f29255 100644 --- a/src/jquery.js +++ b/src/jquery.js @@ -1,10 +1,11 @@ define([ "./core", "./selector", + "./traversing", "./callbacks", "./deferred", "./core/ready", - "./traversing", + "./support", "./data", "./queue", "./queue/delay", @@ -26,7 +27,6 @@ define([ "./effects/animated-selector", "./offset", "./dimensions", - "./support", "./deprecated" ], function( jQuery ) { diff --git a/src/manipulation.js b/src/manipulation.js index d5bdacb45..8cc7624bf 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -7,7 +7,8 @@ define([ "./data/accepts", "./selector", "./traversing", - "./event" + "./event", + "./support" ], function( jQuery, concat, push, deletedIds, rcheckableType ){ function createSafeFragment( document ) { diff --git a/src/offset.js b/src/offset.js index 67b5db454..9172a715d 100644 --- a/src/offset.js +++ b/src/offset.js @@ -2,7 +2,7 @@ define([ "./core", "./var/strundefined", "./css", - "./selector" + "./selector" // contains ], function( jQuery, strundefined ) { var docElem = window.document.documentElement; @@ -133,7 +133,8 @@ jQuery.fn.extend({ offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent || docElem; - while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) { + + while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { offsetParent = offsetParent.offsetParent; } return offsetParent || docElem; diff --git a/src/support.js b/src/support.js index 147cb4ddf..705a5b0fd 100644 --- a/src/support.js +++ b/src/support.js @@ -1,7 +1,9 @@ define([ "./core", "./var/strundefined", - "./core/swap" + "./core/swap", + // This is listed as a dependency for build order, but it's still optional in builds + "./core/ready" ], function( jQuery, strundefined ) { jQuery.support = (function( support ) { -- 2.39.5