From f87b4e0f4ac2342dff260c32aa8d08148e76f7a4 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 21 Dec 2012 18:26:56 +0100 Subject: Build: Migrate to grunt 0.4. Rename to Gruntfile, upgrade to newer grunt-css and grunt-html, update custom tasks. Drop qunit-junit plugin, not worth the trouble. Update release script to run grunt-prepare after npm-install. --- build/release/release.js | 3 +++ build/tasks/build.js | 52 ++++++++++++++++++++++-------------------------- 2 files changed, 27 insertions(+), 28 deletions(-) (limited to 'build') diff --git a/build/release/release.js b/build/release/release.js index 2eab5283f..6a387494b 100644 --- a/build/release/release.js +++ b/build/release/release.js @@ -72,6 +72,9 @@ function cloneRepo() { if ( exec( "npm install download.jqueryui.com" ).code !== 0 ) { abort( "Error installing dependencies." ); } + if ( exec( "cd node_modules/download.jqueryui.com && grunt prepare" ).code !== 0 ) { + abort( "Error installing dependencies." ); + } } echo(); } diff --git a/build/tasks/build.js b/build/tasks/build.js index a8f25f98f..978bee004 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -5,6 +5,19 @@ module.exports = function( grunt ) { var path = require( "path" ), fs = require( "fs" ); +function expandFiles( files ) { + return grunt.util._.pluck( grunt.file.expandMapping( files ), "src" ).filter(function(filepath) { + // restrict to files, exclude folders + try { + return fs.statSync( filepath[ 0 ] ).isFile(); + } catch(e) { + throw grunt.task.taskError(e.message, e); + } + }).map(function( values ) { + return values[ 0 ]; + }); +} + grunt.registerTask( "manifest", "Generate jquery.json manifest files", function() { var pkg = grunt.config( "pkg" ), base = { @@ -97,8 +110,8 @@ grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @ grunt.file.copy( src, dest ); } } - var files = grunt.file.expandFiles( this.file.src ), - target = this.file.dest + "/", + var files = expandFiles( this.filesSrc ), + target = this.data.dest + "/", strip = this.data.strip, renameCount = 0, fileName; @@ -121,28 +134,11 @@ grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @ grunt.registerMultiTask( "zip", "Create a zip file for release", function() { - // TODO switch back to adm-zip for better cross-platform compability once it actually works - // 0.1.3 works, but result can't be unzipped - // its also a lot slower then zip program, probably due to how its used... - // var files = grunt.file.expandFiles( "dist/" + this.file.src + "/**/*" ); - // grunt.log.writeln( "Creating zip file " + this.file.dest ); - - //var AdmZip = require( "adm-zip" ); - //var zip = new AdmZip(); - //files.forEach(function( file ) { - // grunt.verbose.writeln( "Zipping " + file ); - // // rewrite file names from dist folder (created by build), drop the /dist part - // zip.addFile(file.replace(/^dist/, "" ), fs.readFileSync( file ) ); - //}); - //zip.writeZip( "dist/" + this.file.dest ); - //grunt.log.writeln( "Wrote " + files.length + " files to " + this.file.dest ); - var done = this.async(), - dest = this.file.dest, - src = grunt.template.process( this.file.src, grunt.config() ); - grunt.utils.spawn({ + dest = this.data.dest; + grunt.util.spawn({ cmd: "zip", - args: [ "-r", dest, src ], + args: [ "-r", dest, this.data.src ], opts: { cwd: 'dist' } @@ -159,19 +155,19 @@ grunt.registerMultiTask( "zip", "Create a zip file for release", function() { grunt.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", function() { // remove dest file before creating it, to make sure itself is not included - if ( fs.existsSync( this.file.dest ) ) { - fs.unlinkSync( this.file.dest ); + if ( fs.existsSync( this.data.dest ) ) { + fs.unlinkSync( this.data.dest ); } var crypto = require( "crypto" ), - dir = this.file.src + "/", + dir = this.filesSrc + "/", hashes = []; - grunt.file.expandFiles( dir + "**/*" ).forEach(function( fileName ) { + expandFiles( dir + "**/*" ).forEach(function( fileName ) { var hash = crypto.createHash( "md5" ); hash.update( grunt.file.read( fileName, "ascii" ) ); hashes.push( fileName.replace( dir, "" ) + " " + hash.digest( "hex" ) ); }); - grunt.file.write( this.file.dest, hashes.join( "\n" ) + "\n" ); - grunt.log.writeln( "Wrote " + this.file.dest + " with " + hashes.length + " hashes" ); + grunt.file.write( this.data.dest, hashes.join( "\n" ) + "\n" ); + grunt.log.writeln( "Wrote " + this.data.dest + " with " + hashes.length + " hashes" ); }); grunt.registerTask( "generate_themes", function() { -- cgit v1.2.3 From ae3af7f0700ae035183a4f9d9a8c6752189abbe3 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 12 Mar 2013 11:00:21 +0100 Subject: Build: Don't call DB's grunt-prepare task, not needed anymore --- build/release/release.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'build') diff --git a/build/release/release.js b/build/release/release.js index 6a387494b..2eab5283f 100644 --- a/build/release/release.js +++ b/build/release/release.js @@ -72,9 +72,6 @@ function cloneRepo() { if ( exec( "npm install download.jqueryui.com" ).code !== 0 ) { abort( "Error installing dependencies." ); } - if ( exec( "cd node_modules/download.jqueryui.com && grunt prepare" ).code !== 0 ) { - abort( "Error installing dependencies." ); - } } echo(); } -- cgit v1.2.3 From 0cc40d799ffdf7aa978f910b890915ee6ad7a2b8 Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 15 Mar 2013 06:40:51 -0400 Subject: Dialog: Removed deprecated position handling. Fixes #8825 - Dialog: Remove array and string notations for position option. --- Gruntfile.js | 2 +- build/tasks/testswarm.js | 1 - tests/unit/all.html | 1 - tests/unit/dialog/dialog_deprecated.html | 67 -------------------------------- tests/unit/dialog/dialog_deprecated.js | 63 ------------------------------ ui/jquery.ui.dialog.js | 50 ------------------------ 6 files changed, 1 insertion(+), 183 deletions(-) delete mode 100644 tests/unit/dialog/dialog_deprecated.html delete mode 100644 tests/unit/dialog/dialog_deprecated.js (limited to 'build') diff --git a/Gruntfile.js b/Gruntfile.js index ff64f0c0d..05f599dd5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -318,7 +318,7 @@ grunt.initConfig({ files: expandFiles( "tests/unit/**/*.html" ).filter(function( file ) { // disabling everything that doesn't (quite) work with PhantomJS for now // TODO except for all|index|test, try to include more as we go - return !( /(all|index|test|dialog|dialog_deprecated|tabs|tooltip)\.html$/ ).test( file ); + return !( /(all|index|test|dialog|tabs|tooltip)\.html$/ ).test( file ); }) }, jshint: { diff --git a/build/tasks/testswarm.js b/build/tasks/testswarm.js index 3361b7fa9..d747d16f9 100644 --- a/build/tasks/testswarm.js +++ b/build/tasks/testswarm.js @@ -16,7 +16,6 @@ var versions = { "Core": "core/core.html", "Datepicker": "datepicker/datepicker.html", "Dialog": "dialog/dialog.html", - "Dialog_deprecated": "dialog/dialog_deprecated.html", "Draggable": "draggable/draggable.html", "Droppable": "droppable/droppable.html", "Effects": "effects/effects.html", diff --git a/tests/unit/all.html b/tests/unit/all.html index ba96feef2..22b1802dc 100644 --- a/tests/unit/all.html +++ b/tests/unit/all.html @@ -22,7 +22,6 @@ "core/core.html", "datepicker/datepicker.html", "dialog/dialog.html", - "dialog/dialog_deprecated.html", "draggable/draggable.html", "droppable/droppable.html", "effects/effects.html", diff --git a/tests/unit/dialog/dialog_deprecated.html b/tests/unit/dialog/dialog_deprecated.html deleted file mode 100644 index 1f8bac689..000000000 --- a/tests/unit/dialog/dialog_deprecated.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - jQuery UI Dialog Test Suite - - - - - - - - - - - - - - - - - - - - -

jQuery UI Dialog Test Suite

-

-
-

-
    -
    -
    -
    -
    -
    - Please share some personal information - - -
    -
    -

    Some more (optional) information

    - -
    -
    -
    -
    -
    - - diff --git a/tests/unit/dialog/dialog_deprecated.js b/tests/unit/dialog/dialog_deprecated.js deleted file mode 100644 index ff6284ea5..000000000 --- a/tests/unit/dialog/dialog_deprecated.js +++ /dev/null @@ -1,63 +0,0 @@ -module("dialog (deprecated): position option with string and array"); - -test( "position, right bottom on window w/array", function() { - expect( 2 ); - - // dialogs alter the window width and height in FF and IE7 - // so we collect that information before creating the dialog - // Support: FF, IE7 - var winWidth = $( window ).width(), - winHeight = $( window ).height(), - element = $("
    ").dialog({ position: [ "right", "bottom" ] }), - dialog = element.dialog("widget"), - offset = dialog.offset(); - closeEnough( offset.left, winWidth - dialog.outerWidth() + $( window ).scrollLeft(), 1, "offset left of right bottom on window w/array" ); - closeEnough( offset.top, winHeight - dialog.outerHeight() + $( window ).scrollTop(), 1, "offset top of right bottom on window w/array" ); - element.remove(); -}); - -test( "position, right bottom on window", function() { - expect( 2 ); - - // dialogs alter the window width and height in FF and IE7 - // so we collect that information before creating the dialog - // Support: FF, IE7 - var winWidth = $( window ).width(), - winHeight = $( window ).height(), - element = $("
    ").dialog({ position: "right bottom" }), - dialog = element.dialog("widget"), - offset = dialog.offset(); - closeEnough( offset.left, winWidth - dialog.outerWidth() + $( window ).scrollLeft(), 1, "offset left of right bottom on window" ); - closeEnough( offset.top, winHeight - dialog.outerHeight() + $( window ).scrollTop(), 1, "offset top of right bottom on window" ); - element.remove(); -}); - -test("position, offset from top left w/array", function() { - expect( 2 ); - var element = $("
    ").dialog({ position: [10, 10] }), - dialog = element.dialog("widget"), - offset = dialog.offset(); - closeEnough(offset.left, 10 + $(window).scrollLeft(), 1); - closeEnough(offset.top, 10 + $(window).scrollTop(), 1); - element.remove(); -}); - -test("position, top on window", function() { - expect( 2 ); - var element = $("
    ").dialog({ position: "top" }), - dialog = element.dialog("widget"), - offset = dialog.offset(); - closeEnough(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft(), 1); - closeEnough(offset.top, $(window).scrollTop(), 1); - element.remove(); -}); - -test("position, left on window", function() { - expect( 2 ); - var element = $("
    ").dialog({ position: "left" }), - dialog = element.dialog("widget"), - offset = dialog.offset(); - closeEnough(offset.left, 0, 1); - closeEnough(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop(), 1); - element.remove(); -}); diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index b35c0ffcf..59a7961ed 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -755,54 +755,4 @@ $.widget( "ui.dialog", { $.ui.dialog.overlayInstances = 0; -// DEPRECATED -if ( $.uiBackCompat !== false ) { - // position option with array notation - // just override with old implementation - $.widget( "ui.dialog", $.ui.dialog, { - _position: function() { - var position = this.options.position, - myAt = [], - offset = [ 0, 0 ], - isVisible; - - if ( position ) { - if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) { - myAt = position.split ? position.split(" ") : [ position[0], position[1] ]; - if ( myAt.length === 1 ) { - myAt[1] = myAt[0]; - } - - $.each( [ "left", "top" ], function( i, offsetPosition ) { - if ( +myAt[ i ] === myAt[ i ] ) { - offset[ i ] = myAt[ i ]; - myAt[ i ] = offsetPosition; - } - }); - - position = { - my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " + - myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]), - at: myAt.join(" ") - }; - } - - position = $.extend( {}, $.ui.dialog.prototype.options.position, position ); - } else { - position = $.ui.dialog.prototype.options.position; - } - - // need to show the dialog to get the actual offset in the position plugin - isVisible = this.uiDialog.is(":visible"); - if ( !isVisible ) { - this.uiDialog.show(); - } - this.uiDialog.position( position ); - if ( !isVisible ) { - this.uiDialog.hide(); - } - } - }); -} - }( jQuery ) ); -- cgit v1.2.3 From 932caaf2ddf70c889003d5b42eee4f069d2dd296 Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 15 Mar 2013 07:01:24 -0400 Subject: Core: Deprecated .zIndex(). Fixes #9061 - Core: Deprecate .zIndex(). --- build/tasks/testswarm.js | 1 + tests/unit/all.html | 1 + tests/unit/core/core.html | 11 --- tests/unit/core/core.js | 19 ----- tests/unit/core/core_deprecated.html | 136 +++++++++++++++++++++++++++++++++++ tests/unit/core/core_deprecated.js | 24 +++++++ ui/jquery.ui.core.js | 58 +++++++-------- 7 files changed, 191 insertions(+), 59 deletions(-) create mode 100644 tests/unit/core/core_deprecated.html create mode 100644 tests/unit/core/core_deprecated.js (limited to 'build') diff --git a/build/tasks/testswarm.js b/build/tasks/testswarm.js index d747d16f9..01fb178f9 100644 --- a/build/tasks/testswarm.js +++ b/build/tasks/testswarm.js @@ -14,6 +14,7 @@ var versions = { "Autocomplete": "autocomplete/autocomplete.html", "Button": "button/button.html", "Core": "core/core.html", + "Core_deprecated": "core/core_deprecated.html", "Datepicker": "datepicker/datepicker.html", "Dialog": "dialog/dialog.html", "Draggable": "draggable/draggable.html", diff --git a/tests/unit/all.html b/tests/unit/all.html index 22b1802dc..8dfff2a4e 100644 --- a/tests/unit/all.html +++ b/tests/unit/all.html @@ -20,6 +20,7 @@ "autocomplete/autocomplete.html", "button/button.html", "core/core.html", + "core/core_deprecated.html", "datepicker/datepicker.html", "dialog/dialog.html", "draggable/draggable.html", diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html index 41c8db827..fd472d64a 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -117,17 +117,6 @@ -
    -
    .
    -
    -
    -
    .
    -
    -
    -
    .
    -
    -
    -
    diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 78a225338..54d50d84e 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -26,25 +26,6 @@ asyncTest( "focus", function() { }); }); -test( "zIndex", function() { - expect( 7 ); - var el = $( "#zIndexAutoWithParent" ), - parent = el.parent(); - equal( el.zIndex(), 100, "zIndex traverses up to find value" ); - equal( parent.zIndex(200 ), parent, "zIndex setter is chainable" ); - equal( el.zIndex(), 200, "zIndex setter changed zIndex" ); - - el = $( "#zIndexAutoWithParentViaCSS" ); - equal( el.zIndex(), 0, "zIndex traverses up to find CSS value, not found because not positioned" ); - - el = $( "#zIndexAutoWithParentViaCSSPositioned" ); - equal( el.zIndex(), 100, "zIndex traverses up to find CSS value" ); - el.parent().zIndex( 200 ); - equal( el.zIndex(), 200, "zIndex setter changed zIndex, overriding CSS" ); - - equal( $( "#zIndexAutoNoParent" ).zIndex(), 0, "zIndex never explicitly set in hierarchy" ); -}); - test( "innerWidth - getter", function() { expect( 2 ); var el = $( "#dimensions" ); diff --git a/tests/unit/core/core_deprecated.html b/tests/unit/core/core_deprecated.html new file mode 100644 index 000000000..d9c41ca39 --- /dev/null +++ b/tests/unit/core/core_deprecated.html @@ -0,0 +1,136 @@ + + + + + jQuery UI Core Test Suite + + + + + + + + + + + + + + + + + +

    jQuery UI Core Test Suite

    +

    +
    +

    +
      +
      + + + + + + + + + + +
      +
      + +
      + + + + + + + + + + xxx + anchor + anchor + x +
      x
      + x +
      x
      +
      + +
      + + + + + + + + + +
      + +
      + + + + + + + + + +
      + +
      + + + + + + . + . + . + . +
      + +
      + + +
      + +
      +
      .
      +
      +
      +
      .
      +
      +
      +
      .
      +
      +
      + +
      + +
      + + diff --git a/tests/unit/core/core_deprecated.js b/tests/unit/core/core_deprecated.js new file mode 100644 index 000000000..bb06f77b2 --- /dev/null +++ b/tests/unit/core/core_deprecated.js @@ -0,0 +1,24 @@ +(function( $ ) { + +module( "core - deprecated" ); + +test( "zIndex", function() { + expect( 7 ); + var el = $( "#zIndexAutoWithParent" ), + parent = el.parent(); + equal( el.zIndex(), 100, "zIndex traverses up to find value" ); + equal( parent.zIndex(200 ), parent, "zIndex setter is chainable" ); + equal( el.zIndex(), 200, "zIndex setter changed zIndex" ); + + el = $( "#zIndexAutoWithParentViaCSS" ); + equal( el.zIndex(), 0, "zIndex traverses up to find CSS value, not found because not positioned" ); + + el = $( "#zIndexAutoWithParentViaCSSPositioned" ); + equal( el.zIndex(), 100, "zIndex traverses up to find CSS value" ); + el.parent().zIndex( 200 ); + equal( el.zIndex(), 200, "zIndex setter changed zIndex, overriding CSS" ); + + equal( $( "#zIndexAutoNoParent" ).zIndex(), 0, "zIndex never explicitly set in hierarchy" ); +}); + +})( jQuery ); diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 1a13da251..0d263fa5f 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -78,35 +78,6 @@ $.fn.extend({ return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent; }, - zIndex: function( zIndex ) { - if ( zIndex !== undefined ) { - return this.css( "zIndex", zIndex ); - } - - if ( this.length ) { - var elem = $( this[ 0 ] ), position, value; - while ( elem.length && elem[ 0 ] !== document ) { - // Ignore z-index if position is set to a value where z-index is ignored by the browser - // This makes behavior of this function consistent across browsers - // WebKit always returns auto if the element is positioned - position = elem.css( "position" ); - if ( position === "absolute" || position === "relative" || position === "fixed" ) { - // IE returns 0 when zIndex is not specified - // other browsers return a string - // we ignore the case of nested elements with an explicit value of 0 - //
      - value = parseInt( elem.css( "zIndex" ), 10 ); - if ( !isNaN( value ) && value !== 0 ) { - return value; - } - } - elem = elem.parent(); - } - } - - return 0; - }, - uniqueId: function() { return this.each(function() { if ( !this.id ) { @@ -263,6 +234,35 @@ $.fn.extend({ enableSelection: function() { return this.unbind( ".ui-disableSelection" ); + }, + + zIndex: function( zIndex ) { + if ( zIndex !== undefined ) { + return this.css( "zIndex", zIndex ); + } + + if ( this.length ) { + var elem = $( this[ 0 ] ), position, value; + while ( elem.length && elem[ 0 ] !== document ) { + // Ignore z-index if position is set to a value where z-index is ignored by the browser + // This makes behavior of this function consistent across browsers + // WebKit always returns auto if the element is positioned + position = elem.css( "position" ); + if ( position === "absolute" || position === "relative" || position === "fixed" ) { + // IE returns 0 when zIndex is not specified + // other browsers return a string + // we ignore the case of nested elements with an explicit value of 0 + //
      + value = parseInt( elem.css( "zIndex" ), 10 ); + if ( !isNaN( value ) && value !== 0 ) { + return value; + } + } + elem = elem.parent(); + } + } + + return 0; } }); -- cgit v1.2.3