See the pull request for more info on the dependency management details.
"src/selector.js",
"src/traversing.js",
"src/manipulation.js",
- "src/css.js",
+ { flag: "css", src: "src/css.js" },
"src/ajax.js",
"src/ajax/jsonp.js",
"src/ajax/script.js",
"src/ajax/xhr.js",
- { flag: "effects", src: "src/effects.js" },
- { flag: "offset", src: "src/offset.js" },
- { flag: "dimensions", src: "src/dimensions.js" },
+ { flag: "effects", src: "src/effects.js", needs: ["css"] },
+ { flag: "offset", src: "src/offset.js", needs: ["css"] },
+ { flag: "dimensions", src: "src/dimensions.js", needs: ["css"] },
"src/exports.js",
"src/outro.js"
]
"Concatenate source (include/exclude modules with +/- flags), embed date/version",
function() {
// Concat specified files.
- var compiled = "",
- modules = this.flags,
- optIn = !modules["*"],
- name = this.file.dest;
+ var i,
+ compiled = "",
+ modules = this.flags,
+ optIn = !modules["*"],
+ name = this.file.dest,
+ excluded = {},
+ excluder = function( flag, needsFlag ) {
+ // explicit > implicit, so set this first and let it be overridden by explicit
+ if ( optIn && !modules[ flag ] && !modules[ "+" + flag ] ) {
+ excluded[ flag ] = false;
+ }
+ if ( excluded[ needsFlag ] || modules[ "-" + flag ] ) {
+ // explicit exclusion from flag or dependency
+ excluded[ flag ] = true;
+ } else if ( modules[ "+" + flag ] && ( excluded[ needsFlag ] === false ) ) {
+ // explicit inclusion from flag or dependency overriding a weak inclusion
+ delete excluded[ needsFlag ];
+ }
+ };
+
+ // figure out which files to exclude based on these rules in this order:
+ // explicit > implicit (explicit also means a dependency/dependent that was explicit)
+ // exclude > include
+ // examples:
+ // *: none (implicit exclude)
+ // *:* all (implicit include)
+ // *:*:-effects all except effects (explicit > implicit)
+ // *:*:-css all except css and it's deps (explicit)
+ // *:*:-css:+effects all except css and it's deps (explicit exclude from dep. trumps explicit include)
+ // *:+effects none except effects and it's deps (explicit include from dep. trumps implicit exclude)
this.file.src.forEach(function( filepath ) {
- // Include optional modules per build flags; exclusion trumps inclusion
var flag = filepath.flag;
+
if ( flag ) {
- if ( modules[ "-" + flag ] ||
- optIn && !modules[ flag ] && !modules[ "+" + flag ] ) {
- log.writeln( "Excluding " + filepath.flag + ": '" + filepath.src + "'." );
+ excluder(flag);
+
+ // check for dependencies
+ if ( filepath.needs ) {
+ filepath.needs.forEach(function( needsFlag ) {
+ excluder( flag, needsFlag );
+ });
+ }
+ }
+ });
+
+ // conditionally concatenate source
+ this.file.src.forEach(function( filepath ) {
+ var flag = filepath.flag;
+ if ( flag ) {
+ if ( excluded[ flag ] !== undefined ) {
+ log.writeln( "Excluding " + flag + ": '" + filepath.src + "'." );
return;
}
- log.writeln( "Including " + filepath.flag + ": '" + filepath.src + "'." );
+ log.writeln( "Including " + flag + ": '" + filepath.src + "'." );
filepath = filepath.src;
}
- // Unwrap redundant IIFEs
compiled += file.read( filepath );
- //.replace( /^\(function\( jQuery \) \{|\}\)\( jQuery \);\s*$/g, "" );
});
// Embed Date
function loadFixture() {
var src = url("./data/" + fileName + ".html"),
- iframe = jQuery("<iframe />").css({
- width: 500, height: 500, position: "absolute", top: -600, left: -600, visibility: "hidden"
- }).appendTo("body")[0];
+ iframe = jQuery("<iframe />").appendTo("body")[0];
+ iframe.style.cssText = "width: 500px; height: 500px; position: absolute; top: -600px; left: -600px; visibility: hidden;";
iframe.contentWindow.location = src;
return iframe;
}
var $elem = jQuery("<div />"),
elem = $elem[0],
- expected = 5,
- attrObj = {
- css: { paddingLeft: 1, paddingRight: 1 }
- };
+ expected = 2,
+ attrObj = {};
if ( jQuery.fn.width ) {
expected += 2;
attrObj.offset = { top: 1, left: 0 };
}
+ if ( jQuery.css ) {
+ expected += 3;
+ attrObj.css = { paddingLeft: 1, paddingRight: 1 };
+ }
+
expect( expected );
// one at a time
$elem.attr( { text: "bar" }, true );
equal( elem.innerHTML, "bar", "attr(text)" );
- $elem.attr( { css: { color: "red" } }, true );
- ok( /^(#ff0000|red)$/i.test( elem.style.color ), "attr(css)" );
-
// Multiple attributes
$elem.attr( attrObj, true );
equal( elem.style.left, "1px", "attr(offset)" );
}
- equal( elem.style.paddingLeft, "1px", "attr({css:})" );
- equal( elem.style.paddingRight, "1px", "attr({css:})" );
+ if ( jQuery.css ) {
+ equal( elem.style.paddingLeft, "1px", "attr({css:})" );
+ equal( elem.style.paddingRight, "1px", "attr({css:})" );
+
+ $elem.attr( { css: { color: "red" } }, true );
+ ok( /^(#ff0000|red)$/i.test( elem.style.color ), "attr(css)" );
+ }
});
test("attr(String, Object) - Loaded via XML document", function() {
equal( jQuery("#foo").attr("style", "position:absolute;").removeAttr("style").attr("style"), undefined, "Check removing style attribute" );
equal( jQuery("#form").attr("style", "position:absolute;").removeAttr("style").attr("style"), undefined, "Check removing style attribute on a form" );
equal( jQuery("<div style='position: absolute'></div>").appendTo("#foo").removeAttr("style").prop("style").cssText, "", "Check removing style attribute (#9699 Webkit)" );
- equal( jQuery("#fx-test-group").attr("height", "3px").removeAttr("height").css("height"), "1px", "Removing height attribute has no effect on height set with style attribute" );
+ equal( jQuery("#fx-test-group").attr("height", "3px").removeAttr("height").get(0).style.height, "1px", "Removing height attribute has no effect on height set with style attribute" );
jQuery("#check1").removeAttr("checked").prop("checked", true).removeAttr("checked");
equal( document.getElementById("check1").checked, false, "removeAttr sets boolean properties to false" );
div = jQuery("<div/><hr/><code/><b/>"),
exec = false,
long = "",
- expected = 28,
+ expected = 26,
attrObj = {
- css: { paddingLeft: 1, paddingRight: 1 },
click: function() { ok( exec, "Click executed." ); },
text: "test",
"class": "test2",
attrObj.offset = { top: 1, left: 1 };
}
+ if ( jQuery.css ) {
+ expected += 2;
+ attrObj.css = { paddingLeft: 1, paddingRight: 1 };
+ }
+
expect( expected );
// Basic constructor's behavior
equal( elem[0].style.top, "1px", "jQuery() quick setter offset");
}
- equal( elem[0].style.paddingLeft, "1px", "jQuery quick setter css");
- equal( elem[0].style.paddingRight, "1px", "jQuery quick setter css");
+ if ( jQuery.css ) {
+ equal( elem[0].style.paddingLeft, "1px", "jQuery quick setter css");
+ equal( elem[0].style.paddingRight, "1px", "jQuery quick setter css");
+ }
+
equal( elem[0].childNodes.length, 1, "jQuery quick setter text");
equal( elem[0].firstChild.nodeValue, "test", "jQuery quick setter text");
equal( elem[0].className, "test2", "jQuery() quick setter class");
+if ( jQuery.css ) {
+
module("css", { teardown: moduleTeardown });
test("css(String|Hash)", function() {
});
});
+
+}
// Triggers 5
equal( $elem.triggerHandler("click", [1, "2", "abc"]), "test", "Verify handler response" );
- var pass = true;
+ var pass = true, elem2;
try {
- jQuery("#form input:first").hide().trigger("focus");
+ elem2 = jQuery("#form input:first");
+ elem2.get(0).style.display = "none";
+ elem2.trigger("focus");
} catch(e) {
pass = false;
}
test("trigger(eventObject, [data], [fn])", function() {
expect(28);
- var $parent = jQuery("<div id='par' />").hide().appendTo("body"),
+ var $parent = jQuery("<div id='par' />").appendTo("body"),
$child = jQuery("<p id='child'>foo</p>").appendTo( $parent );
+ $parent.get( 0 ).style.display = "none";
+
var event = jQuery.Event("noNew");
ok( event != window, "Instantiate jQuery.Event without the 'new' keyword" );
equal( event.type, "noNew", "Verify its type" );
var article = jQuery("article"),
aside = jQuery("aside");
- equal( article.css("fontSize"), "10px", "HTML5 elements are styleable");
+ equal( article.get( 0 ).style.fontSize, "10px", "HTML5 elements are styleable");
equal( aside.length, 1, "HTML5 elements do not collapse their children")
});
-test("HTML5 Elements inherit styles from style rules (Bug #10501)", function () {
- expect(1);
+if ( jQuery.css ) {
+ test("HTML5 Elements inherit styles from style rules (Bug #10501)", function () {
+ expect(1);
- jQuery("#qunit-fixture").append("<article id='article'></article>");
- jQuery("#article").append("<section>This section should have a pink background.</section>");
+ jQuery("#qunit-fixture").append("<article id='article'></article>");
+ jQuery("#article").append("<section>This section should have a pink background.</section>");
- // In IE, the missing background color will claim its value is "transparent"
- notEqual( jQuery("section").css("background-color"), "transparent", "HTML5 elements inherit styles");
-});
+ // In IE, the missing background color will claim its value is "transparent"
+ notEqual( jQuery("section").css("background-color"), "transparent", "HTML5 elements inherit styles");
+ });
+}
test("html5 clone() cannot use the fragment cache in IE (#6485)", function () {
expect(1);
$wraptarget.wrapAll("<aside style='background-color:green'></aside>");
- notEqual( $wraptarget.parent("aside").css("background-color"), "transparent", "HTML5 elements created with wrapAll inherit styles" );
- notEqual( $section.css("background-color"), "transparent", "HTML5 elements create with jQuery( string ) inherit styles" );
+ notEqual( $wraptarget.parent("aside").get( 0 ).style.backgroundColor, "transparent", "HTML5 elements created with wrapAll inherit styles" );
+ notEqual( $section.get( 0 ).style.backgroundColor, "transparent", "HTML5 elements create with jQuery( string ) inherit styles" );
});
test("Cloned, detached HTML5 elems (#10667,10670)", function() {
t( "Find elements with a tabindex attribute", "[tabindex]", ["listWithTabIndex", "foodWithNegativeTabIndex", "linkWithTabIndex", "linkWithNegativeTabIndex", "linkWithNoHrefWithTabIndex", "linkWithNoHrefWithNegativeTabIndex"] );
});
-test("pseudo - visibility", function() {
- expect( 9 );
-
- t( "Is Visible", "div:visible:not(#qunit-testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] );
- t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
- t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
-
- var $div = jQuery('<div/>').appendTo("body");
- $div.css({ fontSize: 0, lineHeight: 0 });// IE also needs to set font-size and line-height to 0
- $div.css( "width", 1 ).css( "height", 0 );
- t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] );
- t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
- $div.css( "width", 0 ).css( "height", 1 );
- t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] );
- t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
- $div.css( "width", 1 ).css( "height", 1 );
- t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] );
- t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
- $div.remove();
-});
+if ( jQuery.css ) {
+ test("pseudo - visibility", function() {
+ expect( 9 );
+
+ t( "Is Visible", "div:visible:not(#qunit-testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] );
+ t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
+ t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
+
+ var $div = jQuery('<div/>').appendTo("body");
+ $div.css({ fontSize: 0, lineHeight: 0 });// IE also needs to set font-size and line-height to 0
+ $div.css( "width", 1 ).css( "height", 0 );
+ t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] );
+ t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
+ $div.css( "width", 0 ).css( "height", 1 );
+ t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] );
+ t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
+ $div.css( "width", 1 ).css( "height", 1 );
+ t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] );
+ t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
+ $div.remove();
+ });
+}
test("disconnected nodes", function() {
expect( 4 );
equal( jQuery.support.boxModel, document.compatMode === "CSS1Compat" , "jQuery.support.boxModel is sort of tied to quirks mode but unstable since 1.8" );
});
-testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9238)", "support/bodyBackground", function( color, support ) {
- expect( 2 );
- var i,
- passed = true,
- okValue = {
- "#000000": true,
- "rgb(0, 0, 0)": true
- };
- ok( okValue[ color ], "color was not reset (" + color + ")" );
+if ( jQuery.css ) {
+ testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9238)", "support/bodyBackground", function( color, support ) {
+ expect( 2 );
+ var i,
+ passed = true,
+ okValue = {
+ "#000000": true,
+ "rgb(0, 0, 0)": true
+ };
+ ok( okValue[ color ], "color was not reset (" + color + ")" );
- for ( i in jQuery.support ) {
- if ( jQuery.support[ i ] !== support[ i ] ) {
- passed = false;
- strictEqual( jQuery.support[ i ], support[ i ], "Support property " + i + " is different" );
+ for ( i in jQuery.support ) {
+ if ( jQuery.support[ i ] !== support[ i ] ) {
+ passed = false;
+ strictEqual( jQuery.support[ i ], support[ i ], "Support property " + i + " is different" );
+ }
}
- }
- for ( i in support ) {
- if ( !( i in jQuery.support ) ) {
- passed = false;
- strictEqual( jQuery.support[ i ], support[ i ], "Unexpected property: " + i );
+ for ( i in support ) {
+ if ( !( i in jQuery.support ) ) {
+ passed = false;
+ strictEqual( jQuery.support[ i ], support[ i ], "Unexpected property: " + i );
+ }
}
- }
- ok( passed, "Same support properties" );
-});
+ ok( passed, "Same support properties" );
+ });
+}
testIframeWithCallback( "A background on the testElement does not cause IE8 to crash (#9823)", "support/testElementCrash", function() {
expect(1);