From 69dcb76e6b4095f221dbe63e8658a18594a39d83 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 2 Mar 2012 16:45:10 +0100 Subject: First iteration on grunt-based build. lint, qunit, concat, min and zip all work, but all have various limiations. --- .gitignore | 2 ++ grunt.js | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 33 ++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 grunt.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 70f7a9c79..dc1bdf6c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ build/dist build/size build/build/.sizecache.json +dist +node_modules docs .project *~ diff --git a/grunt.js b/grunt.js new file mode 100644 index 000000000..b935a0bc7 --- /dev/null +++ b/grunt.js @@ -0,0 +1,99 @@ +/*global config:true, task:true*/ +var coreFiles = 'jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js'.split(', '); +config.init({ + pkg: '', + meta: { + banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + + '<%= template.today("m/d/yyyy") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + + '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' + }, + concat: { + // 'dist/ui/jquery-ui.js': ['', ''] + 'dist/jquery-ui.js': coreFiles.map(function(file) { + return 'ui/' + file; + }).concat(file.expand('ui/*.js').filter(function(file) { + return coreFiles.indexOf(file.substring(3)) === -1; + })) + }, + min: { + 'dist/jquery-ui.min.js': ['', 'dist/jquery-ui.js'] + }, + zip: { + dist: { + src: [ + 'dist/**/*.js', + 'README.md', + 'grunt.js', + 'package.json', + 'ui/**/*', + 'demos/**/*', + 'themes/**/*', + 'external/**/*', + 'tests/**/*' + ], + dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip' + } + }, + qunit: { + files: file.expand('tests/unit/**/*.html').filter(function(file) { + // disabling everything that doesn't (quite) work with PhantomJS for now + // except for all|index|test, try to include more as we go + return !(/(all|index|test|draggable|droppable|selectable|resizable|sortable|dialog|slider|datepicker|tabs|tabs_deprecated)\.html/).test(file); + }) + }, + lint: { + // TODO extend this to tests + files: ['ui/*'] + }, + jshint: { + options: { + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + eqnull: true, + browser: true + }, + globals: { + jQuery: true + } + } +}); + +task.registerBasicTask('zip', 'Create a zip file for release', function(data) { + var files = file.expand(data.src); + log.writeln("Creating zip file " + data.dest); + + var done = this.async(); + + var zipstream = require('zipstream'); + var fs = require('fs'); + + var out = fs.createWriteStream(data.dest); + var zip = zipstream.createZip({ level: 1 }); + + zip.pipe(out); + + function addFile() { + if (!files.length) { + zip.finalize(function(written) { + log.writeln(written + ' total bytes written'); + done(); + }); + return; + } + var file = files.shift(); + log.verbose.writeln('Zipping ' + file); + zip.addFile(fs.createReadStream(file), { name: file }, addFile); + } + addFile(); +}); + +task.registerTask('default', 'lint qunit'); +task.registerTask('release', 'default concat min zip'); diff --git a/package.json b/package.json new file mode 100644 index 000000000..f1bbdf69d --- /dev/null +++ b/package.json @@ -0,0 +1,33 @@ +{ + "name": "jquery-ui", + "title": "jQuery UI", + "description": "Abstractions for low-level interaction and animation, advanced effects and high-level, themeable widgets, built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications.", + "version": "1.9.0pre", + "homepage": "https://github.com/jquery/jquery-ui", + "author": { + "name": "AUTHORS.txt" + }, + "repository": { + "type": "git", + "url": "git://github.com/jquery/jquery-ui.git" + }, + "bugs": { + "url": "http://bugs.jqueryui.com/" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + }, + { + "type": "GPL", + "url": "http://www.opensource.org/licenses/GPL-2.0" + } + ], + "dependencies": {}, + "devDependencies": { + "grunt": "0.2.x", + "zipstream": "0.2.x" + }, + "keywords": [] +} \ No newline at end of file -- cgit v1.2.3 From 3cb276c4678cd4f2a1a8aec8e3cbf184b06c9251 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 2 Mar 2012 16:55:49 +0100 Subject: Add list of included files to min banner --- grunt.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/grunt.js b/grunt.js index b935a0bc7..0b3f13874 100644 --- a/grunt.js +++ b/grunt.js @@ -1,21 +1,26 @@ /*global config:true, task:true*/ var coreFiles = 'jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js'.split(', '); +var allFiles = coreFiles.map(function(file) { + return 'ui/' + file; +}).concat(file.expand('ui/*.js').filter(function(file) { + return coreFiles.indexOf(file.substring(3)) === -1; +})); +var rawList = allFiles.map(function(file) { + return file.substring(3); +}); config.init({ pkg: '', meta: { banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= template.today("m/d/yyyy") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + + // TODO makes this banner only useful for the min-all task below... + '* Includes: ' + rawList.join(', ') + '\n' + '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' }, concat: { - // 'dist/ui/jquery-ui.js': ['', ''] - 'dist/jquery-ui.js': coreFiles.map(function(file) { - return 'ui/' + file; - }).concat(file.expand('ui/*.js').filter(function(file) { - return coreFiles.indexOf(file.substring(3)) === -1; - })) + 'dist/jquery-ui.js': allFiles }, min: { 'dist/jquery-ui.min.js': ['', 'dist/jquery-ui.js'] -- cgit v1.2.3 From 15eb3ac8f1123fa3075dd7fc6ae738a87c45ca39 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 2 Mar 2012 17:19:48 +0100 Subject: Use isoDate format for min banner --- grunt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 0b3f13874..2a79ff226 100644 --- a/grunt.js +++ b/grunt.js @@ -12,7 +12,7 @@ config.init({ pkg: '', meta: { banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + - '<%= template.today("m/d/yyyy") %>\n' + + '<%= template.today("isoDate") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + // TODO makes this banner only useful for the min-all task below... '* Includes: ' + rawList.join(', ') + '\n' + -- cgit v1.2.3 From 98fc87a5d72472d813b618a333bc2fa23defaaec Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 6 Mar 2012 18:18:09 +0100 Subject: Build/grunt: Switch to adm-zip. Use addFile method until addLocalFile is implemented. --- grunt.js | 28 +++++++--------------------- package.json | 2 +- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/grunt.js b/grunt.js index 2a79ff226..ab8d57f31 100644 --- a/grunt.js +++ b/grunt.js @@ -75,29 +75,15 @@ task.registerBasicTask('zip', 'Create a zip file for release', function(data) { var files = file.expand(data.src); log.writeln("Creating zip file " + data.dest); - var done = this.async(); - - var zipstream = require('zipstream'); var fs = require('fs'); - - var out = fs.createWriteStream(data.dest); - var zip = zipstream.createZip({ level: 1 }); - - zip.pipe(out); - - function addFile() { - if (!files.length) { - zip.finalize(function(written) { - log.writeln(written + ' total bytes written'); - done(); - }); - return; - } - var file = files.shift(); + var AdmZip = require('adm-zip'); + var zip = new AdmZip(); + files.forEach(function(file) { log.verbose.writeln('Zipping ' + file); - zip.addFile(fs.createReadStream(file), { name: file }, addFile); - } - addFile(); + zip.addFile(file, fs.readFileSync(file)); + }); + zip.writeZip(data.dest); + log.writeln("Wrote " + files.length + " files to " + data.dest); }); task.registerTask('default', 'lint qunit'); diff --git a/package.json b/package.json index f1bbdf69d..9745bda44 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "dependencies": {}, "devDependencies": { "grunt": "0.2.x", - "zipstream": "0.2.x" + "adm-zip": "0.1.x" }, "keywords": [] } \ No newline at end of file -- cgit v1.2.3 From 953c49ff9d2597c96ec7e4c398288e7b6ef97b8f Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 6 Mar 2012 18:52:50 +0100 Subject: Build/grunt: Extend concat and min tasks to include all the files the current build includes. Headers aren't correct yet. --- grunt.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/grunt.js b/grunt.js index ab8d57f31..2ee625f51 100644 --- a/grunt.js +++ b/grunt.js @@ -8,6 +8,19 @@ var allFiles = coreFiles.map(function(file) { var rawList = allFiles.map(function(file) { return file.substring(3); }); + +var minify = { + 'dist/ui/minified/jquery-ui.min.js': ['', 'dist/ui/jquery-ui.js'], + // TODO adjust banner to get access to the list of included files + 'dist/ui/minified/i18n/jquery-ui-i18n.min.js': ['', 'dist/ui/i18n/jquery-ui-i18n.js'] +}; +function minFile(file) { + // TODO adjust banner to get access to the list of included files + minify['dist/' + file.replace(/\.js$/, '.min.js').replace(/ui\//, 'ui/minified/')] = ['', file]; +} +allFiles.forEach(minFile); +file.expand('ui/i18n/*.js').forEach(minFile); + config.init({ pkg: '', meta: { @@ -20,11 +33,10 @@ config.init({ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' }, concat: { - 'dist/jquery-ui.js': allFiles - }, - min: { - 'dist/jquery-ui.min.js': ['', 'dist/jquery-ui.js'] + 'dist/ui/jquery-ui.js': allFiles, + 'dist/ui/i18n/jquery-ui-i18n.js': 'ui/i18n/*.js' }, + min: minify, zip: { dist: { src: [ @@ -80,11 +92,12 @@ task.registerBasicTask('zip', 'Create a zip file for release', function(data) { var zip = new AdmZip(); files.forEach(function(file) { log.verbose.writeln('Zipping ' + file); - zip.addFile(file, fs.readFileSync(file)); + // rewrite file names from dist folder (created by build), drop the /dist part + zip.addFile(file.replace(/^dist/, ''), fs.readFileSync(file)); }); zip.writeZip(data.dest); log.writeln("Wrote " + files.length + " files to " + data.dest); }); task.registerTask('default', 'lint qunit'); -task.registerTask('release', 'default concat min zip'); +task.registerTask('release', 'concat min zip'); -- cgit v1.2.3 From 3f1750330070de1c8a48ab42c4f4bb90e0372e02 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 6 Mar 2012 19:30:20 +0100 Subject: Build/grunt: Custom banners for the various minified files --- grunt.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/grunt.js b/grunt.js index 2ee625f51..fe1e92bc8 100644 --- a/grunt.js +++ b/grunt.js @@ -10,27 +10,38 @@ var rawList = allFiles.map(function(file) { }); var minify = { - 'dist/ui/minified/jquery-ui.min.js': ['', 'dist/ui/jquery-ui.js'], + 'dist/ui/minified/jquery-ui.min.js': ['', 'dist/ui/jquery-ui.js'], // TODO adjust banner to get access to the list of included files - 'dist/ui/minified/i18n/jquery-ui-i18n.min.js': ['', 'dist/ui/i18n/jquery-ui-i18n.js'] + 'dist/ui/minified/i18n/jquery-ui-i18n.min.js': ['', 'dist/ui/i18n/jquery-ui-i18n.js'] }; function minFile(file) { // TODO adjust banner to get access to the list of included files minify['dist/' + file.replace(/\.js$/, '.min.js').replace(/ui\//, 'ui/minified/')] = ['', file]; } allFiles.forEach(minFile); -file.expand('ui/i18n/*.js').forEach(minFile); -config.init({ - pkg: '', - meta: { - banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + +var allI18nFiles = file.expand('ui/i18n/*.js'); +allI18nFiles.forEach(minFile); +var i18nfiles = allI18nFiles.map(function(file) { + return file.substring(8); +}); + +function createBanner(files) { + return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= template.today("isoDate") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + // TODO makes this banner only useful for the min-all task below... - '* Includes: ' + rawList.join(', ') + '\n' + + (files ? '* Includes: ' + files.join(', ') + '\n' : '') + '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + - ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'; +} + +config.init({ + pkg: '', + meta: { + banner: createBanner(), + bannerAll: createBanner(rawList), + bannerI18n: createBanner(i18nfiles) }, concat: { 'dist/ui/jquery-ui.js': allFiles, -- cgit v1.2.3 From 02981c7c4005143285c4012f2d15dc24ccaf6725 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 6 Mar 2012 19:31:00 +0100 Subject: Build/grunt: cleanup --- grunt.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/grunt.js b/grunt.js index fe1e92bc8..45deca7bd 100644 --- a/grunt.js +++ b/grunt.js @@ -11,11 +11,9 @@ var rawList = allFiles.map(function(file) { var minify = { 'dist/ui/minified/jquery-ui.min.js': ['', 'dist/ui/jquery-ui.js'], - // TODO adjust banner to get access to the list of included files 'dist/ui/minified/i18n/jquery-ui-i18n.min.js': ['', 'dist/ui/i18n/jquery-ui-i18n.js'] }; function minFile(file) { - // TODO adjust banner to get access to the list of included files minify['dist/' + file.replace(/\.js$/, '.min.js').replace(/ui\//, 'ui/minified/')] = ['', file]; } allFiles.forEach(minFile); @@ -30,7 +28,6 @@ function createBanner(files) { return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= template.today("isoDate") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + - // TODO makes this banner only useful for the min-all task below... (files ? '* Includes: ' + files.join(', ') + '\n' : '') + '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'; -- cgit v1.2.3 From cc3b08df2d8be44a72977d33f042bafa0e21de13 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 6 Mar 2012 20:15:51 +0100 Subject: Build/grunt: Minify CSS files, using sqwish. --- grunt.js | 53 +++++++++++++++++++++++++++++++++++++++++------------ package.json | 3 ++- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/grunt.js b/grunt.js index 45deca7bd..44a49a372 100644 --- a/grunt.js +++ b/grunt.js @@ -1,13 +1,10 @@ /*global config:true, task:true*/ var coreFiles = 'jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js'.split(', '); -var allFiles = coreFiles.map(function(file) { +var uiFiles = coreFiles.map(function(file) { return 'ui/' + file; }).concat(file.expand('ui/*.js').filter(function(file) { return coreFiles.indexOf(file.substring(3)) === -1; })); -var rawList = allFiles.map(function(file) { - return file.substring(3); -}); var minify = { 'dist/ui/minified/jquery-ui.min.js': ['', 'dist/ui/jquery-ui.js'], @@ -16,19 +13,23 @@ var minify = { function minFile(file) { minify['dist/' + file.replace(/\.js$/, '.min.js').replace(/ui\//, 'ui/minified/')] = ['', file]; } -allFiles.forEach(minFile); +uiFiles.forEach(minFile); var allI18nFiles = file.expand('ui/i18n/*.js'); allI18nFiles.forEach(minFile); -var i18nfiles = allI18nFiles.map(function(file) { - return file.substring(8); -}); + +// TODO move core to the front, theme to the end, exclude all and base +var cssFiles = file.expand('themes/base/*.css'); function createBanner(files) { + // strip folders + var fileNames = files && files.map(function(file) { + return file.replace(/.+\/(.+)$/, '$1'); + }); return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= template.today("isoDate") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + - (files ? '* Includes: ' + files.join(', ') + '\n' : '') + + (files ? '* Includes: ' + fileNames.join(', ') + '\n' : '') + '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'; } @@ -37,14 +38,21 @@ config.init({ pkg: '', meta: { banner: createBanner(), - bannerAll: createBanner(rawList), - bannerI18n: createBanner(i18nfiles) + bannerAll: createBanner(uiFiles), + bannerI18n: createBanner(allI18nFiles), + bannerCSS: createBanner(cssFiles) }, concat: { - 'dist/ui/jquery-ui.js': allFiles, + 'dist/ui/jquery-ui.js': uiFiles, 'dist/ui/i18n/jquery-ui-i18n.js': 'ui/i18n/*.js' }, min: minify, + css_min: { + dist: { + src: [''].concat(cssFiles), + dest: 'dist/themes/base/minified/jquery-ui.min.css' + } + }, zip: { dist: { src: [ @@ -107,5 +115,26 @@ task.registerBasicTask('zip', 'Create a zip file for release', function(data) { log.writeln("Wrote " + files.length + " files to " + data.dest); }); +task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function( data ) { + var files = file.expand( data.src ); + // Get banner, if specified. It would be nice if UglifyJS supported ignoring + // all comments matching a certain pattern, like /*!...*/, but it doesn't. + var banner = task.directive(files[0], function() { return null; }); + if (banner === null) { + banner = ''; + } else { + files.shift(); + } + var max = task.helper( 'concat', files ); + // Concat banner + minified source. + var min = banner + require('sqwish').minify( max, false ); + file.write( data.dest, min ); + if ( task.hadErrors() ) { + return false; + } + log.writeln( 'File "' + data.dest + '" created.' ); + task.helper( 'min_max_info', min, max ); +}); + task.registerTask('default', 'lint qunit'); task.registerTask('release', 'concat min zip'); diff --git a/package.json b/package.json index 9745bda44..37cb6d035 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "dependencies": {}, "devDependencies": { "grunt": "0.2.x", - "adm-zip": "0.1.x" + "adm-zip": "0.1.x", + "sqwish": "0.2.x" }, "keywords": [] } \ No newline at end of file -- cgit v1.2.3 From 34f813413b9ccdb2eebd429a2e69198dcceec057 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Wed, 7 Mar 2012 14:51:20 +0100 Subject: Build/grunt: Update banner template to use task.current.data.src when no file list is given. --- grunt.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/grunt.js b/grunt.js index 44a49a372..93896f6cb 100644 --- a/grunt.js +++ b/grunt.js @@ -1,4 +1,20 @@ /*global config:true, task:true*/ +function stripDirectory(file) { + return file.replace(/.+\/(.+)$/, '$1'); +} +function createBanner(files) { + // strip folders + var fileNames = files && files.map(stripDirectory); + return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + + '<%= template.today("isoDate") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + + '* Includes: ' + (files ? fileNames.join(', ') : '<%= stripDirectory(task.current.data.src[1]) %>') + '\n' + + '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'; +} +// allow access from banner template +global.stripDirectory = stripDirectory; + var coreFiles = 'jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js'.split(', '); var uiFiles = coreFiles.map(function(file) { return 'ui/' + file; @@ -21,19 +37,6 @@ allI18nFiles.forEach(minFile); // TODO move core to the front, theme to the end, exclude all and base var cssFiles = file.expand('themes/base/*.css'); -function createBanner(files) { - // strip folders - var fileNames = files && files.map(function(file) { - return file.replace(/.+\/(.+)$/, '$1'); - }); - return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + - '<%= template.today("isoDate") %>\n' + - '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + - (files ? '* Includes: ' + fileNames.join(', ') + '\n' : '') + - '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + - ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'; -} - config.init({ pkg: '', meta: { -- cgit v1.2.3 From 0bf7d25d6663ae6e5283cffbf8ac33f52dcf18f5 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Wed, 7 Mar 2012 15:16:32 +0100 Subject: Build/grunt: First draft for cdn tasks. Hashing works fine, zip file doesn't quite match the intended structure. --- grunt.js | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 93896f6cb..76f2d71ac 100644 --- a/grunt.js +++ b/grunt.js @@ -37,6 +37,23 @@ allI18nFiles.forEach(minFile); // TODO move core to the front, theme to the end, exclude all and base var cssFiles = file.expand('themes/base/*.css'); +var cdnFiles = [ + 'AUTHORS.txt', + 'GPL-LICENSE.txt', + 'MIT-LICENSE.txt', + 'dist/i18n/jquery-ui-i18n.js', + 'dist/i18n/jquery-ui-i18n.min.js', + 'ui/i18n/jquery.ui.datepicker-*.js', + 'dist/ui/i18n/jquery.ui.datepicker-*.min.js', + 'dist/ui/jquery-ui.js', + 'dist/ui/minified/jquery-ui.min.js', + 'themes/base/images/*.png', + 'dist/themes/base/jquery-ui.css', + 'themes/base/jquery.ui.*.css', + 'dist/themes/base/minified/*.css', + 'version.txt' +]; + config.init({ pkg: '', meta: { @@ -70,8 +87,15 @@ config.init({ 'tests/**/*' ], dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip' + }, + cdn: { + src: cdnFiles, + dest: 'dist/<%= pkg.name %>-<%= pkg.version %>-cdn.zip' } }, + md5: { + 'dist/MANIFEST': cdnFiles + }, qunit: { files: file.expand('tests/unit/**/*.html').filter(function(file) { // disabling everything that doesn't (quite) work with PhantomJS for now @@ -139,5 +163,17 @@ task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function( da task.helper( 'min_max_info', min, max ); }); +task.registerBasicTask('md5', 'Create list of md5 hashes for CDN uploads', function(data) { + var crypto = require('crypto'); + var hashes = []; + file.expand(data.src).forEach(function(fileName) { + var hash = crypto.createHash('md5'); + hash.update(file.read(fileName)); + hashes.push(fileName + ' ' + hash.digest('hex')); + }); + file.write(data.dest, hashes.join('\n') + '\n'); +}); + task.registerTask('default', 'lint qunit'); -task.registerTask('release', 'concat min zip'); +task.registerTask('release', 'concat min zip:dist'); +task.registerTask('release_cdn', 'concat min md5 zip:cdn'); \ No newline at end of file -- cgit v1.2.3 From face6de0b6a6f9651a3ea7bd5c0d73f432c63be8 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 8 Mar 2012 14:06:25 +0100 Subject: Build/grunt: Almost complete release and release_cdn tasks. Concat task fails to strip headers, everything else is in place. --- grunt.js | 211 +++++++++++++++++++++++++++++++++++++++++++++++++----------- version.txt | 1 - 2 files changed, 172 insertions(+), 40 deletions(-) delete mode 100644 version.txt diff --git a/grunt.js b/grunt.js index 76f2d71ac..1ec85df90 100644 --- a/grunt.js +++ b/grunt.js @@ -23,39 +23,35 @@ var uiFiles = coreFiles.map(function(file) { })); var minify = { - 'dist/ui/minified/jquery-ui.min.js': ['', 'dist/ui/jquery-ui.js'], - 'dist/ui/minified/i18n/jquery-ui-i18n.min.js': ['', 'dist/ui/i18n/jquery-ui-i18n.js'] + 'dist/jquery-ui.min.js': ['', 'dist/jquery-ui.js'], + 'dist/i18n/jquery-ui-i18n.min.js': ['', 'dist/i18n/jquery-ui-i18n.js'] }; function minFile(file) { - minify['dist/' + file.replace(/\.js$/, '.min.js').replace(/ui\//, 'ui/minified/')] = ['', file]; + minify['dist/' + file.replace(/\.js$/, '.min.js').replace(/ui\//, 'minified/')] = ['', file]; } uiFiles.forEach(minFile); var allI18nFiles = file.expand('ui/i18n/*.js'); allI18nFiles.forEach(minFile); -// TODO move core to the front, theme to the end, exclude all and base -var cssFiles = file.expand('themes/base/*.css'); - -var cdnFiles = [ - 'AUTHORS.txt', - 'GPL-LICENSE.txt', - 'MIT-LICENSE.txt', - 'dist/i18n/jquery-ui-i18n.js', - 'dist/i18n/jquery-ui-i18n.min.js', - 'ui/i18n/jquery.ui.datepicker-*.js', - 'dist/ui/i18n/jquery.ui.datepicker-*.min.js', - 'dist/ui/jquery-ui.js', - 'dist/ui/minified/jquery-ui.min.js', - 'themes/base/images/*.png', - 'dist/themes/base/jquery-ui.css', - 'themes/base/jquery.ui.*.css', - 'dist/themes/base/minified/*.css', - 'version.txt' -]; +var cssFiles = 'core accordion autocomplete button datepicker dialog menu progressbar resizable selectable slider spinner tabs tooltip theme'.split(' ').map(function(component) { + return 'themes/base/jquery.ui.' + component + '.css'; +}); +var minifyCSS = { + 'dist/jquery-ui.min.css': 'dist/jquery-ui.css' +}; +cssFiles.forEach(function(file) { + minifyCSS['dist/' + file.replace(/\.css$/, '.min.css').replace(/themes\/base\//, 'themes/base/minified/')] = ['', file]; +}); config.init({ pkg: '', + files: { + distFolder: 'dist/<%= pkg.name %>-<%= pkg.version %>', + cdnDistFolder: 'dist/<%= pkg.name %>-<%= pkg.version %>-cdn', + zip: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip', + cdnZip: 'dist/<%= pkg.name %>-<%= pkg.version %>-cdn.zip' + }, meta: { banner: createBanner(), bannerAll: createBanner(uiFiles), @@ -63,20 +59,32 @@ config.init({ bannerCSS: createBanner(cssFiles) }, concat: { - 'dist/ui/jquery-ui.js': uiFiles, - 'dist/ui/i18n/jquery-ui-i18n.js': 'ui/i18n/*.js' - }, - min: minify, - css_min: { - dist: { + // TODO replace banners, both for JS and CSS + ui: { + src: [''].concat(uiFiles.map(function(file) { + // TODO why doesn't this work? + return ''; + })), + dest: 'dist/jquery-ui.js' + }, + i18n: { + src: ['', allI18nFiles], + dest: 'dist/i18n/jquery-ui-i18n.js' + }, + css: { src: [''].concat(cssFiles), - dest: 'dist/themes/base/minified/jquery-ui.min.css' + dest: 'dist/jquery-ui.css' } }, - zip: { + min: minify, + css_min: minifyCSS, + copy: { dist: { src: [ - 'dist/**/*.js', + 'AUTHORS.txt', + 'GPL-LICENSE.txt', + 'jquery-1.7.1.js', + 'MIT-LICENSE.txt', 'README.md', 'grunt.js', 'package.json', @@ -86,15 +94,92 @@ config.init({ 'external/**/*', 'tests/**/*' ], - dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip' + renames: { + 'dist/jquery-ui.js': 'ui/jquery-ui.js', + 'dist/jquery-ui.min.js': 'ui/minified/jquery-ui.min.js', + 'dist/i18n/jquery-ui-i18n.js': 'ui/i18n/jquery-ui-i18n.js', + 'dist/i18n/jquery-ui-i18n.min.js': 'ui/minified/i18n/jquery-ui-i18n.min.js', + 'dist/jquery-ui.css': 'themes/base/jquery-ui.css', + 'dist/jquery-ui.min.css': 'themes/base/minified/jquery-ui.min.css' + }, + dest: '<%= files.distFolder %>' + }, + dist_min: { + src: 'dist/minified/**/*', + strip: /^dist/, + dest: '<%= files.distFolder %>/ui' + }, + dist_css_min: { + src: 'dist/themes/base/minified/*.css', + strip: /^dist/, + dest: '<%= files.distFolder %>' + }, + dist_min_images: { + src: 'themes/base/images/*', + strip: /^themes\/base\//, + dest: '<%= files.distFolder %>/themes/base/minified' }, cdn: { - src: cdnFiles, - dest: 'dist/<%= pkg.name %>-<%= pkg.version %>-cdn.zip' + src: [ + 'AUTHORS.txt', + 'GPL-LICENSE.txt', + 'MIT-LICENSE.txt', + 'ui/*.js', + 'themes/base/images/*.png', + 'themes/base/jquery.ui.*.css', + 'package.json' + ], + renames: { + 'dist/jquery-ui.js': 'jquery-ui.js', + 'dist/jquery-ui.min.js': 'jquery-ui.min.js', + 'dist/i18n/jquery-ui-i18n.js': 'i18n/jquery-ui-i18n.js', + 'dist/i18n/jquery-ui-i18n.min.js': 'i18n/jquery-ui-i18n.min.js', + 'dist/jquery-ui.css': 'themes/base/jquery-ui.css', + 'dist/jquery-ui.min.css': 'themes/base/minified/jquery-ui.min.css' + }, + dest: '<%= files.cdnDistFolder %>' + }, + cdn_i18n: { + src: 'ui/i18n/jquery.ui.datepicker-*.js', + strip: 'ui/', + dest: '<%= files.cdnDistFolder %>' + }, + cdn_i18n_min: { + src: 'dist/minified/i18n/jquery.ui.datepicker-*.js', + strip: 'dist/minified', + dest: '<%= files.cdnDistFolder %>' + }, + cdn_min: { + src: 'dist/minified/*.js', + strip: /^dist\/minified/, + dest: '<%= files.cdnDistFolder %>/ui' + }, + cdn_css_min: { + src: 'dist/themes/base/minified/*.css', + strip: /^dist/, + dest: '<%= files.cdnDistFolder %>' + }, + dist_min_images: { + src: 'themes/base/images/*', + strip: /^themes\/base\//, + dest: '<%= files.cdnDistFolder %>/themes/base/minified' + } + }, + zip: { + dist: { + src: '<%= files.distFolder %>/**/*', + dest: '<%= files.zip %>' + }, + cdn: { + src: '<%= files.cdnDistFolder %>/**/*', + dest: '<%= files.cdnZip %>' } }, md5: { - 'dist/MANIFEST': cdnFiles + cdn: { + dir: '<%= files.cdnDistFolder %>', + dest: '<%= files.cdnDistFolder %>/MANIFEST' + } }, qunit: { files: file.expand('tests/unit/**/*.html').filter(function(file) { @@ -126,6 +211,39 @@ config.init({ } }); +// grunt doesn't know about this files object, so need to process that manually once +// before any other variable is resolved, otherwise it would just include the templates +var files = config().files; +for (var key in files) { + files[key] = template.process(files[key], config()); +} +config('files', files); +// log.writeln(require('util').inspect(config().files)) + +task.registerTask('x', function() { + log.writeln(task.helper('concat', [''])); +}); + +task.registerBasicTask('copy', 'Copy files to destination folder and replace @VERSION with pkg.version', function(data) { + function replaceVersion(source) { + return source.replace("@VERSION", config("pkg").version); + } + var files = file.expand(data.src); + var target = data.dest + '/'; + files.forEach(function(fileName) { + var targetFile = data.strip ? fileName.replace(data.strip, '') : fileName; + file.copy(fileName, target + targetFile, replaceVersion); + }); + log.writeln('Copyied ' + files.length + ' files.'); + for (var fileName in data.renames) { + file.copy(fileName, target + template.process(data.renames[fileName], config())); + } + if (data.renames) { + log.writeln('Renamed ' + data.renames.length + ' files.'); + } +}); + + task.registerBasicTask('zip', 'Create a zip file for release', function(data) { var files = file.expand(data.src); log.writeln("Creating zip file " + data.dest); @@ -164,16 +282,31 @@ task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function( da }); task.registerBasicTask('md5', 'Create list of md5 hashes for CDN uploads', function(data) { + // remove dest file before creating it, to make sure itself is not included + if (require('path').existsSync(data.dest)) { + require('fs').unlinkSync(data.dest); + } var crypto = require('crypto'); + var dir = template.process(data.dir, config()) + '/'; var hashes = []; - file.expand(data.src).forEach(function(fileName) { + file.expand(dir + '**/*').forEach(function(fileName) { var hash = crypto.createHash('md5'); hash.update(file.read(fileName)); - hashes.push(fileName + ' ' + hash.digest('hex')); + hashes.push(fileName.replace(dir, '') + ' ' + hash.digest('hex')); }); file.write(data.dest, hashes.join('\n') + '\n'); }); task.registerTask('default', 'lint qunit'); -task.registerTask('release', 'concat min zip:dist'); -task.registerTask('release_cdn', 'concat min md5 zip:cdn'); \ No newline at end of file +task.registerTask('build', 'concat min css_min'); +task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min zip:dist'); +task.registerTask('release_themes', 'build download_themes zip:themes'); +// TODO includes other themes in cdn release +task.registerTask('release_cdn', 'build copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_css_min md5 zip:cdn'); + +task.registerTask('download_themes', function() { + // TODO use request.get to download the files specified in build/themes +}); + +// TODO add size task, see also build/sizer.js - copy from core grunt.js +// TODO add themes download task, part of release_cdn task diff --git a/version.txt b/version.txt deleted file mode 100644 index 13c1a7371..000000000 --- a/version.txt +++ /dev/null @@ -1 +0,0 @@ -1.9pre -- cgit v1.2.3 From 6aa41bf4aee738ddeb2acbb85e5b12ce36798a2c Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 8 Mar 2012 14:52:50 +0100 Subject: Build/grunt: Partial download_themes task. Extracting currently fails with crc32 checksum failure --- grunt.js | 27 ++++++++++++++++++++++++--- package.json | 3 ++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/grunt.js b/grunt.js index 1ec85df90..9218b00d9 100644 --- a/grunt.js +++ b/grunt.js @@ -301,12 +301,33 @@ task.registerTask('default', 'lint qunit'); task.registerTask('build', 'concat min css_min'); task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min zip:dist'); task.registerTask('release_themes', 'build download_themes zip:themes'); -// TODO includes other themes in cdn release +// TODO include other themes in cdn release task.registerTask('release_cdn', 'build copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_css_min md5 zip:cdn'); task.registerTask('download_themes', function() { - // TODO use request.get to download the files specified in build/themes + var AdmZip = require('adm-zip'); + var done = this.async(); + var fs = require('fs'); + var request = require('request'); + var themes = file.read('build/themes').split(',').slice(0, 1); + var requests = 0; + file.mkdir('dist/tmp'); + themes.forEach(function(theme, index) { + requests += 1; + file.mkdir('dist/tmp/' + index); + var zipFileName = 'dist/tmp/' + index + '.zip'; + var out = fs.createWriteStream(zipFileName); + out.on('close', function() { + log.writeln("done downloading " + zipFileName); + var zip = new AdmZip(zipFileName); + zip.extractAllTo('dist/tmp/' + index + '/'); + requests -= 1; + if (requests === 0) { + done(); + } + }); + request('http://ui-dev.jquery.com/download/?' + theme).pipe(out); + }); }); // TODO add size task, see also build/sizer.js - copy from core grunt.js -// TODO add themes download task, part of release_cdn task diff --git a/package.json b/package.json index 37cb6d035..2d473076a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "devDependencies": { "grunt": "0.2.x", "adm-zip": "0.1.x", - "sqwish": "0.2.x" + "sqwish": "0.2.x", + "request": "0.2.x" }, "keywords": [] } \ No newline at end of file -- cgit v1.2.3 From 64ea9d427eb048dc6387557698b28a3ab3421241 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 8 Mar 2012 17:11:57 +0100 Subject: Build/grunt: Extend themes_download task with unzipping --- grunt.js | 48 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/grunt.js b/grunt.js index 9218b00d9..0c900941d 100644 --- a/grunt.js +++ b/grunt.js @@ -49,8 +49,10 @@ config.init({ files: { distFolder: 'dist/<%= pkg.name %>-<%= pkg.version %>', cdnDistFolder: 'dist/<%= pkg.name %>-<%= pkg.version %>-cdn', + themesDistFolder: 'dist/<%= pkg.name %>-themes-<%= pkg.version %>', zip: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip', - cdnZip: 'dist/<%= pkg.name %>-<%= pkg.version %>-cdn.zip' + cdnZip: 'dist/<%= pkg.name %>-<%= pkg.version %>-cdn.zip', + themesZip: 'dist/<%= pkg.name %>-themes-<%= pkg.version %>.zip' }, meta: { banner: createBanner(), @@ -62,7 +64,7 @@ config.init({ // TODO replace banners, both for JS and CSS ui: { src: [''].concat(uiFiles.map(function(file) { - // TODO why doesn't this work? + // TODO why doesn't this work? because its a protected banner, and template.stripBanner skips that m( return ''; })), dest: 'dist/jquery-ui.js' @@ -159,10 +161,14 @@ config.init({ strip: /^dist/, dest: '<%= files.cdnDistFolder %>' }, - dist_min_images: { + cdn_min_images: { src: 'themes/base/images/*', strip: /^themes\/base\//, dest: '<%= files.cdnDistFolder %>/themes/base/minified' + }, + themes: { + // copy development-bundle/themes/**/*.js (excluding themes/base) + // rename jquery-ui-.*custom.css to jquery-ui.css } }, zip: { @@ -173,6 +179,10 @@ config.init({ cdn: { src: '<%= files.cdnDistFolder %>/**/*', dest: '<%= files.cdnZip %>' + }, + themes: { + src: '<%= files.themesDistFolder %>/**/*', + dest: '<%= files.themesZip %>' } }, md5: { @@ -300,16 +310,16 @@ task.registerBasicTask('md5', 'Create list of md5 hashes for CDN uploads', funct task.registerTask('default', 'lint qunit'); task.registerTask('build', 'concat min css_min'); task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min zip:dist'); -task.registerTask('release_themes', 'build download_themes zip:themes'); +task.registerTask('release_themes', 'build download_themes copy:themes zip:themes'); // TODO include other themes in cdn release -task.registerTask('release_cdn', 'build copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_css_min md5 zip:cdn'); +task.registerTask('release_cdn', 'build copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_css_min copy:cdn_min_images md5 zip:cdn'); task.registerTask('download_themes', function() { - var AdmZip = require('adm-zip'); - var done = this.async(); + // var AdmZip = require('adm-zip'); var fs = require('fs'); var request = require('request'); - var themes = file.read('build/themes').split(',').slice(0, 1); + var done = this.async(); + var themes = file.read('build/themes').split(','); var requests = 0; file.mkdir('dist/tmp'); themes.forEach(function(theme, index) { @@ -319,12 +329,22 @@ task.registerTask('download_themes', function() { var out = fs.createWriteStream(zipFileName); out.on('close', function() { log.writeln("done downloading " + zipFileName); - var zip = new AdmZip(zipFileName); - zip.extractAllTo('dist/tmp/' + index + '/'); - requests -= 1; - if (requests === 0) { - done(); - } + // TODO AdmZip produces "crc32 checksum failed", need to figure out why + // var zip = new AdmZip(zipFileName); + // zip.extractAllTo('dist/tmp/' + index + '/'); + // until then, using cli unzip... + task.helper("child_process", { + cmd: "unzip", + args: ["-d", "dist/tmp/" + index, zipFileName] + }, function(err, result) { + log.writeln("Unzipped " + zipFileName + ", deleting it now"); + fs.unlinkSync(zipFileName); + requests -= 1; + if (requests === 0) { + done(); + } + }); + }); request('http://ui-dev.jquery.com/download/?' + theme).pipe(out); }); -- cgit v1.2.3 From 4a2b004c073fc7b97b1a4f61db460100f09b7be6 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 13:52:18 +0100 Subject: Build/grunt: Finish release_themes task. Strip headers from concatenated files. --- grunt.js | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/grunt.js b/grunt.js index 0c900941d..2db730139 100644 --- a/grunt.js +++ b/grunt.js @@ -1,4 +1,9 @@ /*global config:true, task:true*/ +function stripBanner(files) { + return files.map(function(file) { + return ''; + }); +} function stripDirectory(file) { return file.replace(/.+\/(.+)$/, '$1'); } @@ -63,10 +68,7 @@ config.init({ concat: { // TODO replace banners, both for JS and CSS ui: { - src: [''].concat(uiFiles.map(function(file) { - // TODO why doesn't this work? because its a protected banner, and template.stripBanner skips that m( - return ''; - })), + src: ['', stripBanner(uiFiles)], dest: 'dist/jquery-ui.js' }, i18n: { @@ -74,7 +76,7 @@ config.init({ dest: 'dist/i18n/jquery-ui-i18n.js' }, css: { - src: [''].concat(cssFiles), + src: ['', stripBanner(cssFiles)], dest: 'dist/jquery-ui.css' } }, @@ -167,8 +169,13 @@ config.init({ dest: '<%= files.cdnDistFolder %>/themes/base/minified' }, themes: { - // copy development-bundle/themes/**/*.js (excluding themes/base) - // rename jquery-ui-.*custom.css to jquery-ui.css + src: [ + 'AUTHORS.txt', + 'GPL-LICENSE.txt', + 'MIT-LICENSE.txt', + 'package.json' + ], + dest: '<%= files.themesDistFolder %>' } }, zip: { @@ -186,9 +193,17 @@ config.init({ } }, md5: { + dist: { + dir: '<%= files.distFolder %>', + dest: '<%= files.distFolder %>/MANIFEST' + }, cdn: { dir: '<%= files.cdnDistFolder %>', dest: '<%= files.cdnDistFolder %>/MANIFEST' + }, + themes: { + dir: '<%= files.themesDistFolder %>', + dest: '<%= files.themesDistFolder %>/MANIFEST' } }, qunit: { @@ -307,13 +322,6 @@ task.registerBasicTask('md5', 'Create list of md5 hashes for CDN uploads', funct file.write(data.dest, hashes.join('\n') + '\n'); }); -task.registerTask('default', 'lint qunit'); -task.registerTask('build', 'concat min css_min'); -task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min zip:dist'); -task.registerTask('release_themes', 'build download_themes copy:themes zip:themes'); -// TODO include other themes in cdn release -task.registerTask('release_cdn', 'build copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_css_min copy:cdn_min_images md5 zip:cdn'); - task.registerTask('download_themes', function() { // var AdmZip = require('adm-zip'); var fs = require('fs'); @@ -350,4 +358,32 @@ task.registerTask('download_themes', function() { }); }); +task.registerTask('copy_themes', function() { + // each package includes the base theme, ignore that + var filter = /themes\/base/; + var files = file.expand('dist/tmp/*/development-bundle/themes/**/*').filter(function(file) { + return !filter.test(file); + }); + var target = config('files.themesDistFolder') + '/'; + files.forEach(function(fileName) { + var targetFile = fileName.replace(/dist\/tmp\/\d+\/development-bundle\//, '').replace("jquery-ui-.custom", "jquery-ui.css"); + file.copy(fileName, target + targetFile); + }); + + // copy minified base theme from regular release + var distFolder = config('files.distFolder'); + files = file.expand(distFolder + '/themes/base/**/*'); + files.forEach(function(fileName) { + file.copy(fileName, target + fileName.replace(distFolder, '')); + }); +}); + // TODO add size task, see also build/sizer.js - copy from core grunt.js + +task.registerTask('default', 'lint qunit'); +task.registerTask('build', 'concat min css_min'); +task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist'); +// TODO also include (minified) base theme, share with regular dist, maybe just copy from release target +task.registerTask('release_themes', 'release download_themes copy_themes copy:themes md5:themes zip:themes'); +// TODO include other themes in cdn release +task.registerTask('release_cdn', 'build copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_css_min copy:cdn_min_images md5:cdn zip:cdn'); -- cgit v1.2.3 From 60bbda3eb900eea18d35bfd8bdee59d970c4549b Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 14:02:00 +0100 Subject: Build/grunt: Cleanup todos --- grunt.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/grunt.js b/grunt.js index 2db730139..a079f04cf 100644 --- a/grunt.js +++ b/grunt.js @@ -66,7 +66,6 @@ config.init({ bannerCSS: createBanner(cssFiles) }, concat: { - // TODO replace banners, both for JS and CSS ui: { src: ['', stripBanner(uiFiles)], dest: 'dist/jquery-ui.js' @@ -383,7 +382,6 @@ task.registerTask('copy_themes', function() { task.registerTask('default', 'lint qunit'); task.registerTask('build', 'concat min css_min'); task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist'); -// TODO also include (minified) base theme, share with regular dist, maybe just copy from release target task.registerTask('release_themes', 'release download_themes copy_themes copy:themes md5:themes zip:themes'); // TODO include other themes in cdn release task.registerTask('release_cdn', 'build copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_css_min copy:cdn_min_images md5:cdn zip:cdn'); -- cgit v1.2.3 From ff5895a39fd90cc3fd89568c05f73906a506ef88 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 15:18:26 +0100 Subject: Build/grunt: Add sizer task. Some cleanup in other areas. --- grunt.js | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 78 insertions(+), 7 deletions(-) diff --git a/grunt.js b/grunt.js index a079f04cf..0aff5a963 100644 --- a/grunt.js +++ b/grunt.js @@ -65,6 +65,12 @@ config.init({ bannerI18n: createBanner(allI18nFiles), bannerCSS: createBanner(cssFiles) }, + compare_size: { + files: [ + "dist/jquery-ui.js", + "dist/jquery-ui.min.js" + ] + }, concat: { ui: { src: ['', stripBanner(uiFiles)], @@ -242,11 +248,6 @@ for (var key in files) { files[key] = template.process(files[key], config()); } config('files', files); -// log.writeln(require('util').inspect(config().files)) - -task.registerTask('x', function() { - log.writeln(task.helper('concat', [''])); -}); task.registerBasicTask('copy', 'Copy files to destination folder and replace @VERSION with pkg.version', function(data) { function replaceVersion(source) { @@ -377,9 +378,79 @@ task.registerTask('copy_themes', function() { }); }); -// TODO add size task, see also build/sizer.js - copy from core grunt.js +// TODO merge with code in jQuery Core, share as grunt plugin/npm +// this here actually uses the provided filenames in the output +// the helpers should just be regular functions, no need to share those with the world +task.registerBasicTask("compare_size", "Compare size of this branch to master", function(data) { + var files = file.expand(data.src), + done = this.async(), + sizecache = __dirname + "/dist/.sizecache.json", + sources = { + min: file.read(files[1]), + max: file.read(files[0]) + }, + oldsizes = {}, + sizes = {}; + + try { + oldsizes = JSON.parse(file.read(sizecache)); + } catch(e) { + oldsizes = {}; + } + + // Obtain the current branch and continue... + task.helper("git_current_branch", function(err, branch) { + var key, diff; + + // Derived and adapted from Corey Frang's original `sizer` + log.writeln( "sizes - compared to master" ); + + sizes[files[0]] = sources.max.length; + sizes[files[1]] = sources.min.length; + sizes[files[1] + '.gz'] = task.helper("gzip", sources.min).length; + + for ( key in sizes ) { + diff = oldsizes[ key ] && ( sizes[ key ] - oldsizes[ key ] ); + if ( diff > 0 ) { + diff = "+" + diff; + } + console.log( "%s %s %s", + task.helper("lpad", sizes[ key ], 8 ), + task.helper("lpad", diff ? "(" + diff + ")" : "(-)", 8 ), + key + ); + } + + if ( branch === "master" ) { + // If master, write to file - this makes it easier to compare + // the size of your current code state to the master branch, + // without returning to the master to reset the cache + file.write( sizecache, JSON.stringify(sizes) ); + } + done(); + }); +}); +task.registerHelper("git_current_branch", function(done) { + task.helper("child_process", { + cmd: "git", + args: ["branch", "--no-color"] + }, function(err, result) { + var branch; + + result.split("\n").forEach(function(branch) { + var matches = /^\* (.*)/.exec( branch ); + if ( matches !== null && matches.length && matches[ 1 ] ) { + done( null, matches[ 1 ] ); + } + }); + }); +}); +task.registerHelper("lpad", function(str, len, chr) { + return ( Array( len + 1 ).join( chr || " " ) + str ).substr( -len ); +}); -task.registerTask('default', 'lint qunit'); +task.registerTask('default', 'lint qunit build compare_size'); +task.registerTask('sizer', 'concat:ui min:dist/jquery-ui.min.js compare_size'); task.registerTask('build', 'concat min css_min'); task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist'); task.registerTask('release_themes', 'release download_themes copy_themes copy:themes md5:themes zip:themes'); -- cgit v1.2.3 From 36302cc3c98d41d2142b177ecbb29d3980393103 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 16:21:45 +0100 Subject: Build/grunt: Add back version.txt. Will remove that later along with the old build files, until then its useful to compare the new system against the old. --- version.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 version.txt diff --git a/version.txt b/version.txt new file mode 100644 index 000000000..c70a1dfdc --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.9.0pre \ No newline at end of file -- cgit v1.2.3 From 8a982f59685ce623b9d600c5d53ae4511e2ae5ce Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 16:23:57 +0100 Subject: Build/grunt: Use custom directive to strip banners. Now works against unmodified grunt again. --- grunt.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 0aff5a963..b60ac9e67 100644 --- a/grunt.js +++ b/grunt.js @@ -1,7 +1,7 @@ /*global config:true, task:true*/ function stripBanner(files) { return files.map(function(file) { - return ''; + return ''; }); } function stripDirectory(file) { @@ -19,6 +19,9 @@ function createBanner(files) { } // allow access from banner template global.stripDirectory = stripDirectory; +task.registerHelper('strip_all_banners', function(filepath) { + return file.read(filepath).replace(/^\s*\/\*[\s\S]*?\*\/\s*/g, ''); +}); var coreFiles = 'jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js'.split(', '); var uiFiles = coreFiles.map(function(file) { -- cgit v1.2.3 From 59a26c87c4ea38a6cf864e44dd8c05a4286d9cf3 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 16:25:51 +0100 Subject: Build/grunt: Can use config('pkg.version'), now was fixed in grunt --- grunt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index b60ac9e67..a2929ff28 100644 --- a/grunt.js +++ b/grunt.js @@ -254,7 +254,7 @@ config('files', files); task.registerBasicTask('copy', 'Copy files to destination folder and replace @VERSION with pkg.version', function(data) { function replaceVersion(source) { - return source.replace("@VERSION", config("pkg").version); + return source.replace("@VERSION", config("pkg.version")); } var files = file.expand(data.src); var target = data.dest + '/'; -- cgit v1.2.3 From fcab58aba48fbfbedb48079b521571238ea42ff5 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 17:18:35 +0100 Subject: Build/grunt: Use child process for zipping until adm-zip works better. Rewrote files config to make that work with the cwd requirement. --- grunt.js | 100 +++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 59 insertions(+), 41 deletions(-) diff --git a/grunt.js b/grunt.js index a2929ff28..5ee1e63c8 100644 --- a/grunt.js +++ b/grunt.js @@ -55,12 +55,9 @@ cssFiles.forEach(function(file) { config.init({ pkg: '', files: { - distFolder: 'dist/<%= pkg.name %>-<%= pkg.version %>', - cdnDistFolder: 'dist/<%= pkg.name %>-<%= pkg.version %>-cdn', - themesDistFolder: 'dist/<%= pkg.name %>-themes-<%= pkg.version %>', - zip: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip', - cdnZip: 'dist/<%= pkg.name %>-<%= pkg.version %>-cdn.zip', - themesZip: 'dist/<%= pkg.name %>-themes-<%= pkg.version %>.zip' + dist: '<%= pkg.name %>-<%= pkg.version %>', + cdn: '<%= pkg.name %>-<%= pkg.version %>-cdn', + themes: '<%= pkg.name %>-themes-<%= pkg.version %>' }, meta: { banner: createBanner(), @@ -114,22 +111,22 @@ config.init({ 'dist/jquery-ui.css': 'themes/base/jquery-ui.css', 'dist/jquery-ui.min.css': 'themes/base/minified/jquery-ui.min.css' }, - dest: '<%= files.distFolder %>' + dest: 'dist/<%= files.dist %>' }, dist_min: { src: 'dist/minified/**/*', strip: /^dist/, - dest: '<%= files.distFolder %>/ui' + dest: 'dist/<%= files.dist %>/ui' }, dist_css_min: { src: 'dist/themes/base/minified/*.css', strip: /^dist/, - dest: '<%= files.distFolder %>' + dest: 'dist/<%= files.dist %>' }, dist_min_images: { src: 'themes/base/images/*', strip: /^themes\/base\//, - dest: '<%= files.distFolder %>/themes/base/minified' + dest: 'dist/<%= files.dist %>/themes/base/minified' }, cdn: { src: [ @@ -149,32 +146,32 @@ config.init({ 'dist/jquery-ui.css': 'themes/base/jquery-ui.css', 'dist/jquery-ui.min.css': 'themes/base/minified/jquery-ui.min.css' }, - dest: '<%= files.cdnDistFolder %>' + dest: 'dist/<%= files.cdn %>' }, cdn_i18n: { src: 'ui/i18n/jquery.ui.datepicker-*.js', strip: 'ui/', - dest: '<%= files.cdnDistFolder %>' + dest: 'dist/<%= files.cdn %>' }, cdn_i18n_min: { src: 'dist/minified/i18n/jquery.ui.datepicker-*.js', strip: 'dist/minified', - dest: '<%= files.cdnDistFolder %>' + dest: 'dist/<%= files.cdn %>' }, cdn_min: { src: 'dist/minified/*.js', strip: /^dist\/minified/, - dest: '<%= files.cdnDistFolder %>/ui' + dest: 'dist/<%= files.cdn %>/ui' }, cdn_css_min: { src: 'dist/themes/base/minified/*.css', strip: /^dist/, - dest: '<%= files.cdnDistFolder %>' + dest: 'dist/<%= files.cdn %>' }, cdn_min_images: { src: 'themes/base/images/*', strip: /^themes\/base\//, - dest: '<%= files.cdnDistFolder %>/themes/base/minified' + dest: 'dist/<%= files.cdn %>/themes/base/minified' }, themes: { src: [ @@ -183,35 +180,35 @@ config.init({ 'MIT-LICENSE.txt', 'package.json' ], - dest: '<%= files.themesDistFolder %>' + dest: 'dist/<%= files.themes %>' } }, zip: { dist: { - src: '<%= files.distFolder %>/**/*', - dest: '<%= files.zip %>' + src: '<%= files.dist %>', + dest: '<%= files.dist %>.zip' }, cdn: { - src: '<%= files.cdnDistFolder %>/**/*', - dest: '<%= files.cdnZip %>' + src: '<%= files.cdn %>', + dest: '<%= files.cdn %>.zip' }, themes: { - src: '<%= files.themesDistFolder %>/**/*', - dest: '<%= files.themesZip %>' + src: '<%= files.themes %>', + dest: '<%= files.themes %>.zip' } }, md5: { dist: { - dir: '<%= files.distFolder %>', - dest: '<%= files.distFolder %>/MANIFEST' + dir: 'dist/<%= files.dist %>', + dest: 'dist/<%= files.dist %>/MANIFEST' }, cdn: { - dir: '<%= files.cdnDistFolder %>', - dest: '<%= files.cdnDistFolder %>/MANIFEST' + dir: 'dist/<%= files.cdn %>', + dest: 'dist/<%= files.cdn %>/MANIFEST' }, themes: { - dir: '<%= files.themesDistFolder %>', - dest: '<%= files.themesDistFolder %>/MANIFEST' + dir: 'dist/<%= files.themes %>', + dest: 'dist/<%= files.themes %>/MANIFEST' } }, qunit: { @@ -266,26 +263,47 @@ task.registerBasicTask('copy', 'Copy files to destination folder and replace @VE for (var fileName in data.renames) { file.copy(fileName, target + template.process(data.renames[fileName], config())); } - if (data.renames) { + if (data.renames && data.renames.length) { log.writeln('Renamed ' + data.renames.length + ' files.'); } }); task.registerBasicTask('zip', 'Create a zip file for release', function(data) { - var files = file.expand(data.src); - log.writeln("Creating zip file " + data.dest); + var done = this.async(); + // TODO switch back to adm-zip for better cross-platform compability once it actually works + // 0.1.2 doesn't compress properly (or at all) - var fs = require('fs'); - var AdmZip = require('adm-zip'); - var zip = new AdmZip(); - files.forEach(function(file) { - log.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)); + // var files = file.expand(data.src); + // log.writeln("Creating zip file " + data.dest); + + // var fs = require('fs'); + // var AdmZip = require('adm-zip'); + // var zip = new AdmZip(); + // files.forEach(function(file) { + // log.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(data.dest); + // log.writeln("Wrote " + files.length + " files to " + data.dest); + + var src = template.process(data.src, config()); + task.helper("child_process", { + cmd: "zip", + args: ["-r", data.dest, src], + opts: { + cwd: 'dist' + } + }, function(err, result) { + if (err) { + log.error(err); + done(); + return; + } + log.writeln("Zipped " + data.dest); + done(); }); - zip.writeZip(data.dest); - log.writeln("Wrote " + files.length + " files to " + data.dest); }); task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function( data ) { -- cgit v1.2.3 From 19088fa91ece3b86550f9f63c1094ca96144c13e Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 17:42:57 +0100 Subject: Build/grunt: Fix a few oversights from the files config refactoring. Also finish the release_cdn target, now it includes all themes --- grunt.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/grunt.js b/grunt.js index 5ee1e63c8..542d0066d 100644 --- a/grunt.js +++ b/grunt.js @@ -134,8 +134,6 @@ config.init({ 'GPL-LICENSE.txt', 'MIT-LICENSE.txt', 'ui/*.js', - 'themes/base/images/*.png', - 'themes/base/jquery.ui.*.css', 'package.json' ], renames: { @@ -163,16 +161,16 @@ config.init({ strip: /^dist\/minified/, dest: 'dist/<%= files.cdn %>/ui' }, - cdn_css_min: { - src: 'dist/themes/base/minified/*.css', - strip: /^dist/, - dest: 'dist/<%= files.cdn %>' - }, cdn_min_images: { src: 'themes/base/images/*', strip: /^themes\/base\//, dest: 'dist/<%= files.cdn %>/themes/base/minified' }, + cdn_themes: { + src: 'dist/<%= files.themes %>/themes/**/*', + strip: 'dist/<%= files.themes %>', + dest: 'dist/<%= files.cdn %>' + }, themes: { src: [ 'AUTHORS.txt', @@ -255,8 +253,12 @@ task.registerBasicTask('copy', 'Copy files to destination folder and replace @VE } var files = file.expand(data.src); var target = data.dest + '/'; + var strip = data.strip; + if (typeof strip === 'string') { + strip = new RegExp('^' + template.process(strip, config()).replace(/[-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&")); + } files.forEach(function(fileName) { - var targetFile = data.strip ? fileName.replace(data.strip, '') : fileName; + var targetFile = strip ? fileName.replace(strip, '') : fileName; file.copy(fileName, target + targetFile, replaceVersion); }); log.writeln('Copyied ' + files.length + ' files.'); @@ -385,14 +387,14 @@ task.registerTask('copy_themes', function() { var files = file.expand('dist/tmp/*/development-bundle/themes/**/*').filter(function(file) { return !filter.test(file); }); - var target = config('files.themesDistFolder') + '/'; + var target = 'dist/' + config('files.themes') + '/'; files.forEach(function(fileName) { var targetFile = fileName.replace(/dist\/tmp\/\d+\/development-bundle\//, '').replace("jquery-ui-.custom", "jquery-ui.css"); file.copy(fileName, target + targetFile); }); // copy minified base theme from regular release - var distFolder = config('files.distFolder'); + var distFolder = 'dist/' + config('files.dist'); files = file.expand(distFolder + '/themes/base/**/*'); files.forEach(function(fileName) { file.copy(fileName, target + fileName.replace(distFolder, '')); @@ -475,5 +477,4 @@ task.registerTask('sizer', 'concat:ui min:dist/jquery-ui.min.js compare_size'); task.registerTask('build', 'concat min css_min'); task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist'); task.registerTask('release_themes', 'release download_themes copy_themes copy:themes md5:themes zip:themes'); -// TODO include other themes in cdn release -task.registerTask('release_cdn', 'build copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_css_min copy:cdn_min_images md5:cdn zip:cdn'); +task.registerTask('release_cdn', 'release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn'); -- cgit v1.2.3 From 9fd5e7a153edb3dd5c060f7e6faad80c12120535 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 17:58:34 +0100 Subject: Build/grunt: Improve lint setup, configure options and globals for different contexts --- grunt.js | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/grunt.js b/grunt.js index 542d0066d..50e999993 100644 --- a/grunt.js +++ b/grunt.js @@ -217,8 +217,9 @@ config.init({ }) }, lint: { - // TODO extend this to tests - files: ['ui/*'] + ui: 'ui/*', + grunt: 'grunt.js', + tests: 'tests/unit/**/*.js' }, jshint: { options: { @@ -230,11 +231,38 @@ config.init({ noarg: true, sub: true, undef: true, - eqnull: true, - browser: true + eqnull: true }, - globals: { - jQuery: true + grunt: { + options: { + node: true + }, + globals: { + file: true, + log: true, + template: true + } + }, + ui: { + options: { + browser: true + }, + globals: { + jQuery: true + } + }, + tests: { + options: { + jquery: true + }, + globals: { + module: true, + test: true, + ok: true, + equal: true, + deepEqual: true, + QUnit: true + } } } }); @@ -255,7 +283,7 @@ task.registerBasicTask('copy', 'Copy files to destination folder and replace @VE var target = data.dest + '/'; var strip = data.strip; if (typeof strip === 'string') { - strip = new RegExp('^' + template.process(strip, config()).replace(/[-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&")); + strip = new RegExp('^' + template.process(strip, config()).replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&")); } files.forEach(function(fileName) { var targetFile = strip ? fileName.replace(strip, '') : fileName; -- cgit v1.2.3 From 85ea681685f73498e22a7c120ad0e46430b97d7c Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 9 Mar 2012 17:59:57 +0100 Subject: Build/grunt: Improve lint setup, get rid of file comment, using gruntjs specific config anyway --- grunt.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 50e999993..e4db51f65 100644 --- a/grunt.js +++ b/grunt.js @@ -1,4 +1,3 @@ -/*global config:true, task:true*/ function stripBanner(files) { return files.map(function(file) { return ''; @@ -238,6 +237,8 @@ config.init({ node: true }, globals: { + task: true, + config: true, file: true, log: true, template: true -- cgit v1.2.3 From 2865a629871b1534b6e32418137f5d249da6f7fb Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Sat, 10 Mar 2012 12:55:36 +0100 Subject: Build/grunt: Update codebase to adapt or make use of latest changes in grunt --- grunt.js | 75 +++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/grunt.js b/grunt.js index e4db51f65..fe840c15d 100644 --- a/grunt.js +++ b/grunt.js @@ -12,7 +12,7 @@ function createBanner(files) { return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= template.today("isoDate") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + - '* Includes: ' + (files ? fileNames.join(', ') : '<%= stripDirectory(task.current.data.src[1]) %>') + '\n' + + '* Includes: ' + (files ? fileNames.join(', ') : '<%= stripDirectory(task.current.file.src[1]) %>') + '\n' + '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'; } @@ -21,6 +21,7 @@ global.stripDirectory = stripDirectory; task.registerHelper('strip_all_banners', function(filepath) { return file.read(filepath).replace(/^\s*\/\*[\s\S]*?\*\/\s*/g, ''); }); +var inspect = require('util').inspect; var coreFiles = 'jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js'.split(', '); var uiFiles = coreFiles.map(function(file) { @@ -196,15 +197,15 @@ config.init({ }, md5: { dist: { - dir: 'dist/<%= files.dist %>', + src: 'dist/<%= files.dist %>', dest: 'dist/<%= files.dist %>/MANIFEST' }, cdn: { - dir: 'dist/<%= files.cdn %>', + src: 'dist/<%= files.cdn %>', dest: 'dist/<%= files.cdn %>/MANIFEST' }, themes: { - dir: 'dist/<%= files.themes %>', + src: 'dist/<%= files.themes %>', dest: 'dist/<%= files.themes %>/MANIFEST' } }, @@ -268,21 +269,13 @@ config.init({ } }); -// grunt doesn't know about this files object, so need to process that manually once -// before any other variable is resolved, otherwise it would just include the templates -var files = config().files; -for (var key in files) { - files[key] = template.process(files[key], config()); -} -config('files', files); - -task.registerBasicTask('copy', 'Copy files to destination folder and replace @VERSION with pkg.version', function(data) { +task.registerBasicTask('copy', 'Copy files to destination folder and replace @VERSION with pkg.version', function() { function replaceVersion(source) { return source.replace("@VERSION", config("pkg.version")); } - var files = file.expand(data.src); - var target = data.dest + '/'; - var strip = data.strip; + var files = file.expand(this.file.src); + var target = this.file.dest + '/'; + var strip = this.data.strip; if (typeof strip === 'string') { strip = new RegExp('^' + template.process(strip, config()).replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&")); } @@ -291,22 +284,24 @@ task.registerBasicTask('copy', 'Copy files to destination folder and replace @VE file.copy(fileName, target + targetFile, replaceVersion); }); log.writeln('Copyied ' + files.length + ' files.'); - for (var fileName in data.renames) { - file.copy(fileName, target + template.process(data.renames[fileName], config())); + var renameCount = 0; + for (var fileName in this.data.renames) { + renameCount += 1; + file.copy(fileName, target + template.process(this.data.renames[fileName], config())); } - if (data.renames && data.renames.length) { - log.writeln('Renamed ' + data.renames.length + ' files.'); + if (renameCount) { + log.writeln('Renamed ' + renameCount + ' files.'); } }); -task.registerBasicTask('zip', 'Create a zip file for release', function(data) { +task.registerBasicTask('zip', 'Create a zip file for release', function() { var done = this.async(); // TODO switch back to adm-zip for better cross-platform compability once it actually works // 0.1.2 doesn't compress properly (or at all) - // var files = file.expand(data.src); - // log.writeln("Creating zip file " + data.dest); + // var files = file.expand(this.file.src); + // log.writeln("Creating zip file " + this.file.dest); // var fs = require('fs'); // var AdmZip = require('adm-zip'); @@ -316,13 +311,14 @@ task.registerBasicTask('zip', 'Create a zip file for release', function(data) { // // rewrite file names from dist folder (created by build), drop the /dist part // zip.addFile(file.replace(/^dist/, ''), fs.readFileSync(file)); // }); - // zip.writeZip(data.dest); - // log.writeln("Wrote " + files.length + " files to " + data.dest); + // zip.writeZip(this.file.dest); + // log.writeln("Wrote " + files.length + " files to " + this.file.dest); - var src = template.process(data.src, config()); + var dest = this.file.dest; + var src = template.process(this.file.src, config()); task.helper("child_process", { cmd: "zip", - args: ["-r", data.dest, src], + args: ["-r", dest, src], opts: { cwd: 'dist' } @@ -332,13 +328,13 @@ task.registerBasicTask('zip', 'Create a zip file for release', function(data) { done(); return; } - log.writeln("Zipped " + data.dest); + log.writeln("Zipped " + dest); done(); }); }); -task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function( data ) { - var files = file.expand( data.src ); +task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function() { + var files = file.expand( this.file.src ); // Get banner, if specified. It would be nice if UglifyJS supported ignoring // all comments matching a certain pattern, like /*!...*/, but it doesn't. var banner = task.directive(files[0], function() { return null; }); @@ -350,28 +346,29 @@ task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function( da var max = task.helper( 'concat', files ); // Concat banner + minified source. var min = banner + require('sqwish').minify( max, false ); - file.write( data.dest, min ); + file.write( this.file.dest, min ); if ( task.hadErrors() ) { return false; } - log.writeln( 'File "' + data.dest + '" created.' ); + log.writeln( 'File "' + this.file.dest + '" created.' ); task.helper( 'min_max_info', min, max ); }); -task.registerBasicTask('md5', 'Create list of md5 hashes for CDN uploads', function(data) { +task.registerBasicTask('md5', 'Create list of md5 hashes for CDN uploads', function() { // remove dest file before creating it, to make sure itself is not included - if (require('path').existsSync(data.dest)) { - require('fs').unlinkSync(data.dest); + if (require('path').existsSync(this.file.dest)) { + require('fs').unlinkSync(this.file.dest); } var crypto = require('crypto'); - var dir = template.process(data.dir, config()) + '/'; + var dir = this.file.src + '/'; var hashes = []; file.expand(dir + '**/*').forEach(function(fileName) { var hash = crypto.createHash('md5'); hash.update(file.read(fileName)); hashes.push(fileName.replace(dir, '') + ' ' + hash.digest('hex')); }); - file.write(data.dest, hashes.join('\n') + '\n'); + file.write(this.file.dest, hashes.join('\n') + '\n'); + log.writeln('Wrote ' + this.file.dest + ' with ' + hashes.length + ' hashes'); }); task.registerTask('download_themes', function() { @@ -433,8 +430,8 @@ task.registerTask('copy_themes', function() { // TODO merge with code in jQuery Core, share as grunt plugin/npm // this here actually uses the provided filenames in the output // the helpers should just be regular functions, no need to share those with the world -task.registerBasicTask("compare_size", "Compare size of this branch to master", function(data) { - var files = file.expand(data.src), +task.registerBasicTask("compare_size", "Compare size of this branch to master", function() { + var files = file.expand(this.file.src), done = this.async(), sizecache = __dirname + "/dist/.sizecache.json", sources = { -- cgit v1.2.3 From fd9b7d3475870cff054b0b21a310fb21e05ed794 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Sat, 10 Mar 2012 13:45:16 +0100 Subject: Build/grunt: Integrate CSSLint --- grunt.js | 43 ++++++++++++++++++++++++++++++++++++++++++- package.json | 4 ++-- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/grunt.js b/grunt.js index fe840c15d..ae837d7fc 100644 --- a/grunt.js +++ b/grunt.js @@ -221,6 +221,15 @@ config.init({ grunt: 'grunt.js', tests: 'tests/unit/**/*.js' }, + csslint: { + base_theme: { + src: 'themes/base/*.css', + rules: { + 'import': false, + 'overqualified-elements': 2 + } + } + }, jshint: { options: { curly: true, @@ -333,6 +342,38 @@ task.registerBasicTask('zip', 'Create a zip file for release', function() { }); }); +task.registerBasicTask('csslint', 'Lint CSS files with csslint', function() { + var csslint = require('csslint').CSSLint; + var files = file.expand(this.file.src); + var ruleset = {}; + csslint.getRules().forEach(function(rule) { + ruleset[rule.id] = 1; + }); + for (var rule in this.data.rules) { + if (!this.data.rules[rule]) { + delete ruleset[rule]; + } else { + ruleset[rule] = this.data.rules[rule]; + } + } + var hadErrors = 0; + files.forEach(function(filepath) { + log.writeln('Linting ' + filepath); + var result = csslint.verify(file.read(filepath), ruleset); + result.messages.forEach(function(message) { + log.writeln('['.red + ('L' + message.line).yellow + ':'.red + ('C' + message.col).yellow + ']'.red); + log[message.type === 'error' ? 'error' : 'writeln'](message.message + ' ' + message.rule.desc + ' (' + message.rule.id + ')'); + }); + if (result.messages.length) { + hadErrors += 1; + } + }); + if (hadErrors) { + return false; + } + log.writeln('Lint free'); +}); + task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function() { var files = file.expand( this.file.src ); // Get banner, if specified. It would be nice if UglifyJS supported ignoring @@ -498,7 +539,7 @@ task.registerHelper("lpad", function(str, len, chr) { return ( Array( len + 1 ).join( chr || " " ) + str ).substr( -len ); }); -task.registerTask('default', 'lint qunit build compare_size'); +task.registerTask('default', 'lint csslint qunit build compare_size'); task.registerTask('sizer', 'concat:ui min:dist/jquery-ui.min.js compare_size'); task.registerTask('build', 'concat min css_min'); task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist'); diff --git a/package.json b/package.json index 2d473076a..cd0c9f78d 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,9 @@ "dependencies": {}, "devDependencies": { "grunt": "0.2.x", - "adm-zip": "0.1.x", "sqwish": "0.2.x", - "request": "0.2.x" + "request": "2.9.x", + "csslint": "0.9.x" }, "keywords": [] } \ No newline at end of file -- cgit v1.2.3 From 5e6fc4f086e72e9f247426f2cbe4a3cd7a2013fd Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Sat, 10 Mar 2012 13:53:53 +0100 Subject: Build/grunt: Simplify css_min basic task, concat helper already takes care of executing directives --- grunt.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/grunt.js b/grunt.js index ae837d7fc..cbf3d48a6 100644 --- a/grunt.js +++ b/grunt.js @@ -375,22 +375,9 @@ task.registerBasicTask('csslint', 'Lint CSS files with csslint', function() { }); task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function() { - var files = file.expand( this.file.src ); - // Get banner, if specified. It would be nice if UglifyJS supported ignoring - // all comments matching a certain pattern, like /*!...*/, but it doesn't. - var banner = task.directive(files[0], function() { return null; }); - if (banner === null) { - banner = ''; - } else { - files.shift(); - } - var max = task.helper( 'concat', files ); - // Concat banner + minified source. - var min = banner + require('sqwish').minify( max, false ); + var max = task.helper( 'concat', file.expand( this.file.src ) ); + var min = require('sqwish').minify( max, false ); file.write( this.file.dest, min ); - if ( task.hadErrors() ) { - return false; - } log.writeln( 'File "' + this.file.dest + '" created.' ); task.helper( 'min_max_info', min, max ); }); -- cgit v1.2.3 From f8bad0441d58954d60440886964178e80f8ae6ec Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Sat, 10 Mar 2012 14:16:13 +0100 Subject: Build: Modify uglify.js to include a newline charakter after the copyright comment, makes diffing against new build a little bit more efficient --- build/build/uglify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build/uglify.js b/build/build/uglify.js index aad18e8ca..5b3fad4da 100644 --- a/build/build/uglify.js +++ b/build/build/uglify.js @@ -230,7 +230,7 @@ function show_copyright(comments) { if (c.type == "comment1") { ret += "//" + c.value + "\n"; } else { - ret += "/*" + c.value + "*/"; + ret += "/*" + c.value + "*/\n"; } } return ret; -- cgit v1.2.3 From 6f301eab57f888b56bcbe6277a0d584e2aacd508 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Sat, 10 Mar 2012 15:07:53 +0100 Subject: Build/grunt: Fix copy_themes task, files.themes config property wasn't processed properly --- grunt.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index cbf3d48a6..585aed809 100644 --- a/grunt.js +++ b/grunt.js @@ -441,7 +441,8 @@ task.registerTask('copy_themes', function() { var files = file.expand('dist/tmp/*/development-bundle/themes/**/*').filter(function(file) { return !filter.test(file); }); - var target = 'dist/' + config('files.themes') + '/'; + // TODO the template.process call shouldn't be necessary + var target = 'dist/' + template.process(config('files.themes'), config()) + '/'; files.forEach(function(fileName) { var targetFile = fileName.replace(/dist\/tmp\/\d+\/development-bundle\//, '').replace("jquery-ui-.custom", "jquery-ui.css"); file.copy(fileName, target + targetFile); -- cgit v1.2.3 From 5fa2cd47bbf6163464357fbfcece45087ac0faa2 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Sun, 11 Mar 2012 12:34:52 +0100 Subject: Build/grunt: Replace child_process helper with utils.spawn --- grunt.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grunt.js b/grunt.js index 585aed809..b7d893cb8 100644 --- a/grunt.js +++ b/grunt.js @@ -325,7 +325,7 @@ task.registerBasicTask('zip', 'Create a zip file for release', function() { var dest = this.file.dest; var src = template.process(this.file.src, config()); - task.helper("child_process", { + utils.spawn({ cmd: "zip", args: ["-r", dest, src], opts: { @@ -418,7 +418,7 @@ task.registerTask('download_themes', function() { // var zip = new AdmZip(zipFileName); // zip.extractAllTo('dist/tmp/' + index + '/'); // until then, using cli unzip... - task.helper("child_process", { + utils.spawn({ cmd: "unzip", args: ["-d", "dist/tmp/" + index, zipFileName] }, function(err, result) { @@ -509,7 +509,7 @@ task.registerBasicTask("compare_size", "Compare size of this branch to master", }); }); task.registerHelper("git_current_branch", function(done) { - task.helper("child_process", { + utils.spawn({ cmd: "git", args: ["branch", "--no-color"] }, function(err, result) { -- cgit v1.2.3 From ee64f899e0eb47e4045d6049b78c7c089103476c Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Sun, 11 Mar 2012 12:55:07 +0100 Subject: Build/grunt: Fix themes task --- grunt.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index b7d893cb8..f22322379 100644 --- a/grunt.js +++ b/grunt.js @@ -449,7 +449,8 @@ task.registerTask('copy_themes', function() { }); // copy minified base theme from regular release - var distFolder = 'dist/' + config('files.dist'); + // TODO same as the one above + var distFolder = 'dist/' + template.process(config('files.dist'), config()); files = file.expand(distFolder + '/themes/base/**/*'); files.forEach(function(fileName) { file.copy(fileName, target + fileName.replace(distFolder, '')); -- cgit v1.2.3 From 99fd8511ed4098a4cbf6c66999ef4df0bd8280be Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 19 Mar 2012 09:05:40 -0400 Subject: Revert "Button: Apply overflow: hidden in all browsers except IE 6,7 to avoid expanding the size of the button from negative text indent. Fixes #7911 - Button: icon only button in dialog causes horizontal scrollbar in Opera." This reverts commit a3a5c65d4dd9eb6be0e8a71d82c3ca86b38ed009. --- themes/base/jquery.ui.button.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/base/jquery.ui.button.css b/themes/base/jquery.ui.button.css index ccee26aab..be2e71796 100644 --- a/themes/base/jquery.ui.button.css +++ b/themes/base/jquery.ui.button.css @@ -7,7 +7,7 @@ * * http://docs.jquery.com/UI/Button#theming */ -.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: hidden; *overflow: visible; } /* the overflow property removes extra width in IE */ +.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ .ui-button-icons-only { width: 3.4em; } -- cgit v1.2.3 From 94c6f9ec84acc4c01f2dc16c009e2cf7a0fdbc5d Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 19 Mar 2012 09:47:38 -0400 Subject: Mouse: Unbind events bound to document on destroy. Fixes #8199 - _mouseDestroy keeps mousemove and mouseup events bound. --- ui/jquery.ui.mouse.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js index 64a081961..5e7744418 100644 --- a/ui/jquery.ui.mouse.js +++ b/ui/jquery.ui.mouse.js @@ -46,6 +46,9 @@ $.widget("ui.mouse", { // other instances of mouse _mouseDestroy: function() { this.element.unbind('.'+this.widgetName); + $(document) + .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) + .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); }, _mouseDown: function(event) { -- cgit v1.2.3 From b1167efd2898734b5f58ff1deb6d2c93d01dc51b Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 19 Mar 2012 17:12:21 -0400 Subject: Grunt: Coding standards. --- grunt.js | 964 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 483 insertions(+), 481 deletions(-) diff --git a/grunt.js b/grunt.js index f22322379..9d0e721f2 100644 --- a/grunt.js +++ b/grunt.js @@ -1,536 +1,538 @@ -function stripBanner(files) { - return files.map(function(file) { - return ''; - }); +function stripBanner( files ) { + return files.map(function( file ) { + return ""; + }); } -function stripDirectory(file) { - return file.replace(/.+\/(.+)$/, '$1'); + +function stripDirectory( file ) { + return file.replace( /.+\/(.+)$/, "$1" ); } -function createBanner(files) { - // strip folders - var fileNames = files && files.map(stripDirectory); - return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + - '<%= template.today("isoDate") %>\n' + - '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + - '* Includes: ' + (files ? fileNames.join(', ') : '<%= stripDirectory(task.current.file.src[1]) %>') + '\n' + - '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + - ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'; + +function createBanner( files ) { + // strip folders + var fileNames = files && files.map( stripDirectory ); + return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " + + "<%= template.today('isoDate') %>\n" + + "<%= pkg.homepage ? '* ' + pkg.homepage + '\n' : '' %>" + + "* Includes: " + (files ? fileNames.join(", ") : "<%= stripDirectory(task.current.file.src[1]) %>") + "\n" + + "* Copyright (c) <%= template.today('yyyy') %> <%= pkg.author.name %>;" + + " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */"; } + // allow access from banner template global.stripDirectory = stripDirectory; -task.registerHelper('strip_all_banners', function(filepath) { - return file.read(filepath).replace(/^\s*\/\*[\s\S]*?\*\/\s*/g, ''); +task.registerHelper( "strip_all_banners", function( filepath ) { + return file.read( filepath ).replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" ); }); -var inspect = require('util').inspect; +var inspect = require( "util" ).inspect; -var coreFiles = 'jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js'.split(', '); -var uiFiles = coreFiles.map(function(file) { - return 'ui/' + file; -}).concat(file.expand('ui/*.js').filter(function(file) { - return coreFiles.indexOf(file.substring(3)) === -1; +var coreFiles = "jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js".split( ", " ); +var uiFiles = coreFiles.map(function( file ) { + return "ui/" + file; +}).concat( file.expand( "ui/*.js" ).filter(function( file ) { + return coreFiles.indexOf( file.substring(3) ) === -1; })); var minify = { - 'dist/jquery-ui.min.js': ['', 'dist/jquery-ui.js'], - 'dist/i18n/jquery-ui-i18n.min.js': ['', 'dist/i18n/jquery-ui-i18n.js'] + "dist/jquery-ui.min.js": [ "", "dist/jquery-ui.js" ], + "dist/i18n/jquery-ui-i18n.min.js": [ "", "dist/i18n/jquery-ui-i18n.js" ] }; -function minFile(file) { - minify['dist/' + file.replace(/\.js$/, '.min.js').replace(/ui\//, 'minified/')] = ['', file]; +function minFile( file ) { + minify[ "dist/" + file.replace( /\.js$/, ".min.js" ).replace( /ui\//, "minified/" ) ] = [ "", file ]; } -uiFiles.forEach(minFile); +uiFiles.forEach( minFile ); -var allI18nFiles = file.expand('ui/i18n/*.js'); -allI18nFiles.forEach(minFile); +var allI18nFiles = file.expand( "ui/i18n/*.js" ); +allI18nFiles.forEach( minFile ); -var cssFiles = 'core accordion autocomplete button datepicker dialog menu progressbar resizable selectable slider spinner tabs tooltip theme'.split(' ').map(function(component) { - return 'themes/base/jquery.ui.' + component + '.css'; +var cssFiles = "core accordion autocomplete button datepicker dialog menu progressbar resizable selectable slider spinner tabs tooltip theme".split( " " ).map(function( component ) { + return "themes/base/jquery.ui." + component + ".css"; }); var minifyCSS = { - 'dist/jquery-ui.min.css': 'dist/jquery-ui.css' + "dist/jquery-ui.min.css": "dist/jquery-ui.css" }; -cssFiles.forEach(function(file) { - minifyCSS['dist/' + file.replace(/\.css$/, '.min.css').replace(/themes\/base\//, 'themes/base/minified/')] = ['', file]; +cssFiles.forEach(function( file ) { + minifyCSS[ "dist/" + file.replace( /\.css$/, ".min.css" ).replace( /themes\/base\//, "themes/base/minified/" ) ] = [ "", file ]; }); config.init({ - pkg: '', - files: { - dist: '<%= pkg.name %>-<%= pkg.version %>', - cdn: '<%= pkg.name %>-<%= pkg.version %>-cdn', - themes: '<%= pkg.name %>-themes-<%= pkg.version %>' - }, - meta: { - banner: createBanner(), - bannerAll: createBanner(uiFiles), - bannerI18n: createBanner(allI18nFiles), - bannerCSS: createBanner(cssFiles) - }, - compare_size: { - files: [ - "dist/jquery-ui.js", - "dist/jquery-ui.min.js" - ] - }, - concat: { - ui: { - src: ['', stripBanner(uiFiles)], - dest: 'dist/jquery-ui.js' - }, - i18n: { - src: ['', allI18nFiles], - dest: 'dist/i18n/jquery-ui-i18n.js' - }, - css: { - src: ['', stripBanner(cssFiles)], - dest: 'dist/jquery-ui.css' - } - }, - min: minify, - css_min: minifyCSS, - copy: { - dist: { - src: [ - 'AUTHORS.txt', - 'GPL-LICENSE.txt', - 'jquery-1.7.1.js', - 'MIT-LICENSE.txt', - 'README.md', - 'grunt.js', - 'package.json', - 'ui/**/*', - 'demos/**/*', - 'themes/**/*', - 'external/**/*', - 'tests/**/*' - ], - renames: { - 'dist/jquery-ui.js': 'ui/jquery-ui.js', - 'dist/jquery-ui.min.js': 'ui/minified/jquery-ui.min.js', - 'dist/i18n/jquery-ui-i18n.js': 'ui/i18n/jquery-ui-i18n.js', - 'dist/i18n/jquery-ui-i18n.min.js': 'ui/minified/i18n/jquery-ui-i18n.min.js', - 'dist/jquery-ui.css': 'themes/base/jquery-ui.css', - 'dist/jquery-ui.min.css': 'themes/base/minified/jquery-ui.min.css' - }, - dest: 'dist/<%= files.dist %>' - }, - dist_min: { - src: 'dist/minified/**/*', - strip: /^dist/, - dest: 'dist/<%= files.dist %>/ui' - }, - dist_css_min: { - src: 'dist/themes/base/minified/*.css', - strip: /^dist/, - dest: 'dist/<%= files.dist %>' - }, - dist_min_images: { - src: 'themes/base/images/*', - strip: /^themes\/base\//, - dest: 'dist/<%= files.dist %>/themes/base/minified' - }, - cdn: { - src: [ - 'AUTHORS.txt', - 'GPL-LICENSE.txt', - 'MIT-LICENSE.txt', - 'ui/*.js', - 'package.json' - ], - renames: { - 'dist/jquery-ui.js': 'jquery-ui.js', - 'dist/jquery-ui.min.js': 'jquery-ui.min.js', - 'dist/i18n/jquery-ui-i18n.js': 'i18n/jquery-ui-i18n.js', - 'dist/i18n/jquery-ui-i18n.min.js': 'i18n/jquery-ui-i18n.min.js', - 'dist/jquery-ui.css': 'themes/base/jquery-ui.css', - 'dist/jquery-ui.min.css': 'themes/base/minified/jquery-ui.min.css' - }, - dest: 'dist/<%= files.cdn %>' - }, - cdn_i18n: { - src: 'ui/i18n/jquery.ui.datepicker-*.js', - strip: 'ui/', - dest: 'dist/<%= files.cdn %>' - }, - cdn_i18n_min: { - src: 'dist/minified/i18n/jquery.ui.datepicker-*.js', - strip: 'dist/minified', - dest: 'dist/<%= files.cdn %>' - }, - cdn_min: { - src: 'dist/minified/*.js', - strip: /^dist\/minified/, - dest: 'dist/<%= files.cdn %>/ui' - }, - cdn_min_images: { - src: 'themes/base/images/*', - strip: /^themes\/base\//, - dest: 'dist/<%= files.cdn %>/themes/base/minified' - }, - cdn_themes: { - src: 'dist/<%= files.themes %>/themes/**/*', - strip: 'dist/<%= files.themes %>', - dest: 'dist/<%= files.cdn %>' - }, - themes: { - src: [ - 'AUTHORS.txt', - 'GPL-LICENSE.txt', - 'MIT-LICENSE.txt', - 'package.json' - ], - dest: 'dist/<%= files.themes %>' - } - }, - zip: { - dist: { - src: '<%= files.dist %>', - dest: '<%= files.dist %>.zip' - }, - cdn: { - src: '<%= files.cdn %>', - dest: '<%= files.cdn %>.zip' - }, - themes: { - src: '<%= files.themes %>', - dest: '<%= files.themes %>.zip' - } - }, - md5: { - dist: { - src: 'dist/<%= files.dist %>', - dest: 'dist/<%= files.dist %>/MANIFEST' - }, - cdn: { - src: 'dist/<%= files.cdn %>', - dest: 'dist/<%= files.cdn %>/MANIFEST' - }, - themes: { - src: 'dist/<%= files.themes %>', - dest: 'dist/<%= files.themes %>/MANIFEST' - } - }, - qunit: { - files: file.expand('tests/unit/**/*.html').filter(function(file) { - // disabling everything that doesn't (quite) work with PhantomJS for now - // except for all|index|test, try to include more as we go - return !(/(all|index|test|draggable|droppable|selectable|resizable|sortable|dialog|slider|datepicker|tabs|tabs_deprecated)\.html/).test(file); - }) - }, - lint: { - ui: 'ui/*', - grunt: 'grunt.js', - tests: 'tests/unit/**/*.js' - }, - csslint: { - base_theme: { - src: 'themes/base/*.css', - rules: { - 'import': false, - 'overqualified-elements': 2 - } - } - }, - jshint: { - options: { - curly: true, - eqeqeq: true, - immed: true, - latedef: true, - newcap: true, - noarg: true, - sub: true, - undef: true, - eqnull: true - }, - grunt: { - options: { - node: true - }, - globals: { - task: true, - config: true, - file: true, - log: true, - template: true - } - }, - ui: { - options: { - browser: true - }, - globals: { - jQuery: true - } - }, - tests: { - options: { - jquery: true - }, - globals: { - module: true, - test: true, - ok: true, - equal: true, - deepEqual: true, - QUnit: true - } - } - } + pkg: "", + files: { + dist: "<%= pkg.name %>-<%= pkg.version %>", + cdn: "<%= pkg.name %>-<%= pkg.version %>-cdn", + themes: "<%= pkg.name %>-themes-<%= pkg.version %>" + }, + meta: { + banner: createBanner(), + bannerAll: createBanner( uiFiles ), + bannerI18n: createBanner( allI18nFiles ), + bannerCSS: createBanner( cssFiles ) + }, + compare_size: { + files: [ + "dist/jquery-ui.js", + "dist/jquery-ui.min.js" + ] + }, + concat: { + ui: { + src: [ "", stripBanner( uiFiles ) ], + dest: "dist/jquery-ui.js" + }, + i18n: { + src: [ "", allI18nFiles ], + dest: "dist/i18n/jquery-ui-i18n.js" + }, + css: { + src: [ "", stripBanner( cssFiles ) ], + dest: "dist/jquery-ui.css" + } + }, + min: minify, + css_min: minifyCSS, + copy: { + dist: { + src: [ + "AUTHORS.txt", + "GPL-LICENSE.txt", + "jquery-1.7.1.js", + "MIT-LICENSE.txt", + "README.md", + "grunt.js", + "package.json", + "ui/**/*", + "demos/**/*", + "themes/**/*", + "external/**/*", + "tests/**/*" + ], + renames: { + "dist/jquery-ui.js": "ui/jquery-ui.js", + "dist/jquery-ui.min.js": "ui/minified/jquery-ui.min.js", + "dist/i18n/jquery-ui-i18n.js": "ui/i18n/jquery-ui-i18n.js", + "dist/i18n/jquery-ui-i18n.min.js": "ui/minified/i18n/jquery-ui-i18n.min.js", + "dist/jquery-ui.css": "themes/base/jquery-ui.css", + "dist/jquery-ui.min.css": "themes/base/minified/jquery-ui.min.css" + }, + dest: "dist/<%= files.dist %>" + }, + dist_min: { + src: "dist/minified/**/*", + strip: /^dist/, + dest: "dist/<%= files.dist %>/ui" + }, + dist_css_min: { + src: "dist/themes/base/minified/*.css", + strip: /^dist/, + dest: "dist/<%= files.dist %>" + }, + dist_min_images: { + src: "themes/base/images/*", + strip: /^themes\/base\//, + dest: "dist/<%= files.dist %>/themes/base/minified" + }, + cdn: { + src: [ + "AUTHORS.txt", + "GPL-LICENSE.txt", + "MIT-LICENSE.txt", + "ui/*.js", + "package.json" + ], + renames: { + "dist/jquery-ui.js": "jquery-ui.js", + "dist/jquery-ui.min.js": "jquery-ui.min.js", + "dist/i18n/jquery-ui-i18n.js": "i18n/jquery-ui-i18n.js", + "dist/i18n/jquery-ui-i18n.min.js": "i18n/jquery-ui-i18n.min.js", + "dist/jquery-ui.css": "themes/base/jquery-ui.css", + "dist/jquery-ui.min.css": "themes/base/minified/jquery-ui.min.css" + }, + dest: "dist/<%= files.cdn %>" + }, + cdn_i18n: { + src: "ui/i18n/jquery.ui.datepicker-*.js", + strip: "ui/", + dest: "dist/<%= files.cdn %>" + }, + cdn_i18n_min: { + src: "dist/minified/i18n/jquery.ui.datepicker-*.js", + strip: "dist/minified", + dest: "dist/<%= files.cdn %>" + }, + cdn_min: { + src: "dist/minified/*.js", + strip: /^dist\/minified/, + dest: "dist/<%= files.cdn %>/ui" + }, + cdn_min_images: { + src: "themes/base/images/*", + strip: /^themes\/base\//, + dest: "dist/<%= files.cdn %>/themes/base/minified" + }, + cdn_themes: { + src: "dist/<%= files.themes %>/themes/**/*", + strip: "dist/<%= files.themes %>", + dest: "dist/<%= files.cdn %>" + }, + themes: { + src: [ + "AUTHORS.txt", + "GPL-LICENSE.txt", + "MIT-LICENSE.txt", + "package.json" + ], + dest: "dist/<%= files.themes %>" + } + }, + zip: { + dist: { + src: "<%= files.dist %>", + dest: "<%= files.dist %>.zip" + }, + cdn: { + src: "<%= files.cdn %>", + dest: "<%= files.cdn %>.zip" + }, + themes: { + src: "<%= files.themes %>", + dest: "<%= files.themes %>.zip" + } + }, + md5: { + dist: { + src: "dist/<%= files.dist %>", + dest: "dist/<%= files.dist %>/MANIFEST" + }, + cdn: { + src: "dist/<%= files.cdn %>", + dest: "dist/<%= files.cdn %>/MANIFEST" + }, + themes: { + src: "dist/<%= files.themes %>", + dest: "dist/<%= files.themes %>/MANIFEST" + } + }, + qunit: { + files: file.expand( "tests/unit/**/*.html" ).filter(function( file ) { + // disabling everything that doesn't (quite) work with PhantomJS for now + // except for all|index|test, try to include more as we go + return !( /(all|index|test|draggable|droppable|selectable|resizable|sortable|dialog|slider|datepicker|tabs|tabs_deprecated)\.html/ ).test( file ); + }) + }, + lint: { + ui: "ui/*", + grunt: "grunt.js", + tests: "tests/unit/**/*.js" + }, + csslint: { + base_theme: { + src: "themes/base/*.css", + rules: { + "import": false, + "overqualified-elements": 2 + } + } + }, + jshint: { + options: { + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + eqnull: true + }, + grunt: { + options: { + node: true + }, + globals: { + task: true, + config: true, + file: true, + log: true, + template: true + } + }, + ui: { + options: { + browser: true + }, + globals: { + jQuery: true + } + }, + tests: { + options: { + jquery: true + }, + globals: { + module: true, + test: true, + ok: true, + equal: true, + deepEqual: true, + QUnit: true + } + } + } }); -task.registerBasicTask('copy', 'Copy files to destination folder and replace @VERSION with pkg.version', function() { - function replaceVersion(source) { - return source.replace("@VERSION", config("pkg.version")); - } - var files = file.expand(this.file.src); - var target = this.file.dest + '/'; - var strip = this.data.strip; - if (typeof strip === 'string') { - strip = new RegExp('^' + template.process(strip, config()).replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&")); - } - files.forEach(function(fileName) { - var targetFile = strip ? fileName.replace(strip, '') : fileName; - file.copy(fileName, target + targetFile, replaceVersion); - }); - log.writeln('Copyied ' + files.length + ' files.'); - var renameCount = 0; - for (var fileName in this.data.renames) { - renameCount += 1; - file.copy(fileName, target + template.process(this.data.renames[fileName], config())); - } - if (renameCount) { - log.writeln('Renamed ' + renameCount + ' files.'); - } +task.registerBasicTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() { + function replaceVersion( source ) { + return source.replace( "@VERSION", config( "pkg.version" ) ); + } + var files = file.expand( this.file.src ); + var target = this.file.dest + "/"; + var strip = this.data.strip; + if ( typeof strip === "string" ) { + strip = new RegExp( "^" + template.process( strip, config() ).replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ) ); + } + files.forEach(function( fileName ) { + var targetFile = strip ? fileName.replace( strip, "" ) : fileName; + file.copy( fileName, target + targetFile, replaceVersion ); + }); + log.writeln( "Copied " + files.length + " files." ); + var renameCount = 0; + for ( var fileName in this.data.renames ) { + renameCount += 1; + file.copy( fileName, target + template.process( this.data.renames[ fileName ], config() ) ); + } + if ( renameCount ) { + log.writeln( "Renamed " + renameCount + " files." ); + } }); -task.registerBasicTask('zip', 'Create a zip file for release', function() { - var done = this.async(); - // TODO switch back to adm-zip for better cross-platform compability once it actually works - // 0.1.2 doesn't compress properly (or at all) +task.registerBasicTask( "zip", "Create a zip file for release", function() { + var done = this.async(); + // TODO switch back to adm-zip for better cross-platform compability once it actually works + // 0.1.2 doesn't compress properly (or at all) - // var files = file.expand(this.file.src); - // log.writeln("Creating zip file " + this.file.dest); + // var files = file.expand(this.file.src); + // log.writeln("Creating zip file " + this.file.dest); - // var fs = require('fs'); - // var AdmZip = require('adm-zip'); - // var zip = new AdmZip(); - // files.forEach(function(file) { - // log.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(this.file.dest); - // log.writeln("Wrote " + files.length + " files to " + this.file.dest); + // var fs = require('fs'); + // var AdmZip = require('adm-zip'); + // var zip = new AdmZip(); + // files.forEach(function(file) { + // log.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(this.file.dest); + // log.writeln("Wrote " + files.length + " files to " + this.file.dest); - var dest = this.file.dest; - var src = template.process(this.file.src, config()); - utils.spawn({ - cmd: "zip", - args: ["-r", dest, src], - opts: { - cwd: 'dist' - } - }, function(err, result) { - if (err) { - log.error(err); - done(); - return; - } - log.writeln("Zipped " + dest); - done(); - }); + var dest = this.file.dest; + var src = template.process( this.file.src, config() ); + utils.spawn({ + cmd: "zip", + args: [ "-r", dest, src ], + opts: { + cwd: 'dist' + } + }, function( err, result ) { + if ( err ) { + log.error( err ); + done(); + return; + } + log.writeln( "Zipped " + dest ); + done(); + }); }); -task.registerBasicTask('csslint', 'Lint CSS files with csslint', function() { - var csslint = require('csslint').CSSLint; - var files = file.expand(this.file.src); - var ruleset = {}; - csslint.getRules().forEach(function(rule) { - ruleset[rule.id] = 1; - }); - for (var rule in this.data.rules) { - if (!this.data.rules[rule]) { - delete ruleset[rule]; - } else { - ruleset[rule] = this.data.rules[rule]; - } - } - var hadErrors = 0; - files.forEach(function(filepath) { - log.writeln('Linting ' + filepath); - var result = csslint.verify(file.read(filepath), ruleset); - result.messages.forEach(function(message) { - log.writeln('['.red + ('L' + message.line).yellow + ':'.red + ('C' + message.col).yellow + ']'.red); - log[message.type === 'error' ? 'error' : 'writeln'](message.message + ' ' + message.rule.desc + ' (' + message.rule.id + ')'); - }); - if (result.messages.length) { - hadErrors += 1; - } - }); - if (hadErrors) { - return false; - } - log.writeln('Lint free'); +task.registerBasicTask( "csslint", "Lint CSS files with csslint", function() { + var csslint = require( "csslint" ).CSSLint; + var files = file.expand( this.file.src ); + var ruleset = {}; + csslint.getRules().forEach(function( rule ) { + ruleset[ rule.id ] = 1; + }); + for ( var rule in this.data.rules ) { + if ( !this.data.rules[ rule ] ) { + delete ruleset[rule]; + } else { + ruleset[ rule ] = this.data.rules[ rule ]; + } + } + var hadErrors = 0; + files.forEach(function( filepath ) { + log.writeln( "Linting " + filepath ); + var result = csslint.verify( file.read( filepath ), ruleset ); + result.messages.forEach(function( message ) { + log.writeln( "[".red + ( "L" + message.line ).yellow + ":".red + ( "C" + message.col ).yellow + "]".red ); + log[ message.type === "error" ? "error" : "writeln" ]( message.message + " " + message.rule.desc + " (" + message.rule.id + ")" ); + }); + if ( result.messages.length ) { + hadErrors += 1; + } + }); + if (hadErrors) { + return false; + } + log.writeln( "Lint free" ); }); -task.registerBasicTask( 'css_min', 'Minify CSS files with Sqwish.', function() { - var max = task.helper( 'concat', file.expand( this.file.src ) ); - var min = require('sqwish').minify( max, false ); - file.write( this.file.dest, min ); - log.writeln( 'File "' + this.file.dest + '" created.' ); - task.helper( 'min_max_info', min, max ); +task.registerBasicTask( "css_min", "Minify CSS files with Sqwish.", function() { + var max = task.helper( "concat", file.expand( this.file.src ) ); + var min = require( "sqwish" ).minify( max, false ); + file.write( this.file.dest, min ); + log.writeln( "File '" + this.file.dest + "' created." ); + task.helper( "min_max_info", min, max ); }); -task.registerBasicTask('md5', 'Create list of md5 hashes for CDN uploads', function() { - // remove dest file before creating it, to make sure itself is not included - if (require('path').existsSync(this.file.dest)) { - require('fs').unlinkSync(this.file.dest); - } - var crypto = require('crypto'); - var dir = this.file.src + '/'; - var hashes = []; - file.expand(dir + '**/*').forEach(function(fileName) { - var hash = crypto.createHash('md5'); - hash.update(file.read(fileName)); - hashes.push(fileName.replace(dir, '') + ' ' + hash.digest('hex')); - }); - file.write(this.file.dest, hashes.join('\n') + '\n'); - log.writeln('Wrote ' + this.file.dest + ' with ' + hashes.length + ' hashes'); +task.registerBasicTask( "md5", "Create list of md5 hashes for CDN uploads", function() { + // remove dest file before creating it, to make sure itself is not included + if ( require( "path" ).existsSync( this.file.dest ) ) { + require( "fs" ).unlinkSync( this.file.dest ); + } + var crypto = require( "crypto" ); + var dir = this.file.src + "/"; + var hashes = []; + file.expand( dir + "**/*" ).forEach(function( fileName ) { + var hash = crypto.createHash( "md5" ); + hash.update( file.read( fileName ) ); + hashes.push( fileName.replace( dir, "" ) + " " + hash.digest( "hex" ) ); + }); + file.write( this.file.dest, hashes.join( "\n" ) + "\n" ); + log.writeln( "Wrote " + this.file.dest + " with " + hashes.length + " hashes" ); }); -task.registerTask('download_themes', function() { - // var AdmZip = require('adm-zip'); - var fs = require('fs'); - var request = require('request'); - var done = this.async(); - var themes = file.read('build/themes').split(','); - var requests = 0; - file.mkdir('dist/tmp'); - themes.forEach(function(theme, index) { - requests += 1; - file.mkdir('dist/tmp/' + index); - var zipFileName = 'dist/tmp/' + index + '.zip'; - var out = fs.createWriteStream(zipFileName); - out.on('close', function() { - log.writeln("done downloading " + zipFileName); - // TODO AdmZip produces "crc32 checksum failed", need to figure out why - // var zip = new AdmZip(zipFileName); - // zip.extractAllTo('dist/tmp/' + index + '/'); - // until then, using cli unzip... - utils.spawn({ - cmd: "unzip", - args: ["-d", "dist/tmp/" + index, zipFileName] - }, function(err, result) { - log.writeln("Unzipped " + zipFileName + ", deleting it now"); - fs.unlinkSync(zipFileName); - requests -= 1; - if (requests === 0) { - done(); - } - }); - - }); - request('http://ui-dev.jquery.com/download/?' + theme).pipe(out); - }); +task.registerTask( "download_themes", function() { + // var AdmZip = require('adm-zip'); + var fs = require( "fs" ); + var request = require( "request" ); + var done = this.async(); + var themes = file.read( "build/themes" ).split(","); + var requests = 0; + file.mkdir( "dist/tmp" ); + themes.forEach(function( theme, index ) { + requests += 1; + file.mkdir( "dist/tmp/" + index ); + var zipFileName = "dist/tmp/" + index + ".zip"; + var out = fs.createWriteStream( zipFileName ); + out.on( "close", function() { + log.writeln( "done downloading " + zipFileName ); + // TODO AdmZip produces "crc32 checksum failed", need to figure out why + // var zip = new AdmZip(zipFileName); + // zip.extractAllTo('dist/tmp/' + index + '/'); + // until then, using cli unzip... + utils.spawn({ + cmd: "unzip", + args: [ "-d", "dist/tmp/" + index, zipFileName ] + }, function( err, result ) { + log.writeln( "Unzipped " + zipFileName + ", deleting it now" ); + fs.unlinkSync( zipFileName ); + requests -= 1; + if (requests === 0) { + done(); + } + }); + }); + request( "http://ui-dev.jquery.com/download/?" + theme ).pipe( out ); + }); }); -task.registerTask('copy_themes', function() { - // each package includes the base theme, ignore that - var filter = /themes\/base/; - var files = file.expand('dist/tmp/*/development-bundle/themes/**/*').filter(function(file) { - return !filter.test(file); - }); - // TODO the template.process call shouldn't be necessary - var target = 'dist/' + template.process(config('files.themes'), config()) + '/'; - files.forEach(function(fileName) { - var targetFile = fileName.replace(/dist\/tmp\/\d+\/development-bundle\//, '').replace("jquery-ui-.custom", "jquery-ui.css"); - file.copy(fileName, target + targetFile); - }); +task.registerTask( "copy_themes", function() { + // each package includes the base theme, ignore that + var filter = /themes\/base/; + var files = file.expand( "dist/tmp/*/development-bundle/themes/**/*" ).filter(function( file ) { + return !filter.test( file ); + }); + // TODO the template.process call shouldn't be necessary + var target = "dist/" + template.process( config( "files.themes" ), config() ) + "/"; + files.forEach(function( fileName ) { + var targetFile = fileName.replace( /dist\/tmp\/\d+\/development-bundle\//, "" ).replace( "jquery-ui-.custom", "jquery-ui.css" ); + file.copy( fileName, target + targetFile ); + }); - // copy minified base theme from regular release - // TODO same as the one above - var distFolder = 'dist/' + template.process(config('files.dist'), config()); - files = file.expand(distFolder + '/themes/base/**/*'); - files.forEach(function(fileName) { - file.copy(fileName, target + fileName.replace(distFolder, '')); - }); + // copy minified base theme from regular release + // TODO same as the one above + var distFolder = "dist/" + template.process( config( "files.dist" ), config() ); + files = file.expand( distFolder + "/themes/base/**/*" ); + files.forEach(function( fileName ) { + file.copy( fileName, target + fileName.replace( distFolder, "" ) ); + }); }); // TODO merge with code in jQuery Core, share as grunt plugin/npm // this here actually uses the provided filenames in the output // the helpers should just be regular functions, no need to share those with the world -task.registerBasicTask("compare_size", "Compare size of this branch to master", function() { - var files = file.expand(this.file.src), - done = this.async(), - sizecache = __dirname + "/dist/.sizecache.json", - sources = { - min: file.read(files[1]), - max: file.read(files[0]) - }, - oldsizes = {}, - sizes = {}; +task.registerBasicTask( "compare_size", "Compare size of this branch to master", function() { + var files = file.expand( this.file.src ), + done = this.async(), + sizecache = __dirname + "/dist/.sizecache.json", + sources = { + min: file.read( files[1] ), + max: file.read( files[0] ) + }, + oldsizes = {}, + sizes = {}; - try { - oldsizes = JSON.parse(file.read(sizecache)); - } catch(e) { - oldsizes = {}; - } + try { + oldsizes = JSON.parse( file.read( sizecache ) ); + } catch( e ) { + oldsizes = {}; + } - // Obtain the current branch and continue... - task.helper("git_current_branch", function(err, branch) { - var key, diff; + // Obtain the current branch and continue... + task.helper( "git_current_branch", function( err, branch ) { + var key, diff; - // Derived and adapted from Corey Frang's original `sizer` - log.writeln( "sizes - compared to master" ); + // Derived and adapted from Corey Frang's original `sizer` + log.writeln( "sizes - compared to master" ); - sizes[files[0]] = sources.max.length; - sizes[files[1]] = sources.min.length; - sizes[files[1] + '.gz'] = task.helper("gzip", sources.min).length; + sizes[ files[0] ] = sources.max.length; + sizes[ files[1] ] = sources.min.length; + sizes[ files[1] + ".gz" ] = task.helper( "gzip", sources.min ).length; - for ( key in sizes ) { - diff = oldsizes[ key ] && ( sizes[ key ] - oldsizes[ key ] ); - if ( diff > 0 ) { - diff = "+" + diff; - } - console.log( "%s %s %s", - task.helper("lpad", sizes[ key ], 8 ), - task.helper("lpad", diff ? "(" + diff + ")" : "(-)", 8 ), - key - ); - } + for ( key in sizes ) { + diff = oldsizes[ key ] && ( sizes[ key ] - oldsizes[ key ] ); + if ( diff > 0 ) { + diff = "+" + diff; + } + console.log( "%s %s %s", + task.helper("lpad", sizes[ key ], 8 ), + task.helper("lpad", diff ? "(" + diff + ")" : "(-)", 8 ), + key + ); + } - if ( branch === "master" ) { - // If master, write to file - this makes it easier to compare - // the size of your current code state to the master branch, - // without returning to the master to reset the cache - file.write( sizecache, JSON.stringify(sizes) ); - } - done(); - }); + if ( branch === "master" ) { + // If master, write to file - this makes it easier to compare + // the size of your current code state to the master branch, + // without returning to the master to reset the cache + file.write( sizecache, JSON.stringify(sizes) ); + } + done(); + }); }); -task.registerHelper("git_current_branch", function(done) { - utils.spawn({ - cmd: "git", - args: ["branch", "--no-color"] - }, function(err, result) { - var branch; +task.registerHelper( "git_current_branch", function( done ) { + utils.spawn({ + cmd: "git", + args: [ "branch", "--no-color" ] + }, function( err, result ) { + var branch; - result.split("\n").forEach(function(branch) { - var matches = /^\* (.*)/.exec( branch ); - if ( matches !== null && matches.length && matches[ 1 ] ) { - done( null, matches[ 1 ] ); - } - }); - }); + result.split( "\n" ).forEach(function( branch ) { + var matches = /^\* (.*)/.exec( branch ); + if ( matches !== null && matches.length && matches[ 1 ] ) { + done( null, matches[ 1 ] ); + } + }); + }); }); -task.registerHelper("lpad", function(str, len, chr) { - return ( Array( len + 1 ).join( chr || " " ) + str ).substr( -len ); +task.registerHelper( "lpad", function( str, len, chr ) { + return ( Array( len + 1 ).join( chr || " " ) + str ).substr( -len ); }); -task.registerTask('default', 'lint csslint qunit build compare_size'); -task.registerTask('sizer', 'concat:ui min:dist/jquery-ui.min.js compare_size'); -task.registerTask('build', 'concat min css_min'); -task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist'); -task.registerTask('release_themes', 'release download_themes copy_themes copy:themes md5:themes zip:themes'); -task.registerTask('release_cdn', 'release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn'); +task.registerTask("default", "lint csslint qunit build compare_size" ); +task.registerTask("sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" ); +task.registerTask("build", "concat min css_min" ); +task.registerTask("release", "build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" ); +task.registerTask("release_themes", "release download_themes copy_themes copy:themes md5:themes zip:themes" ); +task.registerTask("release_cdn", "release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn" ); -- cgit v1.2.3 From 5f95e7c815874afa562f54c9ca9f9d893f677dd7 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Mon, 19 Mar 2012 22:56:34 +0100 Subject: Build/grunt: Update to latest grunt API, using reigsterMultiTask instead of registerBasicTask --- grunt.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/grunt.js b/grunt.js index 9d0e721f2..f256f4766 100644 --- a/grunt.js +++ b/grunt.js @@ -281,7 +281,7 @@ config.init({ } }); -task.registerBasicTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() { +task.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() { function replaceVersion( source ) { return source.replace( "@VERSION", config( "pkg.version" ) ); } @@ -307,7 +307,7 @@ task.registerBasicTask( "copy", "Copy files to destination folder and replace @V }); -task.registerBasicTask( "zip", "Create a zip file for release", function() { +task.registerMultiTask( "zip", "Create a zip file for release", function() { var done = this.async(); // TODO switch back to adm-zip for better cross-platform compability once it actually works // 0.1.2 doesn't compress properly (or at all) @@ -345,7 +345,7 @@ task.registerBasicTask( "zip", "Create a zip file for release", function() { }); }); -task.registerBasicTask( "csslint", "Lint CSS files with csslint", function() { +task.registerMultiTask( "csslint", "Lint CSS files with csslint", function() { var csslint = require( "csslint" ).CSSLint; var files = file.expand( this.file.src ); var ruleset = {}; @@ -377,7 +377,7 @@ task.registerBasicTask( "csslint", "Lint CSS files with csslint", function() { log.writeln( "Lint free" ); }); -task.registerBasicTask( "css_min", "Minify CSS files with Sqwish.", function() { +task.registerMultiTask( "css_min", "Minify CSS files with Sqwish.", function() { var max = task.helper( "concat", file.expand( this.file.src ) ); var min = require( "sqwish" ).minify( max, false ); file.write( this.file.dest, min ); @@ -385,7 +385,7 @@ task.registerBasicTask( "css_min", "Minify CSS files with Sqwish.", function() { task.helper( "min_max_info", min, max ); }); -task.registerBasicTask( "md5", "Create list of md5 hashes for CDN uploads", function() { +task.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 ( require( "path" ).existsSync( this.file.dest ) ) { require( "fs" ).unlinkSync( this.file.dest ); @@ -462,7 +462,7 @@ task.registerTask( "copy_themes", function() { // TODO merge with code in jQuery Core, share as grunt plugin/npm // this here actually uses the provided filenames in the output // the helpers should just be regular functions, no need to share those with the world -task.registerBasicTask( "compare_size", "Compare size of this branch to master", function() { +task.registerMultiTask( "compare_size", "Compare size of this branch to master", function() { var files = file.expand( this.file.src ), done = this.async(), sizecache = __dirname + "/dist/.sizecache.json", -- cgit v1.2.3 From 72d3aa2740ab8fc079098e8656f41e40c01ee550 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Mon, 19 Mar 2012 22:57:51 +0100 Subject: Build/grunt: Add a clean task. Good enough for now, but not really a good implementation --- grunt.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/grunt.js b/grunt.js index f256f4766..e7395285a 100644 --- a/grunt.js +++ b/grunt.js @@ -459,6 +459,14 @@ task.registerTask( "copy_themes", function() { }); }); +task.registerTask( "clean", function() { + // TODO use node methods and keep the dir, only delete its content + utils.spawn({ + cmd: "rm", + args: [ "-rf", "dist" ] + }, this.async()); +}); + // TODO merge with code in jQuery Core, share as grunt plugin/npm // this here actually uses the provided filenames in the output // the helpers should just be regular functions, no need to share those with the world -- cgit v1.2.3 From 2a1ee3725818c339ab45894db0347e016188e2d8 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Mon, 19 Mar 2012 23:08:56 +0100 Subject: Build/grunt: Another attempt at using adm-zip. Keep the result in place, but don't (yet) use it - need to report issues to adm-zip --- grunt.js | 26 +++++++++++++------------- package.json | 3 ++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/grunt.js b/grunt.js index e7395285a..83522ebb4 100644 --- a/grunt.js +++ b/grunt.js @@ -308,24 +308,24 @@ task.registerMultiTask( "copy", "Copy files to destination folder and replace @V task.registerMultiTask( "zip", "Create a zip file for release", function() { - var done = this.async(); // TODO switch back to adm-zip for better cross-platform compability once it actually works - // 0.1.2 doesn't compress properly (or at all) - - // var files = file.expand(this.file.src); - // log.writeln("Creating zip file " + this.file.dest); + // 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 = file.expand( "dist/" + this.file.src + "/**/*" ); + // log.writeln( "Creating zip file " + this.file.dest ); - // var fs = require('fs'); - // var AdmZip = require('adm-zip'); + // var fs = require( "fs" ); + // var AdmZip = require( "adm-zip" ); // var zip = new AdmZip(); - // files.forEach(function(file) { - // log.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)); + // files.forEach(function( file ) { + // log.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(this.file.dest); - // log.writeln("Wrote " + files.length + " files to " + this.file.dest); + // zip.writeZip( "dist/" + this.file.dest ); + // log.writeln( "Wrote " + files.length + " files to " + this.file.dest ); + var done = this.async(); var dest = this.file.dest; var src = template.process( this.file.src, config() ); utils.spawn({ diff --git a/package.json b/package.json index cd0c9f78d..02d7a1173 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "grunt": "0.2.x", "sqwish": "0.2.x", "request": "2.9.x", - "csslint": "0.9.x" + "csslint": "0.9.x", + "adm-zip": "0.1.x" }, "keywords": [] } \ No newline at end of file -- cgit v1.2.3 From 392c003e636abd5ab169f0bd7e57dc3439bc3ad8 Mon Sep 17 00:00:00 2001 From: Scott González Date: Wed, 21 Mar 2012 13:24:31 -0400 Subject: Update QUnit. --- external/qunit.css | 2 +- external/qunit.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/external/qunit.css b/external/qunit.css index 4be7e3643..e3e10f9f9 100644 --- a/external/qunit.css +++ b/external/qunit.css @@ -1,5 +1,5 @@ /** - * QUnit v1.4.0 - A JavaScript Unit Testing Framework + * QUnit v1.5.0pre - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * diff --git a/external/qunit.js b/external/qunit.js index f50407ae5..71aac0efa 100644 --- a/external/qunit.js +++ b/external/qunit.js @@ -1,5 +1,5 @@ /** - * QUnit v1.4.0 - A JavaScript Unit Testing Framework + * QUnit v1.5.0pre - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * @@ -370,7 +370,7 @@ var QUnit = { } try { - block(); + block.call(config.current.testEnvironment); } catch (e) { actual = e; } @@ -873,9 +873,11 @@ function done() { // clear own sessionStorage items if all tests passed if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { - for (var key in sessionStorage) { - if (sessionStorage.hasOwnProperty(key) && key.indexOf("qunit-test-") === 0 ) { - sessionStorage.removeItem(key); + var key; + for ( var i = 0; i < sessionStorage.length; i++ ) { + key = sessionStorage.key( i++ ); + if ( key.indexOf("qunit-test-") === 0 ) { + sessionStorage.removeItem( key ); } } } @@ -912,8 +914,9 @@ function validTest( name ) { return run; } -// so far supports only Firefox, Chrome and Opera (buggy) -// could be extended in the future to use something like https://github.com/csnover/TraceKit +// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) +// Later Safari and IE10 are supposed to support error.stack as well +// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack function extractStacktrace( e, offset ) { offset = offset || 3; if (e.stacktrace) { -- cgit v1.2.3 From a84512f9cfb796464e6e9ce4fc5d4a6d4f386635 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Wed, 21 Mar 2012 21:19:31 +0100 Subject: Build/grunt: Use rimraf for clean task. Fix cop_hemes task to correctly rename the -custom.css file --- grunt.js | 8 ++------ package.json | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/grunt.js b/grunt.js index 83522ebb4..37f2d9178 100644 --- a/grunt.js +++ b/grunt.js @@ -446,7 +446,7 @@ task.registerTask( "copy_themes", function() { // TODO the template.process call shouldn't be necessary var target = "dist/" + template.process( config( "files.themes" ), config() ) + "/"; files.forEach(function( fileName ) { - var targetFile = fileName.replace( /dist\/tmp\/\d+\/development-bundle\//, "" ).replace( "jquery-ui-.custom", "jquery-ui.css" ); + var targetFile = fileName.replace( /dist\/tmp\/\d+\/development-bundle\//, "" ).replace( "jquery-ui-.custom", "jquery-ui" ); file.copy( fileName, target + targetFile ); }); @@ -460,11 +460,7 @@ task.registerTask( "copy_themes", function() { }); task.registerTask( "clean", function() { - // TODO use node methods and keep the dir, only delete its content - utils.spawn({ - cmd: "rm", - args: [ "-rf", "dist" ] - }, this.async()); + require( "rimraf" ).sync( "dist" ); }); // TODO merge with code in jQuery Core, share as grunt plugin/npm diff --git a/package.json b/package.json index 02d7a1173..de297f467 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "sqwish": "0.2.x", "request": "2.9.x", "csslint": "0.9.x", - "adm-zip": "0.1.x" + "adm-zip": "0.1.x", + "rimraf": "2.0.1" }, "keywords": [] } \ No newline at end of file -- cgit v1.2.3 From a00e7f3c8238a5a944d13d4df6745653fed766b7 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Wed, 21 Mar 2012 21:27:34 +0100 Subject: Build/grunt: Always clean befoe release task --- grunt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 37f2d9178..2004a2773 100644 --- a/grunt.js +++ b/grunt.js @@ -537,6 +537,6 @@ task.registerHelper( "lpad", function( str, len, chr ) { task.registerTask("default", "lint csslint qunit build compare_size" ); task.registerTask("sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" ); task.registerTask("build", "concat min css_min" ); -task.registerTask("release", "build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" ); +task.registerTask("release", "clean build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" ); task.registerTask("release_themes", "release download_themes copy_themes copy:themes md5:themes zip:themes" ); task.registerTask("release_cdn", "release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn" ); -- cgit v1.2.3 From a454c5d24632cac110fd36f2cdd3e7402069074f Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 22 Mar 2012 13:51:08 +0100 Subject: Build/grunt: Use ascii encoding when reading files for digesting --- grunt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 2004a2773..e2d9ebc22 100644 --- a/grunt.js +++ b/grunt.js @@ -395,7 +395,7 @@ task.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", func var hashes = []; file.expand( dir + "**/*" ).forEach(function( fileName ) { var hash = crypto.createHash( "md5" ); - hash.update( file.read( fileName ) ); + hash.update( file.read( fileName, 'ascii' ) ); hashes.push( fileName.replace( dir, "" ) + " " + hash.digest( "hex" ) ); }); file.write( this.file.dest, hashes.join( "\n" ) + "\n" ); -- cgit v1.2.3 From 12832b7c35e2cb9e37ed4aa3f64a3c46eb114310 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 22 Mar 2012 13:54:47 +0100 Subject: Build/grunt: Coding standards --- grunt.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/grunt.js b/grunt.js index e2d9ebc22..bbc358e4b 100644 --- a/grunt.js +++ b/grunt.js @@ -395,7 +395,7 @@ task.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", func var hashes = []; file.expand( dir + "**/*" ).forEach(function( fileName ) { var hash = crypto.createHash( "md5" ); - hash.update( file.read( fileName, 'ascii' ) ); + hash.update( file.read( fileName, "ascii" ) ); hashes.push( fileName.replace( dir, "" ) + " " + hash.digest( "hex" ) ); }); file.write( this.file.dest, hashes.join( "\n" ) + "\n" ); @@ -534,9 +534,9 @@ task.registerHelper( "lpad", function( str, len, chr ) { return ( Array( len + 1 ).join( chr || " " ) + str ).substr( -len ); }); -task.registerTask("default", "lint csslint qunit build compare_size" ); -task.registerTask("sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" ); -task.registerTask("build", "concat min css_min" ); -task.registerTask("release", "clean build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" ); -task.registerTask("release_themes", "release download_themes copy_themes copy:themes md5:themes zip:themes" ); -task.registerTask("release_cdn", "release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn" ); +task.registerTask( "default", "lint csslint qunit build compare_size" ); +task.registerTask( "sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" ); +task.registerTask( "build", "concat min css_min" ); +task.registerTask( "release", "clean build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" ); +task.registerTask( "release_themes", "release download_themes copy_themes copy:themes md5:themes zip:themes" ); +task.registerTask( "release_cdn", "release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn" ); -- cgit v1.2.3 From 89ff5c523241a45c54cca0d4e1610381e092fef6 Mon Sep 17 00:00:00 2001 From: Scott González Date: Thu, 22 Mar 2012 09:45:22 -0400 Subject: Upgrade jQuery to 1.7.2. --- demos/accordion/collapsible.html | 2 +- demos/accordion/custom-icons.html | 2 +- demos/accordion/default.html | 2 +- demos/accordion/fillspace.html | 2 +- demos/accordion/hoverintent.html | 2 +- demos/accordion/no-auto-height.html | 2 +- demos/accordion/sortable.html | 2 +- demos/addClass/default.html | 2 +- demos/animate/default.html | 2 +- demos/autocomplete/categories.html | 2 +- demos/autocomplete/combobox.html | 2 +- demos/autocomplete/custom-data.html | 2 +- demos/autocomplete/default.html | 2 +- demos/autocomplete/folding.html | 2 +- demos/autocomplete/maxheight.html | 2 +- demos/autocomplete/multiple-remote.html | 2 +- demos/autocomplete/multiple.html | 2 +- demos/autocomplete/remote-jsonp.html | 2 +- demos/autocomplete/remote-with-cache.html | 2 +- demos/autocomplete/remote.html | 2 +- demos/autocomplete/xml.html | 2 +- demos/button/checkbox.html | 2 +- demos/button/default.html | 2 +- demos/button/icons.html | 2 +- demos/button/radio.html | 2 +- demos/button/splitbutton.html | 2 +- demos/button/toolbar.html | 2 +- demos/datepicker/alt-field.html | 2 +- demos/datepicker/animation.html | 2 +- demos/datepicker/buttonbar.html | 2 +- demos/datepicker/date-formats.html | 2 +- demos/datepicker/date-range.html | 2 +- demos/datepicker/default.html | 2 +- demos/datepicker/dropdown-month-year.html | 2 +- demos/datepicker/icon-trigger.html | 2 +- demos/datepicker/inline.html | 2 +- demos/datepicker/localization.html | 2 +- demos/datepicker/min-max.html | 2 +- demos/datepicker/multiple-calendars.html | 2 +- demos/datepicker/other-months.html | 2 +- demos/datepicker/show-week.html | 2 +- demos/dialog/animated.html | 2 +- demos/dialog/default.html | 2 +- demos/dialog/modal-confirmation.html | 2 +- demos/dialog/modal-form.html | 2 +- demos/dialog/modal-message.html | 2 +- demos/dialog/modal.html | 2 +- demos/draggable/constrain-movement.html | 2 +- demos/draggable/cursor-style.html | 2 +- demos/draggable/default.html | 2 +- demos/draggable/delay-start.html | 2 +- demos/draggable/events.html | 2 +- demos/draggable/handle.html | 2 +- demos/draggable/revert.html | 2 +- demos/draggable/scroll.html | 2 +- demos/draggable/snap-to.html | 2 +- demos/draggable/sortable.html | 2 +- demos/draggable/visual-feedback.html | 2 +- demos/droppable/accepted-elements.html | 2 +- demos/droppable/default.html | 2 +- demos/droppable/photo-manager.html | 2 +- demos/droppable/propagation.html | 2 +- demos/droppable/revert.html | 2 +- demos/droppable/shopping-cart.html | 2 +- demos/droppable/visual-feedback.html | 2 +- demos/effect/default.html | 2 +- demos/effect/easing.html | 2 +- demos/hide/default.html | 2 +- demos/index.html | 2 +- demos/menu/default.html | 2 +- demos/menu/navigationmenu.html | 2 +- demos/menu/topalignmenu.html | 2 +- demos/position/cycler.html | 2 +- demos/position/default.html | 2 +- demos/progressbar/animated.html | 2 +- demos/progressbar/default.html | 2 +- demos/progressbar/resize.html | 2 +- demos/removeClass/default.html | 2 +- demos/resizable/animate.html | 2 +- demos/resizable/aspect-ratio.html | 2 +- demos/resizable/constrain-area.html | 2 +- demos/resizable/default.html | 2 +- demos/resizable/delay-start.html | 2 +- demos/resizable/helper.html | 2 +- demos/resizable/max-min.html | 2 +- demos/resizable/snap-to-grid.html | 2 +- demos/resizable/synchronous-resize.html | 2 +- demos/resizable/textarea.html | 2 +- demos/resizable/visual-feedback.html | 2 +- demos/selectable/default.html | 2 +- demos/selectable/display-grid.html | 2 +- demos/selectable/serialize.html | 2 +- demos/show/default.html | 2 +- demos/slider/colorpicker.html | 2 +- demos/slider/default.html | 2 +- demos/slider/hotelrooms.html | 2 +- demos/slider/multiple-vertical.html | 2 +- demos/slider/range-vertical.html | 2 +- demos/slider/range.html | 2 +- demos/slider/rangemax.html | 2 +- demos/slider/rangemin.html | 2 +- demos/slider/side-scroll.html | 2 +- demos/slider/slider-vertical.html | 2 +- demos/slider/steps.html | 2 +- demos/slider/tabs.html | 2 +- demos/sortable/connect-lists-through-tabs.html | 2 +- demos/sortable/connect-lists.html | 2 +- demos/sortable/default.html | 2 +- demos/sortable/delay-start.html | 2 +- demos/sortable/display-grid.html | 2 +- demos/sortable/empty-lists.html | 2 +- demos/sortable/items.html | 2 +- demos/sortable/placeholder.html | 2 +- demos/sortable/portlets.html | 2 +- demos/spinner/currency.html | 2 +- demos/spinner/decimal.html | 2 +- demos/spinner/default.html | 2 +- demos/spinner/latlong.html | 2 +- demos/spinner/overflow.html | 2 +- demos/spinner/time.html | 2 +- demos/switchClass/default.html | 2 +- demos/tabs/ajax.html | 2 +- demos/tabs/bottom.html | 2 +- demos/tabs/collapsible.html | 2 +- demos/tabs/cookie.html | 2 +- demos/tabs/default.html | 2 +- demos/tabs/manipulation.html | 2 +- demos/tabs/mouseover.html | 2 +- demos/tabs/sortable.html | 2 +- demos/tabs/vertical.html | 2 +- demos/toggle/default.html | 2 +- demos/toggleClass/default.html | 2 +- demos/tooltip/custom-animation.html | 2 +- demos/tooltip/custom-content.html | 2 +- demos/tooltip/custom-style.html | 2 +- demos/tooltip/default.html | 2 +- demos/tooltip/forms.html | 2 +- demos/tooltip/tracking.html | 2 +- demos/tooltip/video-player.html | 2 +- demos/widget/default.html | 2 +- jquery-1.7.1.js | 9266 ------------------- jquery-1.7.2.js | 9404 ++++++++++++++++++++ tests/index.html | 2 +- tests/jquery-1.7.2.js | 9404 ++++++++++++++++++++ tests/jquery.js | 2 +- tests/static/button/default.html | 2 +- tests/static/datepicker/datepicker.html | 2 +- tests/static/datepicker/default.html | 2 +- tests/static/icons.html | 2 +- tests/unit/accordion/all.html | 2 +- tests/unit/all-active.html | 2 +- tests/unit/all.html | 2 +- tests/unit/autocomplete/all.html | 2 +- tests/unit/button/all.html | 2 +- tests/unit/core/all.html | 2 +- tests/unit/datepicker/all.html | 2 +- tests/unit/dialog/all.html | 2 +- tests/unit/draggable/all.html | 2 +- tests/unit/droppable/all.html | 2 +- tests/unit/effects/all.html | 2 +- tests/unit/menu/all.html | 2 +- tests/unit/position/all.html | 2 +- tests/unit/progressbar/all.html | 2 +- tests/unit/resizable/all.html | 2 +- tests/unit/selectable/all.html | 2 +- tests/unit/slider/all.html | 2 +- tests/unit/sortable/all.html | 2 +- tests/unit/spinner/all.html | 2 +- tests/unit/subsuite.js | 2 +- tests/unit/tabs/all.html | 2 +- tests/unit/tooltip/all.html | 2 +- tests/unit/widget/all.html | 2 +- tests/visual/accordion/accordion.html | 2 +- tests/visual/addClass/addClass_queue.html | 2 +- tests/visual/button/button.html | 2 +- tests/visual/button/button_disabled_true.html | 2 +- tests/visual/button/button_performance.html | 2 +- tests/visual/button/button_ticket_5254.html | 2 +- tests/visual/button/button_ticket_5261.html | 2 +- tests/visual/button/button_ticket_5278.html | 2 +- tests/visual/compound/accordion_dialog.html | 2 +- tests/visual/compound/accordion_tabs.html | 2 +- tests/visual/compound/datepicker_dialog.html | 2 +- tests/visual/compound/draggable_accordion.html | 2 +- ...aggable_accordion_accordion_tabs_draggable.html | 2 +- .../compound/sortable_accordion_sortable_tabs.html | 2 +- tests/visual/compound/tabs_tabs.html | 2 +- tests/visual/compound/tabs_tooltips.html | 2 +- tests/visual/compound/widgets_in_dialog.html | 2 +- .../dialog/dialog_on_page_with_large_dom.html | 2 +- tests/visual/effects/effects.all.html | 2 +- tests/visual/effects/effects.scale.html | 2 +- tests/visual/menu/drilldown.html | 2 +- tests/visual/menu/menu.html | 2 +- tests/visual/menu/tablemenu.html | 2 +- tests/visual/position/position.html | 2 +- tests/visual/position/position_fit.html | 2 +- tests/visual/position/position_flip.html | 2 +- tests/visual/position/position_flipfit.html | 2 +- tests/visual/position/position_margin.html | 2 +- tests/visual/position/position_within.html | 2 +- tests/visual/theme.html | 2 +- tests/visual/tooltip/animations.html | 2 +- tests/visual/tooltip/callout.html | 2 +- tests/visual/tooltip/tooltip.html | 2 +- 205 files changed, 19010 insertions(+), 9468 deletions(-) delete mode 100644 jquery-1.7.1.js create mode 100644 jquery-1.7.2.js create mode 100644 tests/jquery-1.7.2.js diff --git a/demos/accordion/collapsible.html b/demos/accordion/collapsible.html index 922df00cb..e2e2d52a0 100644 --- a/demos/accordion/collapsible.html +++ b/demos/accordion/collapsible.html @@ -4,7 +4,7 @@ jQuery UI Accordion - Collapse content - + diff --git a/demos/accordion/custom-icons.html b/demos/accordion/custom-icons.html index c41af1120..54716d9a0 100644 --- a/demos/accordion/custom-icons.html +++ b/demos/accordion/custom-icons.html @@ -4,7 +4,7 @@ jQuery UI Accordion - Customize icons - + diff --git a/demos/accordion/default.html b/demos/accordion/default.html index 67197aa20..681fbdcaf 100644 --- a/demos/accordion/default.html +++ b/demos/accordion/default.html @@ -4,7 +4,7 @@ jQuery UI Accordion - Default functionality - + diff --git a/demos/accordion/fillspace.html b/demos/accordion/fillspace.html index 6095fa33f..ca2c5a0eb 100644 --- a/demos/accordion/fillspace.html +++ b/demos/accordion/fillspace.html @@ -4,7 +4,7 @@ jQuery UI Accordion - Fill space - + diff --git a/demos/accordion/hoverintent.html b/demos/accordion/hoverintent.html index d08c64be6..a70987fff 100644 --- a/demos/accordion/hoverintent.html +++ b/demos/accordion/hoverintent.html @@ -4,7 +4,7 @@ jQuery UI Accordion - Open on hoverintent - + diff --git a/demos/accordion/no-auto-height.html b/demos/accordion/no-auto-height.html index de07d625b..ab789f65d 100644 --- a/demos/accordion/no-auto-height.html +++ b/demos/accordion/no-auto-height.html @@ -4,7 +4,7 @@ jQuery UI Accordion - No auto height - + diff --git a/demos/accordion/sortable.html b/demos/accordion/sortable.html index cf9e8c86b..fda6ae7ca 100644 --- a/demos/accordion/sortable.html +++ b/demos/accordion/sortable.html @@ -4,7 +4,7 @@ jQuery UI Accordion - Sortable - + diff --git a/demos/addClass/default.html b/demos/addClass/default.html index 406466263..98f7c8c50 100644 --- a/demos/addClass/default.html +++ b/demos/addClass/default.html @@ -4,7 +4,7 @@ jQuery UI Effects - addClass demo - + - + diff --git a/tests/visual/button/button_disabled_true.html b/tests/visual/button/button_disabled_true.html index ac21a5683..25388a484 100644 --- a/tests/visual/button/button_disabled_true.html +++ b/tests/visual/button/button_disabled_true.html @@ -5,7 +5,7 @@ Button Visual Test : Button disabled true - + diff --git a/tests/visual/button/button_performance.html b/tests/visual/button/button_performance.html index 439e2c1ae..8ff6d0320 100644 --- a/tests/visual/button/button_performance.html +++ b/tests/visual/button/button_performance.html @@ -9,7 +9,7 @@ #toolbar { margin-top: 2em; padding:0.2em; } #ops1, #ops2, #format, #mode { margin-right: 1em } - + diff --git a/tests/visual/button/button_ticket_5254.html b/tests/visual/button/button_ticket_5254.html index 14d27698a..c46e094ab 100644 --- a/tests/visual/button/button_ticket_5254.html +++ b/tests/visual/button/button_ticket_5254.html @@ -5,7 +5,7 @@ Button Visual Test : Button ticket #5254 - + diff --git a/tests/visual/button/button_ticket_5261.html b/tests/visual/button/button_ticket_5261.html index 0024393ee..7eddc33ae 100644 --- a/tests/visual/button/button_ticket_5261.html +++ b/tests/visual/button/button_ticket_5261.html @@ -5,7 +5,7 @@ Button Visual Test : Button ticket #5261 - + diff --git a/tests/visual/button/button_ticket_5278.html b/tests/visual/button/button_ticket_5278.html index 477a0b398..eed6ebdb0 100644 --- a/tests/visual/button/button_ticket_5278.html +++ b/tests/visual/button/button_ticket_5278.html @@ -5,7 +5,7 @@ Button Visual Test : Button ticket #5278 - + diff --git a/tests/visual/compound/accordion_dialog.html b/tests/visual/compound/accordion_dialog.html index 7b3b227ed..df179ff6a 100644 --- a/tests/visual/compound/accordion_dialog.html +++ b/tests/visual/compound/accordion_dialog.html @@ -5,7 +5,7 @@ Compound Visual Test : Accordion in Dialog - + diff --git a/tests/visual/compound/accordion_tabs.html b/tests/visual/compound/accordion_tabs.html index e98edaf7c..ada8e84a7 100644 --- a/tests/visual/compound/accordion_tabs.html +++ b/tests/visual/compound/accordion_tabs.html @@ -5,7 +5,7 @@ Compound Visual Test : Accordion in Tabs - + diff --git a/tests/visual/compound/datepicker_dialog.html b/tests/visual/compound/datepicker_dialog.html index 0ef3f9bbc..885edb4a6 100644 --- a/tests/visual/compound/datepicker_dialog.html +++ b/tests/visual/compound/datepicker_dialog.html @@ -5,7 +5,7 @@ Compound Visual Test : Datepicker in Dialog - + diff --git a/tests/visual/compound/draggable_accordion.html b/tests/visual/compound/draggable_accordion.html index 396d0e29c..a78221142 100644 --- a/tests/visual/compound/draggable_accordion.html +++ b/tests/visual/compound/draggable_accordion.html @@ -5,7 +5,7 @@ Compound Visual Test : Draggable in Accordion - + diff --git a/tests/visual/compound/draggable_accordion_accordion_tabs_draggable.html b/tests/visual/compound/draggable_accordion_accordion_tabs_draggable.html index a1199c826..cced484ef 100644 --- a/tests/visual/compound/draggable_accordion_accordion_tabs_draggable.html +++ b/tests/visual/compound/draggable_accordion_accordion_tabs_draggable.html @@ -5,7 +5,7 @@ Compound Visual Test : Draggable in Accordion - + diff --git a/tests/visual/compound/sortable_accordion_sortable_tabs.html b/tests/visual/compound/sortable_accordion_sortable_tabs.html index 02a6c0dec..ac90f1a09 100644 --- a/tests/visual/compound/sortable_accordion_sortable_tabs.html +++ b/tests/visual/compound/sortable_accordion_sortable_tabs.html @@ -5,7 +5,7 @@ Compound Visual Test : Accordion in Tabs - + diff --git a/tests/visual/compound/tabs_tabs.html b/tests/visual/compound/tabs_tabs.html index 12515a4c5..a18ef62ce 100644 --- a/tests/visual/compound/tabs_tabs.html +++ b/tests/visual/compound/tabs_tabs.html @@ -5,7 +5,7 @@ Compound Visual Test : Tabs in Tabs - + diff --git a/tests/visual/compound/tabs_tooltips.html b/tests/visual/compound/tabs_tooltips.html index 38b85e58b..ad3822be9 100644 --- a/tests/visual/compound/tabs_tooltips.html +++ b/tests/visual/compound/tabs_tooltips.html @@ -5,7 +5,7 @@ Compound Visual Test : Tabs in Tabs - + diff --git a/tests/visual/compound/widgets_in_dialog.html b/tests/visual/compound/widgets_in_dialog.html index b711efa9c..89ea875d1 100644 --- a/tests/visual/compound/widgets_in_dialog.html +++ b/tests/visual/compound/widgets_in_dialog.html @@ -5,7 +5,7 @@ Compound Visual Test : All Widgets in Dialog - + diff --git a/tests/visual/dialog/dialog_on_page_with_large_dom.html b/tests/visual/dialog/dialog_on_page_with_large_dom.html index bc87aec09..d807b3e3f 100644 --- a/tests/visual/dialog/dialog_on_page_with_large_dom.html +++ b/tests/visual/dialog/dialog_on_page_with_large_dom.html @@ -5,7 +5,7 @@ Dialog Visual Test - Modal Dialog in Large DOM - + diff --git a/tests/visual/effects/effects.all.html b/tests/visual/effects/effects.all.html index ddc665437..acb8dc41a 100644 --- a/tests/visual/effects/effects.all.html +++ b/tests/visual/effects/effects.all.html @@ -4,7 +4,7 @@ jQuery UI Effects Test Suite - + diff --git a/tests/visual/effects/effects.scale.html b/tests/visual/effects/effects.scale.html index 845625e2e..f86c36b6e 100644 --- a/tests/visual/effects/effects.scale.html +++ b/tests/visual/effects/effects.scale.html @@ -4,7 +4,7 @@ jQuery UI Effects Test Suite - + diff --git a/tests/visual/menu/drilldown.html b/tests/visual/menu/drilldown.html index 781f5d88a..8bc30a793 100644 --- a/tests/visual/menu/drilldown.html +++ b/tests/visual/menu/drilldown.html @@ -4,7 +4,7 @@ Menu Visual Test: Default - + diff --git a/tests/visual/menu/menu.html b/tests/visual/menu/menu.html index 16ba6ae45..f88d1d542 100644 --- a/tests/visual/menu/menu.html +++ b/tests/visual/menu/menu.html @@ -4,7 +4,7 @@ Menu Visual Test: Default - + diff --git a/tests/visual/menu/tablemenu.html b/tests/visual/menu/tablemenu.html index bce64bfb5..19691c614 100644 --- a/tests/visual/menu/tablemenu.html +++ b/tests/visual/menu/tablemenu.html @@ -4,7 +4,7 @@ Menu Visual Test: Default - + diff --git a/tests/visual/position/position.html b/tests/visual/position/position.html index 9d29abe28..9a9fb831e 100644 --- a/tests/visual/position/position.html +++ b/tests/visual/position/position.html @@ -5,7 +5,7 @@ Position Visual Test: Default - + diff --git a/tests/visual/position/position_fit.html b/tests/visual/position/position_fit.html index 78751d3ef..9c60b78f6 100644 --- a/tests/visual/position/position_fit.html +++ b/tests/visual/position/position_fit.html @@ -5,7 +5,7 @@ Position Visual Test: Fit - + diff --git a/tests/visual/position/position_flip.html b/tests/visual/position/position_flip.html index 7b26f6a9a..bae3c649b 100644 --- a/tests/visual/position/position_flip.html +++ b/tests/visual/position/position_flip.html @@ -5,7 +5,7 @@ Position Visual Test: Flip - + diff --git a/tests/visual/position/position_flipfit.html b/tests/visual/position/position_flipfit.html index b5cf82946..fcfb75b6b 100644 --- a/tests/visual/position/position_flipfit.html +++ b/tests/visual/position/position_flipfit.html @@ -5,7 +5,7 @@ Position Visual Test: FlipFit - + diff --git a/tests/visual/position/position_margin.html b/tests/visual/position/position_margin.html index 52b800837..71d8f0a3c 100644 --- a/tests/visual/position/position_margin.html +++ b/tests/visual/position/position_margin.html @@ -5,7 +5,7 @@ Position Visual Test: Default - + diff --git a/tests/visual/position/position_within.html b/tests/visual/position/position_within.html index 156c82e5d..7d8813582 100644 --- a/tests/visual/position/position_within.html +++ b/tests/visual/position/position_within.html @@ -7,7 +7,7 @@ - + diff --git a/tests/visual/theme.html b/tests/visual/theme.html index 131cc41d7..fe9146169 100644 --- a/tests/visual/theme.html +++ b/tests/visual/theme.html @@ -4,7 +4,7 @@ jQuery UI Example Page - + diff --git a/tests/visual/tooltip/animations.html b/tests/visual/tooltip/animations.html index 993fbbd85..10235b2f9 100644 --- a/tests/visual/tooltip/animations.html +++ b/tests/visual/tooltip/animations.html @@ -4,7 +4,7 @@ Tooltip Visual Test: Default - + diff --git a/tests/visual/tooltip/callout.html b/tests/visual/tooltip/callout.html index 79d8d32bf..af89157a2 100644 --- a/tests/visual/tooltip/callout.html +++ b/tests/visual/tooltip/callout.html @@ -4,7 +4,7 @@ Tooltip Visual Test: Default - + diff --git a/tests/visual/tooltip/tooltip.html b/tests/visual/tooltip/tooltip.html index eb51d56c6..63c756ce0 100644 --- a/tests/visual/tooltip/tooltip.html +++ b/tests/visual/tooltip/tooltip.html @@ -4,7 +4,7 @@ Tooltip Visual Test: Default - + -- cgit v1.2.3 From c12a47074e83b2495b8ff7113d939722f9cdb7c7 Mon Sep 17 00:00:00 2001 From: Lado Lomidze Date: Thu, 22 Mar 2012 11:10:36 -0400 Subject: Datepicker: Added Georgian localization. Fixes #8205 - Datepicker: Add Georgian localization. --- demos/datepicker/localization.html | 2 ++ demos/index.html | 1 + ui/i18n/jquery.ui.datepicker-ge.js | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 ui/i18n/jquery.ui.datepicker-ge.js diff --git a/demos/datepicker/localization.html b/demos/datepicker/localization.html index dfb8e71f9..ba5efdfc3 100644 --- a/demos/datepicker/localization.html +++ b/demos/datepicker/localization.html @@ -32,6 +32,7 @@ + @@ -122,6 +123,7 @@ + diff --git a/demos/index.html b/demos/index.html index bf37ca734..f96753d37 100644 --- a/demos/index.html +++ b/demos/index.html @@ -66,6 +66,7 @@ + diff --git a/ui/i18n/jquery.ui.datepicker-ge.js b/ui/i18n/jquery.ui.datepicker-ge.js new file mode 100644 index 000000000..10d4e5851 --- /dev/null +++ b/ui/i18n/jquery.ui.datepicker-ge.js @@ -0,0 +1,21 @@ +/* Georgian (UTF-8) initialisation for the jQuery UI date picker plugin. */ +/* Written by Lado Lomidze (lado.lomidze@gmail.com). */ +jQuery(function($){ + $.datepicker.regional['ge'] = { + closeText: 'დახურვა', + prevText: '< წინა', + nextText: 'შემდეგი >', + currentText: 'დღეს', + monthNames: ['იანვარი','თებერვალი','მარტი','აპრილი','მაისი','ივნისი', 'ივლისი','აგვისტო','სექტემბერი','ოქტომბერი','ნოემბერი','დეკემბერი'], + monthNamesShort: ['იან','თებ','მარ','აპრ','მაი','ივნ', 'ივლ','აგვ','სექ','ოქტ','ნოე','დეკ'], + dayNames: ['კვირა','ორშაბათი','სამშაბათი','ოთხშაბათი','ხუთშაბათი','პარასკევი','შაბათი'], + dayNamesShort: ['კვ','ორშ','სამ','ოთხ','ხუთ','პარ','შაბ'], + dayNamesMin: ['კვ','ორშ','სამ','ოთხ','ხუთ','პარ','შაბ'], + weekHeader: 'კვირა', + dateFormat: 'dd-mm-yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: ''}; + $.datepicker.setDefaults($.datepicker.regional['ge']); +}); -- cgit v1.2.3 From 9bb9141f299ce1b7ddcffc39063a9e6581e19ba6 Mon Sep 17 00:00:00 2001 From: stojce Date: Thu, 22 Mar 2012 15:26:47 +0100 Subject: Datepicker: Fixed month name for Macedonian localization. Fixes #8206 - Datepicker: Incorrect month name for Macedonian localization. --- ui/i18n/jquery.ui.datepicker-mk.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/i18n/jquery.ui.datepicker-mk.js b/ui/i18n/jquery.ui.datepicker-mk.js index 1e602427a..028532551 100644 --- a/ui/i18n/jquery.ui.datepicker-mk.js +++ b/ui/i18n/jquery.ui.datepicker-mk.js @@ -6,9 +6,9 @@ jQuery(function($){ prevText: '<', nextText: '>', currentText: 'Денес', - monthNames: ['Јануари','Фебруари','Март','Април','Мај','Јуни', + monthNames: ['Јануари','Февруари','Март','Април','Мај','Јуни', 'Јули','Август','Септември','Октомври','Ноември','Декември'], - monthNamesShort: ['Јан','Феб','Мар','Апр','Мај','Јун', + monthNamesShort: ['Јан','Фев','Мар','Апр','Мај','Јун', 'Јул','Авг','Сеп','Окт','Ное','Дек'], dayNames: ['Недела','Понеделник','Вторник','Среда','Четврток','Петок','Сабота'], dayNamesShort: ['Нед','Пон','Вто','Сре','Чет','Пет','Саб'], -- cgit v1.2.3 From adbc2733bbd4d4c117dd2e0f31d5156e2913bfd1 Mon Sep 17 00:00:00 2001 From: Scott González Date: Thu, 22 Mar 2012 13:17:17 -0400 Subject: Tabs: Wrap attribute value in quotes when querying. Fixes #8207 - Tabs: Error with href selector. --- ui/jquery.ui.tabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index ba48c3770..c9300e69b 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -434,7 +434,7 @@ $.widget( "ui.tabs", { // meta-function to give users option to provide a href string instead of a numerical index. // also sanitizes numerical indexes to valid values. if ( typeof index == "string" ) { - index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) ); + index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); } return index; -- cgit v1.2.3 From 610e7949764462e50be308e2c15745004b4a267c Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 22 Mar 2012 21:28:55 +0100 Subject: Build/grunt: Fix copying of binary files --- grunt.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index bbc358e4b..dfc9c63b5 100644 --- a/grunt.js +++ b/grunt.js @@ -438,6 +438,7 @@ task.registerTask( "download_themes", function() { }); task.registerTask( "copy_themes", function() { + var fs = require( "fs" ); // each package includes the base theme, ignore that var filter = /themes\/base/; var files = file.expand( "dist/tmp/*/development-bundle/themes/**/*" ).filter(function( file ) { @@ -447,7 +448,7 @@ task.registerTask( "copy_themes", function() { var target = "dist/" + template.process( config( "files.themes" ), config() ) + "/"; files.forEach(function( fileName ) { var targetFile = fileName.replace( /dist\/tmp\/\d+\/development-bundle\//, "" ).replace( "jquery-ui-.custom", "jquery-ui" ); - file.copy( fileName, target + targetFile ); + file.write( target + targetFile, fs.readFileSync( fileName ) ); }); // copy minified base theme from regular release -- cgit v1.2.3 From e4f0cab0430811edd2a37dc275409aefd309c014 Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 23 Mar 2012 07:59:36 -0400 Subject: Grunt: Switch back to using file.copy(). --- grunt.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/grunt.js b/grunt.js index dfc9c63b5..409f2684a 100644 --- a/grunt.js +++ b/grunt.js @@ -293,7 +293,11 @@ task.registerMultiTask( "copy", "Copy files to destination folder and replace @V } files.forEach(function( fileName ) { var targetFile = strip ? fileName.replace( strip, "" ) : fileName; - file.copy( fileName, target + targetFile, replaceVersion ); + if ( /png$/.test( fileName ) ) { + file.copy( fileName, target + targetFile ); + } else { + file.copy( fileName, target + targetFile, replaceVersion ); + } }); log.writeln( "Copied " + files.length + " files." ); var renameCount = 0; @@ -438,7 +442,6 @@ task.registerTask( "download_themes", function() { }); task.registerTask( "copy_themes", function() { - var fs = require( "fs" ); // each package includes the base theme, ignore that var filter = /themes\/base/; var files = file.expand( "dist/tmp/*/development-bundle/themes/**/*" ).filter(function( file ) { @@ -448,7 +451,7 @@ task.registerTask( "copy_themes", function() { var target = "dist/" + template.process( config( "files.themes" ), config() ) + "/"; files.forEach(function( fileName ) { var targetFile = fileName.replace( /dist\/tmp\/\d+\/development-bundle\//, "" ).replace( "jquery-ui-.custom", "jquery-ui" ); - file.write( target + targetFile, fs.readFileSync( fileName ) ); + file.copy( fileName, target + targetFile ); }); // copy minified base theme from regular release -- cgit v1.2.3 From b2cca9ad19b55eed3574b493df2a30c5cd1965e7 Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 23 Mar 2012 13:33:46 -0400 Subject: Grunt: Update for new grunt API. --- grunt.js | 162 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 83 insertions(+), 79 deletions(-) diff --git a/grunt.js b/grunt.js index 409f2684a..476fc8516 100644 --- a/grunt.js +++ b/grunt.js @@ -1,3 +1,5 @@ +module.exports = function( grunt ) { + function stripBanner( files ) { return files.map(function( file ) { return ""; @@ -12,24 +14,24 @@ function createBanner( files ) { // strip folders var fileNames = files && files.map( stripDirectory ); return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " + - "<%= template.today('isoDate') %>\n" + + "<%= grunt.template.today('isoDate') %>\n" + "<%= pkg.homepage ? '* ' + pkg.homepage + '\n' : '' %>" + - "* Includes: " + (files ? fileNames.join(", ") : "<%= stripDirectory(task.current.file.src[1]) %>") + "\n" + - "* Copyright (c) <%= template.today('yyyy') %> <%= pkg.author.name %>;" + + "* Includes: " + (files ? fileNames.join(", ") : "<%= stripDirectory(grunt.task.current.file.src[1]) %>") + "\n" + + "* Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" + " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */"; } // allow access from banner template global.stripDirectory = stripDirectory; -task.registerHelper( "strip_all_banners", function( filepath ) { - return file.read( filepath ).replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" ); +grunt.registerHelper( "strip_all_banners", function( filepath ) { + return grunt.file.read( filepath ).replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" ); }); var inspect = require( "util" ).inspect; var coreFiles = "jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js".split( ", " ); var uiFiles = coreFiles.map(function( file ) { return "ui/" + file; -}).concat( file.expand( "ui/*.js" ).filter(function( file ) { +}).concat( grunt.file.expandFiles( "ui/*.js" ).filter(function( file ) { return coreFiles.indexOf( file.substring(3) ) === -1; })); @@ -42,7 +44,7 @@ function minFile( file ) { } uiFiles.forEach( minFile ); -var allI18nFiles = file.expand( "ui/i18n/*.js" ); +var allI18nFiles = grunt.file.expandFiles( "ui/i18n/*.js" ); allI18nFiles.forEach( minFile ); var cssFiles = "core accordion autocomplete button datepicker dialog menu progressbar resizable selectable slider spinner tabs tooltip theme".split( " " ).map(function( component ) { @@ -55,7 +57,7 @@ cssFiles.forEach(function( file ) { minifyCSS[ "dist/" + file.replace( /\.css$/, ".min.css" ).replace( /themes\/base\//, "themes/base/minified/" ) ] = [ "", file ]; }); -config.init({ +grunt.initConfig({ pkg: "", files: { dist: "<%= pkg.name %>-<%= pkg.version %>", @@ -213,7 +215,7 @@ config.init({ } }, qunit: { - files: file.expand( "tests/unit/**/*.html" ).filter(function( file ) { + files: grunt.file.expandFiles( "tests/unit/**/*.html" ).filter(function( file ) { // disabling everything that doesn't (quite) work with PhantomJS for now // except for all|index|test, try to include more as we go return !( /(all|index|test|draggable|droppable|selectable|resizable|sortable|dialog|slider|datepicker|tabs|tabs_deprecated)\.html/ ).test( file ); @@ -281,58 +283,58 @@ config.init({ } }); -task.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() { +grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() { function replaceVersion( source ) { - return source.replace( "@VERSION", config( "pkg.version" ) ); + return source.replace( "@VERSION", grunt.config( "pkg.version" ) ); } - var files = file.expand( this.file.src ); + var files = grunt.file.expandFiles( this.file.src ); var target = this.file.dest + "/"; var strip = this.data.strip; if ( typeof strip === "string" ) { - strip = new RegExp( "^" + template.process( strip, config() ).replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ) ); + strip = new RegExp( "^" + grunt.template.process( strip, grunt.config() ).replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ) ); } files.forEach(function( fileName ) { var targetFile = strip ? fileName.replace( strip, "" ) : fileName; if ( /png$/.test( fileName ) ) { - file.copy( fileName, target + targetFile ); + grunt.file.copy( fileName, target + targetFile ); } else { - file.copy( fileName, target + targetFile, replaceVersion ); + grunt.file.copy( fileName, target + targetFile, replaceVersion ); } }); - log.writeln( "Copied " + files.length + " files." ); + grunt.log.writeln( "Copied " + files.length + " files." ); var renameCount = 0; for ( var fileName in this.data.renames ) { renameCount += 1; - file.copy( fileName, target + template.process( this.data.renames[ fileName ], config() ) ); + grunt.file.copy( fileName, target + grunt.template.process( this.data.renames[ fileName ], grunt.config() ) ); } if ( renameCount ) { - log.writeln( "Renamed " + renameCount + " files." ); + grunt.log.writeln( "Renamed " + renameCount + " files." ); } }); -task.registerMultiTask( "zip", "Create a zip file for release", function() { +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 = file.expand( "dist/" + this.file.src + "/**/*" ); - // log.writeln( "Creating zip file " + this.file.dest ); + // var files = grunt.file.expandFiles( "dist/" + this.file.src + "/**/*" ); + // grunt.log.writeln( "Creating zip file " + this.file.dest ); // var fs = require( "fs" ); // var AdmZip = require( "adm-zip" ); // var zip = new AdmZip(); // files.forEach(function( file ) { - // log.verbose.writeln( "Zipping " + 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 ); - // log.writeln( "Wrote " + files.length + " files to " + this.file.dest ); + // grunt.log.writeln( "Wrote " + files.length + " files to " + this.file.dest ); var done = this.async(); var dest = this.file.dest; - var src = template.process( this.file.src, config() ); - utils.spawn({ + var src = grunt.template.process( this.file.src, grunt.config() ); + grunt.utils.spawn({ cmd: "zip", args: [ "-r", dest, src ], opts: { @@ -340,18 +342,18 @@ task.registerMultiTask( "zip", "Create a zip file for release", function() { } }, function( err, result ) { if ( err ) { - log.error( err ); + grunt.log.error( err ); done(); return; } - log.writeln( "Zipped " + dest ); + grunt.log.writeln( "Zipped " + dest ); done(); }); }); -task.registerMultiTask( "csslint", "Lint CSS files with csslint", function() { +grunt.registerMultiTask( "csslint", "Lint CSS files with csslint", function() { var csslint = require( "csslint" ).CSSLint; - var files = file.expand( this.file.src ); + var files = grunt.file.expandFiles( this.file.src ); var ruleset = {}; csslint.getRules().forEach(function( rule ) { ruleset[ rule.id ] = 1; @@ -365,10 +367,10 @@ task.registerMultiTask( "csslint", "Lint CSS files with csslint", function() { } var hadErrors = 0; files.forEach(function( filepath ) { - log.writeln( "Linting " + filepath ); - var result = csslint.verify( file.read( filepath ), ruleset ); + grunt.log.writeln( "Linting " + filepath ); + var result = csslint.verify( grunt.file.read( filepath ), ruleset ); result.messages.forEach(function( message ) { - log.writeln( "[".red + ( "L" + message.line ).yellow + ":".red + ( "C" + message.col ).yellow + "]".red ); + grunt.log.writeln( "[".red + ( "L" + message.line ).yellow + ":".red + ( "C" + message.col ).yellow + "]".red ); log[ message.type === "error" ? "error" : "writeln" ]( message.message + " " + message.rule.desc + " (" + message.rule.id + ")" ); }); if ( result.messages.length ) { @@ -378,18 +380,18 @@ task.registerMultiTask( "csslint", "Lint CSS files with csslint", function() { if (hadErrors) { return false; } - log.writeln( "Lint free" ); + grunt.log.writeln( "Lint free" ); }); -task.registerMultiTask( "css_min", "Minify CSS files with Sqwish.", function() { - var max = task.helper( "concat", file.expand( this.file.src ) ); +grunt.registerMultiTask( "css_min", "Minify CSS files with Sqwish.", function() { + var max = grunt.helper( "concat", grunt.file.expandFiles( this.file.src ) ); var min = require( "sqwish" ).minify( max, false ); - file.write( this.file.dest, min ); - log.writeln( "File '" + this.file.dest + "' created." ); - task.helper( "min_max_info", min, max ); + grunt.file.write( this.file.dest, min ); + grunt.log.writeln( "File '" + this.file.dest + "' created." ); + grunt.helper( "min_max_info", min, max ); }); -task.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", 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 ( require( "path" ).existsSync( this.file.dest ) ) { require( "fs" ).unlinkSync( this.file.dest ); @@ -397,39 +399,39 @@ task.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", func var crypto = require( "crypto" ); var dir = this.file.src + "/"; var hashes = []; - file.expand( dir + "**/*" ).forEach(function( fileName ) { + grunt.file.expandFiles( dir + "**/*" ).forEach(function( fileName ) { var hash = crypto.createHash( "md5" ); - hash.update( file.read( fileName, "ascii" ) ); + hash.update( grunt.file.read( fileName, "ascii" ) ); hashes.push( fileName.replace( dir, "" ) + " " + hash.digest( "hex" ) ); }); - file.write( this.file.dest, hashes.join( "\n" ) + "\n" ); - log.writeln( "Wrote " + this.file.dest + " with " + hashes.length + " hashes" ); + grunt.file.write( this.file.dest, hashes.join( "\n" ) + "\n" ); + grunt.log.writeln( "Wrote " + this.file.dest + " with " + hashes.length + " hashes" ); }); -task.registerTask( "download_themes", function() { +grunt.registerTask( "download_themes", function() { // var AdmZip = require('adm-zip'); var fs = require( "fs" ); var request = require( "request" ); var done = this.async(); - var themes = file.read( "build/themes" ).split(","); + var themes = grunt.file.read( "build/themes" ).split(","); var requests = 0; - file.mkdir( "dist/tmp" ); + grunt.file.mkdir( "dist/tmp" ); themes.forEach(function( theme, index ) { requests += 1; - file.mkdir( "dist/tmp/" + index ); + grunt.file.mkdir( "dist/tmp/" + index ); var zipFileName = "dist/tmp/" + index + ".zip"; var out = fs.createWriteStream( zipFileName ); out.on( "close", function() { - log.writeln( "done downloading " + zipFileName ); + grunt.log.writeln( "done downloading " + zipFileName ); // TODO AdmZip produces "crc32 checksum failed", need to figure out why // var zip = new AdmZip(zipFileName); // zip.extractAllTo('dist/tmp/' + index + '/'); // until then, using cli unzip... - utils.spawn({ + grunt.utils.spawn({ cmd: "unzip", args: [ "-d", "dist/tmp/" + index, zipFileName ] }, function( err, result ) { - log.writeln( "Unzipped " + zipFileName + ", deleting it now" ); + grunt.log.writeln( "Unzipped " + zipFileName + ", deleting it now" ); fs.unlinkSync( zipFileName ); requests -= 1; if (requests === 0) { @@ -441,62 +443,62 @@ task.registerTask( "download_themes", function() { }); }); -task.registerTask( "copy_themes", function() { +grunt.registerTask( "copy_themes", function() { // each package includes the base theme, ignore that var filter = /themes\/base/; - var files = file.expand( "dist/tmp/*/development-bundle/themes/**/*" ).filter(function( file ) { + var files = grunt.file.expandFiles( "dist/tmp/*/development-bundle/themes/**/*" ).filter(function( file ) { return !filter.test( file ); }); - // TODO the template.process call shouldn't be necessary - var target = "dist/" + template.process( config( "files.themes" ), config() ) + "/"; + // TODO the grunt.template.process call shouldn't be necessary + var target = "dist/" + grunt.template.process( grunt.config( "files.themes" ), grunt.config() ) + "/"; files.forEach(function( fileName ) { var targetFile = fileName.replace( /dist\/tmp\/\d+\/development-bundle\//, "" ).replace( "jquery-ui-.custom", "jquery-ui" ); - file.copy( fileName, target + targetFile ); + grunt.file.copy( fileName, target + targetFile ); }); // copy minified base theme from regular release // TODO same as the one above - var distFolder = "dist/" + template.process( config( "files.dist" ), config() ); - files = file.expand( distFolder + "/themes/base/**/*" ); + var distFolder = "dist/" + grunt.template.process( grunt.config( "files.dist" ), grunt.config() ); + files = grunt.file.expandFiles( distFolder + "/themes/base/**/*" ); files.forEach(function( fileName ) { - file.copy( fileName, target + fileName.replace( distFolder, "" ) ); + grunt.file.copy( fileName, target + fileName.replace( distFolder, "" ) ); }); }); -task.registerTask( "clean", function() { +grunt.registerTask( "clean", function() { require( "rimraf" ).sync( "dist" ); }); // TODO merge with code in jQuery Core, share as grunt plugin/npm // this here actually uses the provided filenames in the output // the helpers should just be regular functions, no need to share those with the world -task.registerMultiTask( "compare_size", "Compare size of this branch to master", function() { - var files = file.expand( this.file.src ), +grunt.registerMultiTask( "compare_size", "Compare size of this branch to master", function() { + var files = grunt.file.expandFiles( this.file.src ), done = this.async(), sizecache = __dirname + "/dist/.sizecache.json", sources = { - min: file.read( files[1] ), - max: file.read( files[0] ) + min: grunt.file.read( files[1] ), + max: grunt.file.read( files[0] ) }, oldsizes = {}, sizes = {}; try { - oldsizes = JSON.parse( file.read( sizecache ) ); + oldsizes = JSON.parse( grunt.file.read( sizecache ) ); } catch( e ) { oldsizes = {}; } // Obtain the current branch and continue... - task.helper( "git_current_branch", function( err, branch ) { + grunt.helper( "git_current_branch", function( err, branch ) { var key, diff; // Derived and adapted from Corey Frang's original `sizer` - log.writeln( "sizes - compared to master" ); + grunt.log.writeln( "sizes - compared to master" ); sizes[ files[0] ] = sources.max.length; sizes[ files[1] ] = sources.min.length; - sizes[ files[1] + ".gz" ] = task.helper( "gzip", sources.min ).length; + sizes[ files[1] + ".gz" ] = grunt.helper( "gzip", sources.min ).length; for ( key in sizes ) { diff = oldsizes[ key ] && ( sizes[ key ] - oldsizes[ key ] ); @@ -504,8 +506,8 @@ task.registerMultiTask( "compare_size", "Compare size of this branch to master", diff = "+" + diff; } console.log( "%s %s %s", - task.helper("lpad", sizes[ key ], 8 ), - task.helper("lpad", diff ? "(" + diff + ")" : "(-)", 8 ), + grunt.helper("lpad", sizes[ key ], 8 ), + grunt.helper("lpad", diff ? "(" + diff + ")" : "(-)", 8 ), key ); } @@ -514,13 +516,13 @@ task.registerMultiTask( "compare_size", "Compare size of this branch to master", // If master, write to file - this makes it easier to compare // the size of your current code state to the master branch, // without returning to the master to reset the cache - file.write( sizecache, JSON.stringify(sizes) ); + grunt.file.write( sizecache, JSON.stringify(sizes) ); } done(); }); }); -task.registerHelper( "git_current_branch", function( done ) { - utils.spawn({ +grunt.registerHelper( "git_current_branch", function( done ) { + grunt.utils.spawn({ cmd: "git", args: [ "branch", "--no-color" ] }, function( err, result ) { @@ -534,13 +536,15 @@ task.registerHelper( "git_current_branch", function( done ) { }); }); }); -task.registerHelper( "lpad", function( str, len, chr ) { +grunt.registerHelper( "lpad", function( str, len, chr ) { return ( Array( len + 1 ).join( chr || " " ) + str ).substr( -len ); }); -task.registerTask( "default", "lint csslint qunit build compare_size" ); -task.registerTask( "sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" ); -task.registerTask( "build", "concat min css_min" ); -task.registerTask( "release", "clean build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" ); -task.registerTask( "release_themes", "release download_themes copy_themes copy:themes md5:themes zip:themes" ); -task.registerTask( "release_cdn", "release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn" ); +grunt.registerTask( "default", "lint csslint qunit build compare_size" ); +grunt.registerTask( "sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" ); +grunt.registerTask( "build", "concat min css_min" ); +grunt.registerTask( "release", "clean build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" ); +grunt.registerTask( "release_themes", "release download_themes copy_themes copy:themes md5:themes zip:themes" ); +grunt.registerTask( "release_cdn", "release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn" ); + +}; -- cgit v1.2.3 From 0370170b2f97146b32f19b3c693c011d4efe99e3 Mon Sep 17 00:00:00 2001 From: Hans Hillen Date: Tue, 27 Mar 2012 10:19:35 -0400 Subject: Accordion: Fixed ARIA support and added proper keyboard support. --- tests/unit/accordion/accordion_core.js | 56 ++++++++++++++------ ui/jquery.ui.accordion.js | 96 +++++++++++++++++++++++++++------- 2 files changed, 119 insertions(+), 33 deletions(-) diff --git a/tests/unit/accordion/accordion_core.js b/tests/unit/accordion/accordion_core.js index de1b66046..0d756c97c 100644 --- a/tests/unit/accordion/accordion_core.js +++ b/tests/unit/accordion/accordion_core.js @@ -25,24 +25,50 @@ test( "handle click on header-descendant", function() { }); test( "accessibility", function () { - expect( 13 ); - var element = $( "#list1" ).accordion().accordion( "option", "active", 1 ); + expect( 37 ); + var element = $( "#list1" ).accordion({ + active: 1 + }); var headers = element.find( ".ui-accordion-header" ); - equal( headers.eq( 1 ).attr( "tabindex" ), 0, "active header should have tabindex=0" ); - equal( headers.eq( 0 ).attr( "tabindex" ), -1, "inactive header should have tabindex=-1" ); - equal( element.attr( "role" ), "tablist", "main role" ); - equal( headers.attr( "role" ), "tab", "tab roles" ); - equal( headers.next().attr( "role" ), "tabpanel", "tabpanel roles" ); - equal( headers.eq( 1 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded" ); - equal( headers.eq( 0 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded" ); - equal( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected" ); - equal( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" ); + equal( element.attr( "role" ), "tablist", "element role" ); + headers.each(function( i ) { + var header = headers.eq( i ), + panel = header.next(); + equal( header.attr( "role" ), "tab", "header " + i + " role" ); + equal( header.attr( "aria-controls" ), panel.attr( "id" ), "header " + i + " aria-controls" ); + equal( panel.attr( "role" ), "tabpanel", "panel " + i + " role" ); + equal( panel.attr( "aria-labelledby" ), header.attr( "id" ), "panel " + i + " aria-labelledby" ); + }); + + equal( headers.eq( 1 ).attr( "tabindex" ), 0, "active header has tabindex=0" ); + equal( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" ); + equal( headers.eq( 1 ).next().attr( "aria-expanded" ), "true", "active tabpanel has aria-expanded=true" ); + equal( headers.eq( 1 ).next().attr( "aria-hidden" ), "false", "active tabpanel has aria-hidden=false" ); + equal( headers.eq( 0 ).attr( "tabindex" ), -1, "active header has tabindex=-1" ); + equal( headers.eq( 0 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" ); + equal( headers.eq( 0 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" ); + equal( headers.eq( 0 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" ); + equal( headers.eq( 2 ).attr( "tabindex" ), -1, "active header has tabindex=-1" ); + equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" ); + equal( headers.eq( 2 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" ); + equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" ); + element.accordion( "option", "active", 0 ); - equal( headers.eq( 0 ).attr( "aria-expanded" ), "true", "newly active tab has aria-expanded" ); - equal( headers.eq( 1 ).attr( "aria-expanded" ), "false", "newly inactive tab has aria-expanded" ); - equal( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected" ); - equal( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" ); + equal( headers.eq( 0 ).attr( "tabindex" ), 0, "active header has tabindex=0" ); + equal( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" ); + equal( headers.eq( 0 ).next().attr( "aria-expanded" ), "true", "active tabpanel has aria-expanded=true" ); + equal( headers.eq( 0 ).next().attr( "aria-hidden" ), "false", "active tabpanel has aria-hidden=false" ); + equal( headers.eq( 1 ).attr( "tabindex" ), -1, "active header has tabindex=-1" ); + equal( headers.eq( 1 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" ); + equal( headers.eq( 1 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" ); + equal( headers.eq( 1 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" ); + equal( headers.eq( 2 ).attr( "tabindex" ), -1, "active header has tabindex=-1" ); + equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" ); + equal( headers.eq( 2 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" ); + equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" ); }); +// TODO: keyboard support + }( jQuery ) ); diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 2200732ac..2e68889ef 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -12,6 +12,7 @@ * jquery.ui.widget.js */ (function( $, undefined ) { + var uid = 0; $.widget( "ui.accordion", { version: "@VERSION", @@ -33,7 +34,9 @@ $.widget( "ui.accordion", { }, _create: function() { - var options = this.options; + var accordionId = this.accordionId = "ui-accordion-" + + (this.element.attr( "id" ) || ++uid), + options = this.options; this.prevShow = this.prevHide = $(); this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ); @@ -68,18 +71,36 @@ $.widget( "ui.accordion", { this.headers .attr( "role", "tab" ) + .each(function( i ) { + var header = $( this ), + headerId = header.attr( "id" ), + panel = header.next(), + panelId = panel.attr( "id" ); + if ( !headerId ) { + headerId = accordionId + "-header-" + i; + header.attr( "id", headerId ); + } + if ( !panelId ) { + panelId = accordionId + "-panel-" + i; + panel.attr( "id", panelId ); + } + header.attr( "aria-controls", panelId ); + panel.attr( "aria-labelledby", headerId ); + }) .next() .attr( "role", "tabpanel" ); this.headers .not( this.active ) .attr({ - // TODO: document support for each of these - "aria-expanded": "false", "aria-selected": "false", tabIndex: -1 }) .next() + .attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }) .hide(); // make sure at least one header is in the tab order @@ -87,10 +108,14 @@ $.widget( "ui.accordion", { this.headers.eq( 0 ).attr( "tabIndex", 0 ); } else { this.active.attr({ - "aria-expanded": "true", "aria-selected": "true", tabIndex: 0 - }); + }) + .next() + .attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }); } this._setupEvents( options.event ); @@ -124,6 +149,8 @@ $.widget( "ui.accordion", { }, _destroy: function() { + var accordionId = this.accordionId; + // clean up main element this.element .removeClass( "ui-accordion ui-widget ui-helper-reset" ) @@ -131,19 +158,31 @@ $.widget( "ui.accordion", { // clean up headers this.headers - .unbind( ".accordion" ) .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) .removeAttr( "role" ) - .removeAttr( "aria-expanded" ) .removeAttr( "aria-selected" ) - .removeAttr( "tabIndex" ); + .removeAttr( "aria-controls" ) + .removeAttr( "tabIndex" ) + .each(function() { + if ( /^ui-accordion/.test( this.id ) ) { + this.removeAttribute( "id" ); + } + }); this._destroyIcons(); // clean up content panels var contents = this.headers.next() .css( "display", "" ) .removeAttr( "role" ) - .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" ); + .removeAttr( "aria-expanded" ) + .removeAttr( "aria-hidden" ) + .removeAttr( "aria-labelledby" ) + .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" ) + .each(function() { + if ( /^ui-accordion/.test( this.id ) ) { + this.removeAttribute( "id" ); + } + }); if ( this.options.heightStyle !== "content" ) { this.element.css( "height", this.originalHeight ); contents.css( "height", "" ); @@ -208,6 +247,13 @@ $.widget( "ui.accordion", { case keyCode.SPACE: case keyCode.ENTER: this._eventHandler( event ); + break; + case keyCode.HOME: + toFocus = this.headers[ 0 ]; + break; + case keyCode.END: + toFocus = this.headers[ length - 1 ]; + break; } if ( toFocus ) { @@ -218,6 +264,12 @@ $.widget( "ui.accordion", { } }, + _panelKeyDown : function( event ) { + if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { + $( event.currentTarget ).prev().focus(); + } + }, + refresh: function() { var heightStyle = this.options.heightStyle, parent = this.element.parent(), @@ -305,6 +357,9 @@ $.widget( "ui.accordion", { }); } this._bind( this.headers, events ); + this._bind( this.headers.next(), { + keydown: "_panelKeyDown" + }); }, _eventHandler: function( event ) { @@ -382,21 +437,26 @@ $.widget( "ui.accordion", { this._toggleComplete( data ); } - // TODO assert that the blur and focus triggers are really necessary, remove otherwise - toHide.prev() + toHide .attr({ "aria-expanded": "false", - "aria-selected": "false", - tabIndex: -1 + "aria-hidden": "true" }) - .blur(); - toShow.prev() + .prev() + .attr({ + "aria-selected": "false", + tabIndex: -1 + }); + toShow .attr({ "aria-expanded": "true", - "aria-selected": "true", - tabIndex: 0 + "aria-hidden": "false" }) - .focus(); + .prev() + .attr({ + "aria-selected": "true", + tabIndex: 0 + }); }, _animate: function( toShow, toHide, data ) { -- cgit v1.2.3 From a709943a8b6ce83ae258e1532c2dfc6a39d27fc2 Mon Sep 17 00:00:00 2001 From: Scott González Date: Tue, 27 Mar 2012 14:46:13 -0400 Subject: Datepicker tests: Use $.ui.keyCode instead of $.simulate.VK_*. --- tests/unit/datepicker/datepicker_core.js | 96 ++++++++++++++--------------- tests/unit/datepicker/datepicker_events.js | 36 +++++------ tests/unit/datepicker/datepicker_options.js | 94 ++++++++++++++-------------- 3 files changed, 113 insertions(+), 113 deletions(-) diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js index b674c708a..bbc447ffe 100644 --- a/tests/unit/datepicker/datepicker_core.js +++ b/tests/unit/datepicker/datepicker_core.js @@ -235,132 +235,132 @@ test('keystrokes', function() { var inp = init('#inp'); var date = new Date(); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke enter - preset'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+home'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END}); ok(inp.datepicker('getDate') == null, 'Keystroke ctrl+end'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); ok(inp.datepicker('getDate') == null, 'Keystroke esc'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke esc - preset'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke esc - abandoned'); // Moving by day or week inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_LEFT}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 1); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+left'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_LEFT}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.LEFT}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 1); equalsDate(inp.datepicker('getDate'), date, 'Keystroke left'); inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_RIGHT}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 1); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+right'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_RIGHT}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.RIGHT}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 1); equalsDate(inp.datepicker('getDate'), date, 'Keystroke right'); inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_UP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 7); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+up'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_UP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 7); equalsDate(inp.datepicker('getDate'), date, 'Keystroke up'); inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 7); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+down'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_DOWN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 7); equalsDate(inp.datepicker('getDate'), date, 'Keystroke down'); // Moving by month or year inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 4), 'Keystroke pgup'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 4), 'Keystroke pgdn'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 4), 'Keystroke ctrl+pgup'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 4), 'Keystroke ctrl+pgdn'); // Check for moving to short months inp.val('03/31/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29), 'Keystroke pgup - Feb'); inp.val('01/30/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29), 'Keystroke pgdn - Feb'); inp.val('02/29/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 28), 'Keystroke ctrl+pgup - Feb'); inp.val('02/29/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 28), 'Keystroke ctrl+pgdn - Feb'); // Goto current inp.datepicker('option', {gotoCurrent: true}). datepicker('hide').val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke ctrl+home'); // Change steps inp.datepicker('option', {stepMonths: 2, gotoCurrent: false}). datepicker('hide').val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2007, 12 - 1, 4), 'Keystroke pgup step 2'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 4 - 1, 4), 'Keystroke pgdn step 2'); }); diff --git a/tests/unit/datepicker/datepicker_events.js b/tests/unit/datepicker/datepicker_events.js index fc312216f..9876b7e60 100644 --- a/tests/unit/datepicker/datepicker_events.js +++ b/tests/unit/datepicker/datepicker_events.js @@ -26,24 +26,24 @@ test('events', function() { var date = new Date(); // onSelect inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(selectedThis, inp[0], 'Callback selected this'); equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst'); equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date'); inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 7); equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - ctrl+down'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - esc'); var dateStr = '02/04/2008'; inp.val(dateStr).datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(dateStr, selectedDate, 'onSelect is called after enter keydown'); // onChangeMonthYear @@ -54,25 +54,25 @@ test('events', function() { }; date = new Date(); date.setDate(1); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGUP}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}); date.setMonth(date.getMonth() - 1); equal(selectedThis, inp[0], 'Callback change month/year this'); equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst'); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - pgup'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}); date.setMonth(date.getMonth() + 1); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - pgdn'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}); date.setFullYear(date.getFullYear() - 1); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+pgup'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}); date.setFullYear(date.getFullYear() + 1); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+home'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}); date.setFullYear(date.getFullYear() + 1); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+pgdn'); @@ -84,38 +84,38 @@ test('events', function() { // onChangeMonthYear step by 2 inp.datepicker('option', {stepMonths: 2}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGUP}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}); date.setMonth(date.getMonth() - 14); equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - pgup'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}); date.setMonth(date.getMonth() - 12); equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - ctrl+pgup'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}); date.setMonth(date.getMonth() + 2); equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - pgdn'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}); date.setMonth(date.getMonth() + 12); equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - ctrl+pgdn'); // onClose inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}). val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equal(selectedThis, inp[0], 'Callback close this'); equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst'); equal(selectedDate, '', 'Callback close date - esc'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()), 'Callback close date - enter'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equal(selectedDate, '02/04/2008', 'Callback close date - preset'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END}); equal(selectedDate, '', 'Callback close date - ctrl+end'); var inp2 = init('#inp2'); diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index bab6ed45a..f538c6d03 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -77,7 +77,7 @@ test('invocation', function() { ok(image.length == 0, 'Focus - image absent'); inp.focus(); ok(dp.is(':visible'), 'Focus - rendered on focus'); - inp.simulate('keydown', {keyCode: $.simulate.VK_ESC}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); ok(!dp.is(':visible'), 'Focus - hidden on exit'); inp.focus(); ok(dp.is(':visible'), 'Focus - rendered on focus'); @@ -161,93 +161,93 @@ test('defaultDate', function() { var inp = init('#inp'); var date = new Date(); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Default date null'); // Numeric values inp.datepicker('option', {defaultDate: -2}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 2); equalsDate(inp.datepicker('getDate'), date, 'Default date -2'); inp.datepicker('option', {defaultDate: 3}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 5); equalsDate(inp.datepicker('getDate'), date, 'Default date 3'); inp.datepicker('option', {defaultDate: 1 / 0}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 3); equalsDate(inp.datepicker('getDate'), date, 'Default date Infinity'); inp.datepicker('option', {defaultDate: 1 / 'a'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Default date NaN'); // String offset values inp.datepicker('option', {defaultDate: '-1d'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 1); equalsDate(inp.datepicker('getDate'), date, 'Default date -1d'); inp.datepicker('option', {defaultDate: '+3D'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 4); equalsDate(inp.datepicker('getDate'), date, 'Default date +3D'); inp.datepicker('option', {defaultDate: ' -2 w '}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = new Date(); date.setDate(date.getDate() - 14); equalsDate(inp.datepicker('getDate'), date, 'Default date -2 w'); inp.datepicker('option', {defaultDate: '+1 W'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 21); equalsDate(inp.datepicker('getDate'), date, 'Default date +1 W'); inp.datepicker('option', {defaultDate: ' -1 m '}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = addMonths(new Date(), -1); equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m'); inp.datepicker('option', {defaultDate: '+2M'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = addMonths(new Date(), 2); equalsDate(inp.datepicker('getDate'), date, 'Default date +2M'); inp.datepicker('option', {defaultDate: '-2y'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = new Date(); date.setFullYear(date.getFullYear() - 2); equalsDate(inp.datepicker('getDate'), date, 'Default date -2y'); inp.datepicker('option', {defaultDate: '+1 Y '}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setFullYear(date.getFullYear() + 3); equalsDate(inp.datepicker('getDate'), date, 'Default date +1 Y'); inp.datepicker('option', {defaultDate: '+1M +10d'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = addMonths(new Date(), 1); date.setDate(date.getDate() + 10); equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d'); // String date values inp.datepicker('option', {defaultDate: '07/04/2007'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = new Date(2007, 7 - 1, 4); equalsDate(inp.datepicker('getDate'), date, 'Default date 07/04/2007'); inp.datepicker('option', {dateFormat: 'yy-mm-dd', defaultDate: '2007-04-02'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = new Date(2007, 4 - 1, 2); equalsDate(inp.datepicker('getDate'), date, 'Default date 2007-04-02'); // Date value date = new Date(2007, 1 - 1, 26); inp.datepicker('option', {dateFormat: 'mm/dd/yy', defaultDate: date}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Default date 01/26/2007'); }); @@ -293,7 +293,7 @@ test('miscellaneous', function() { longNames[date.getMonth()], 'Navigation current - as date format'); equal(dp.find('.ui-datepicker-next').text(), shortNames[2] + ' >', 'Navigation next - as date format'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}); equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[1], 'Navigation prev - as date format + pgdn'); equal(dp.find('.ui-datepicker-current').text(), @@ -317,46 +317,46 @@ test('minMax', function() { var minDate = new Date(2008, 2 - 1, 29); var maxDate = new Date(2008, 12 - 1, 7); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), lastYear, 'Min/max - null, null - ctrl+pgup'); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), nextYear, 'Min/max - null, null - ctrl+pgdn'); inp.datepicker('option', {minDate: minDate}). datepicker('hide').val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), minDate, 'Min/max - 02/29/2008, null - ctrl+pgup'); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), nextYear, 'Min/max - 02/29/2008, null - ctrl+pgdn'); inp.datepicker('option', {maxDate: maxDate}). datepicker('hide').val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), minDate, 'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgup'); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), maxDate, 'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgdn'); inp.datepicker('option', {minDate: null}). datepicker('hide').val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), lastYear, 'Min/max - null, 12/07/2008 - ctrl+pgup'); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), maxDate, 'Min/max - null, 12/07/2008 - ctrl+pgdn'); // Relative dates @@ -364,15 +364,15 @@ test('minMax', function() { date.setDate(date.getDate() - 7); inp.datepicker('option', {minDate: '-1w', maxDate: '+1 M +10 D '}). datepicker('hide').val('').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Min/max - -1w, +1 M +10 D - ctrl+pgup'); date = addMonths(new Date(), 1); date.setDate(date.getDate() + 10); inp.val('').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Min/max - -1w, +1 M +10 D - ctrl+pgdn'); // With existing date @@ -477,34 +477,34 @@ test('altField', function() { // No alternate field set alt.val(''); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(inp.val(), '06/04/2008', 'Alt field - dp - enter'); equal(alt.val(), '', 'Alt field - alt not set'); // Alternate field set alt.val(''); inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}). val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(inp.val(), '06/04/2008', 'Alt field - dp - enter'); equal(alt.val(), '2008-06-04', 'Alt field - alt - enter'); // Move from initial date alt.val(''); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(inp.val(), '07/04/2008', 'Alt field - dp - pgdn'); equal(alt.val(), '2008-07-04', 'Alt field - alt - pgdn'); // Alternate field set - closed alt.val(''); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equal(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc'); equal(alt.val(), '', 'Alt field - alt - pgdn/esc'); // Clear date and alternate alt.val(''); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END}); equal(inp.val(), '', 'Alt field - dp - ctrl+end'); equal(alt.val(), '', 'Alt field - alt - ctrl+end'); @@ -725,7 +725,7 @@ test('localisation', function() { 'Localisation - day ' + day); day = (day + 1) % 7; }); - inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); var date = new Date(); equal(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' + date.getDate() + ' ' + $.datepicker.regional['fr'].monthNames[date.getMonth()] + -- cgit v1.2.3 From 6634e4005368ded31dce50de7095ed0f8835637c Mon Sep 17 00:00:00 2001 From: Scott González Date: Tue, 27 Mar 2012 16:49:05 -0400 Subject: Accordion: Fixed post-init changes to event option and added tests for keyboard support. --- tests/unit/accordion/accordion.html | 2 +- tests/unit/accordion/accordion_core.js | 42 +++++++++++++++++++++++++- tests/unit/accordion/accordion_deprecated.html | 2 +- ui/jquery.ui.accordion.js | 21 ++++++------- 4 files changed, 53 insertions(+), 14 deletions(-) diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index 109b3094e..5c9169ea3 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -66,7 +66,7 @@

your bear, you have to admit it!
- No, we aren't selling bears. + No, we aren't selling bears.

We could talk about renting one. diff --git a/tests/unit/accordion/accordion_core.js b/tests/unit/accordion/accordion_core.js index 0d756c97c..92d79c121 100644 --- a/tests/unit/accordion/accordion_core.js +++ b/tests/unit/accordion/accordion_core.js @@ -69,6 +69,46 @@ test( "accessibility", function () { equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" ); }); -// TODO: keyboard support +asyncTest( "keybaord support", function() { + expect( 13 ); + var element = $( "#list1" ).accordion(), + headers = element.find( ".ui-accordion-header" ), + anchor = headers.eq( 1 ).next().find( "a" ).eq( 0 ), + keyCode = $.ui.keyCode; + equal( headers.filter( ".ui-state-focus" ).length, 0, "no headers focused on init" ); + headers.eq( 0 ).simulate( "focus" ); + setTimeout(function() { + ok( headers.eq( 0 ).is( ".ui-state-focus" ), "first header has focus" ); + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); + ok( headers.eq( 1 ).is( ".ui-state-focus" ), "DOWN moves focus to next header" ); + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.RIGHT } ); + ok( headers.eq( 2 ).is( ".ui-state-focus" ), "RIGHT moves focus to next header" ); + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); + ok( headers.eq( 0 ).is( ".ui-state-focus" ), "DOWN wraps focus to first header" ); + + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.UP } ); + ok( headers.eq( 2 ).is( ".ui-state-focus" ), "UP wraps focus to last header" ); + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.LEFT } ); + ok( headers.eq( 1 ).is( ".ui-state-focus" ), "LEFT moves focus to previous header" ); + + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.HOME } ); + ok( headers.eq( 0 ).is( ".ui-state-focus" ), "HOME moves focus to first header" ); + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.END } ); + ok( headers.eq( 2 ).is( ".ui-state-focus" ), "END moves focus to last header" ); + + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.ENTER } ); + equal( element.accordion( "option", "active" ) , 2, "ENTER activates panel" ); + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.SPACE } ); + equal( element.accordion( "option", "active" ), 1, "SPACE activates panel" ); + + anchor.simulate( "focus" ); + setTimeout(function() { + ok( !headers.eq( 1 ).is( ".ui-state-focus" ), "header loses focus when focusing inside the panel" ); + anchor.simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } ); + ok( headers.eq( 1 ).is( ".ui-state-focus" ), "CTRL+UP moves focus to header" ); + start(); + }, 1 ); + }, 1 ); +}); }( jQuery ) ); diff --git a/tests/unit/accordion/accordion_deprecated.html b/tests/unit/accordion/accordion_deprecated.html index 583c1adcd..116eb43b5 100644 --- a/tests/unit/accordion/accordion_deprecated.html +++ b/tests/unit/accordion/accordion_deprecated.html @@ -64,7 +64,7 @@

your bear, you have to admit it!
- No, we aren't selling bears. + No, we aren't selling bears.

We could talk about renting one. diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 2e68889ef..ba8fa5e44 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -118,6 +118,8 @@ $.widget( "ui.accordion", { }); } + this._bind( this.headers, { keydown: "_keydown" }); + this._bind( this.headers.next(), { keydown: "_panelKeyDown" }); this._setupEvents( options.event ); }, @@ -198,7 +200,8 @@ $.widget( "ui.accordion", { if ( key === "event" ) { if ( this.options.event ) { - this.headers.unbind( ".accordion" ); + this.headers.unbind( + this.options.event.split( " " ).join( ".accordion " ) + ".accordion" ); } this._setupEvents( value ); } @@ -348,18 +351,14 @@ $.widget( "ui.accordion", { }, _setupEvents: function( event ) { - var events = { - keydown: "_keydown" - }; - if ( event ) { - $.each( event.split(" "), function( index, eventName ) { - events[ eventName ] = "_eventHandler"; - }); + var events = {}; + if ( !event ) { + return; } - this._bind( this.headers, events ); - this._bind( this.headers.next(), { - keydown: "_panelKeyDown" + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; }); + this._bind( this.headers, events ); }, _eventHandler: function( event ) { -- cgit v1.2.3 From 4a6692a57aa156dcaa916af66b36f767a25e37c3 Mon Sep 17 00:00:00 2001 From: Scott González Date: Tue, 27 Mar 2012 18:05:51 -0400 Subject: Accordion: Added animation tests. --- tests/unit/accordion/accordion_options.js | 170 +++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 1 deletion(-) diff --git a/tests/unit/accordion/accordion_options.js b/tests/unit/accordion/accordion_options.js index 74a9a3177..2b7176394 100644 --- a/tests/unit/accordion/accordion_options.js +++ b/tests/unit/accordion/accordion_options.js @@ -75,7 +75,175 @@ if ( $.uiBackCompat === false ) { }); } -// TODO: add animation tests +test( "{ animate: false }", function() { + expect( 3 ); + var element = $( "#list1" ).accordion({ + animate: false + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + $.fn.animate = function() { + ok( false, ".animate() called" ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; +}); + +asyncTest( "{ animate: Number }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: 100 + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, 100, "correct duration" ); + equal( easing, undefined, "default easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: String }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: "linear" + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, undefined, "default duration" ); + equal( easing, "linear", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: {} }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: {} + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, undefined, "default duration" ); + equal( easing, undefined, "default easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: { duration, easing } }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: { duration: 100, easing: "linear" } + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, 100, "correct duration" ); + equal( easing, "linear", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: { duration, easing } }, animate down", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + active: 1, + animate: { duration: 100, easing: "linear" } + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, 100, "correct duration" ); + equal( easing, "linear", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 1 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 0 ); + panels.promise().done(function() { + ok( panels.eq( 1 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 0 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: { duration, easing, down } }, animate down", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + active: 1, + animate: { + duration: 100, + easing: "linear", + down: { + easing: "swing" + } + } + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, 100, "correct duration" ); + equal( easing, "swing", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 1 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 0 ); + panels.promise().done(function() { + ok( panels.eq( 1 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 0 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); test( "{ collapsible: false }", function() { expect( 4 ); -- cgit v1.2.3 From cd020af6278500b53d7a45d80d00804855e82b14 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Wed, 28 Mar 2012 11:45:27 +0200 Subject: Build/grunt: Extract css related tasks, use grunt-css instead --- grunt.js | 48 ++++++------------------------------------------ package.json | 5 ++--- 2 files changed, 8 insertions(+), 45 deletions(-) diff --git a/grunt.js b/grunt.js index 476fc8516..223225a8d 100644 --- a/grunt.js +++ b/grunt.js @@ -21,6 +21,10 @@ function createBanner( files ) { " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */"; } +// a working grunt.loadNpmTasks replacement +// gets us csslint and cssmin tasks +require('grunt-css')(grunt); + // allow access from banner template global.stripDirectory = stripDirectory; grunt.registerHelper( "strip_all_banners", function( filepath ) { @@ -91,7 +95,7 @@ grunt.initConfig({ } }, min: minify, - css_min: minifyCSS, + cssmin: minifyCSS, copy: { dist: { src: [ @@ -351,46 +355,6 @@ grunt.registerMultiTask( "zip", "Create a zip file for release", function() { }); }); -grunt.registerMultiTask( "csslint", "Lint CSS files with csslint", function() { - var csslint = require( "csslint" ).CSSLint; - var files = grunt.file.expandFiles( this.file.src ); - var ruleset = {}; - csslint.getRules().forEach(function( rule ) { - ruleset[ rule.id ] = 1; - }); - for ( var rule in this.data.rules ) { - if ( !this.data.rules[ rule ] ) { - delete ruleset[rule]; - } else { - ruleset[ rule ] = this.data.rules[ rule ]; - } - } - var hadErrors = 0; - files.forEach(function( filepath ) { - grunt.log.writeln( "Linting " + filepath ); - var result = csslint.verify( grunt.file.read( filepath ), ruleset ); - result.messages.forEach(function( message ) { - grunt.log.writeln( "[".red + ( "L" + message.line ).yellow + ":".red + ( "C" + message.col ).yellow + "]".red ); - log[ message.type === "error" ? "error" : "writeln" ]( message.message + " " + message.rule.desc + " (" + message.rule.id + ")" ); - }); - if ( result.messages.length ) { - hadErrors += 1; - } - }); - if (hadErrors) { - return false; - } - grunt.log.writeln( "Lint free" ); -}); - -grunt.registerMultiTask( "css_min", "Minify CSS files with Sqwish.", function() { - var max = grunt.helper( "concat", grunt.file.expandFiles( this.file.src ) ); - var min = require( "sqwish" ).minify( max, false ); - grunt.file.write( this.file.dest, min ); - grunt.log.writeln( "File '" + this.file.dest + "' created." ); - grunt.helper( "min_max_info", min, max ); -}); - 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 ( require( "path" ).existsSync( this.file.dest ) ) { @@ -542,7 +506,7 @@ grunt.registerHelper( "lpad", function( str, len, chr ) { grunt.registerTask( "default", "lint csslint qunit build compare_size" ); grunt.registerTask( "sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" ); -grunt.registerTask( "build", "concat min css_min" ); +grunt.registerTask( "build", "concat min cssmin" ); grunt.registerTask( "release", "clean build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min md5:dist zip:dist" ); grunt.registerTask( "release_themes", "release download_themes copy_themes copy:themes md5:themes zip:themes" ); grunt.registerTask( "release_cdn", "release_themes copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_min_images copy:cdn_themes md5:cdn zip:cdn" ); diff --git a/package.json b/package.json index de297f467..a395037f8 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,9 @@ ], "dependencies": {}, "devDependencies": { - "grunt": "0.2.x", - "sqwish": "0.2.x", + "grunt": "0.3.x", + "grunt-css": "0.1.0", "request": "2.9.x", - "csslint": "0.9.x", "adm-zip": "0.1.x", "rimraf": "2.0.1" }, -- cgit v1.2.3 From a1f88869ab6127249271b661d61c8eb93b0f1417 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Wed, 28 Mar 2012 18:50:22 +0200 Subject: Tagging 1.9m7 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 13c1a7371..7601988c1 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.9pre +1.9m7 -- cgit v1.2.3 From 68135431295d27f421eedacbb08296db441950a5 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Wed, 28 Mar 2012 18:50:57 +0200 Subject: Bump version --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 7601988c1..13c1a7371 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.9m7 +1.9pre -- cgit v1.2.3 From 08aaa225ce282c6522f446aee98290fff3c87782 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Wed, 28 Mar 2012 19:58:11 +0200 Subject: Build/grunt: Accept more grunt-css versions --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a395037f8..39305f719 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "dependencies": {}, "devDependencies": { "grunt": "0.3.x", - "grunt-css": "0.1.0", + "grunt-css": "0.1.x", "request": "2.9.x", "adm-zip": "0.1.x", "rimraf": "2.0.1" -- cgit v1.2.3 From 3e7504156ac9e2fbef434e109306699ee87ddc9d Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 29 Mar 2012 12:48:21 +0200 Subject: Build/grunt: Use grunt.loadNpmTasks, now that its actually working --- grunt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 223225a8d..ee1e8397f 100644 --- a/grunt.js +++ b/grunt.js @@ -23,7 +23,7 @@ function createBanner( files ) { // a working grunt.loadNpmTasks replacement // gets us csslint and cssmin tasks -require('grunt-css')(grunt); +grunt.loadNpmTasks('grunt-css'); // allow access from banner template global.stripDirectory = stripDirectory; -- cgit v1.2.3 From a51451dc1b19bf6c2e10b1648b57d006bf38c303 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Thu, 29 Mar 2012 09:51:43 -0400 Subject: Datepicker: Fixed nextText, prevText, and Sunday and split words onto multiple lines for readability. Fixes #8225 - Datepicker: Incorrect values in Persian localization. --- ui/i18n/jquery.ui.datepicker-fa.js | 50 ++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/ui/i18n/jquery.ui.datepicker-fa.js b/ui/i18n/jquery.ui.datepicker-fa.js index 1d7fbd23c..be8acd2a5 100644 --- a/ui/i18n/jquery.ui.datepicker-fa.js +++ b/ui/i18n/jquery.ui.datepicker-fa.js @@ -4,15 +4,51 @@ jQuery(function($) { $.datepicker.regional['fa'] = { closeText: 'بستن', - prevText: '<قبلي', - nextText: 'بعدي>', + prevText: '<قبلی', + nextText: 'بعدی>', currentText: 'امروز', - monthNames: ['فروردين','ارديبهشت','خرداد','تير','مرداد','شهريور', - 'مهر','آبان','آذر','دي','بهمن','اسفند'], + monthNames: [ + 'فروردين', + 'ارديبهشت', + 'خرداد', + 'تير', + 'مرداد', + 'شهريور', + 'مهر', + 'آبان', + 'آذر', + 'دی', + 'بهمن', + 'اسفند' + ], monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'], - dayNames: ['يکشنبه','دوشنبه','سه‌شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه'], - dayNamesShort: ['ي','د','س','چ','پ','ج', 'ش'], - dayNamesMin: ['ي','د','س','چ','پ','ج', 'ش'], + dayNames: [ + 'يکشنبه', + 'دوشنبه', + 'سه‌شنبه', + 'چهارشنبه', + 'پنجشنبه', + 'جمعه', + 'شنبه' + ], + dayNamesShort: [ + 'ی', + 'د', + 'س', + 'چ', + 'پ', + 'ج', + 'ش' + ], + dayNamesMin: [ + 'ی', + 'د', + 'س', + 'چ', + 'پ', + 'ج', + 'ش' + ], weekHeader: 'هف', dateFormat: 'yy/mm/dd', firstDay: 6, -- cgit v1.2.3 From 748702c29ac00df5bfc4090dc3fa1b3a9e65da70 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 29 Mar 2012 16:29:27 +0200 Subject: Build/grunt: Add download_docs task for 1.8 --- grunt.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/grunt.js b/grunt.js index ee1e8397f..ea8b86094 100644 --- a/grunt.js +++ b/grunt.js @@ -372,6 +372,43 @@ grunt.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", fun grunt.log.writeln( "Wrote " + this.file.dest + " with " + hashes.length + " hashes" ); }); +// only needed for 1.8 +grunt.registerTask( "download_docs", function() { + function capitalize(value) { + return value[0].toUpperCase() + value.slice(1); + } + // should be grunt.config("pkg.version")? + var version = "1.8"; + var docsDir = "dist/docs"; + var files = "draggable droppable resizable selectable sortable accordion autocomplete button datepicker dialog progressbar slider tabs position" + .split(" ").map(function(widget) { + return { + url: "http://docs.jquery.com/action/render/UI/API/" + version + "/" + capitalize(widget), + dest: docsDir + '/' + widget + '.html' + }; + }); + files = files.concat("animate addClass effect hide removeClass show switchClass toggle toggleClass".split(" ").map(function(widget) { + return { + url: "http://docs.jquery.com/action/render/UI/Effects/" + widget, + dest: docsDir + '/' + widget + '.html' + }; + })); + files = files.concat("Blind Clip Drop Explode Fade Fold Puff Slide Scale Bounce Highlight Pulsate Shake Size Transfer".split(" ").map(function(widget) { + return { + url: "http://docs.jquery.com/action/render/UI/Effects/" + widget, + dest: docsDir + '/effect-' + widget.toLowerCase() + '.html' + }; + })); + var fs = require( "fs" ); + var request = require( "request" ); + grunt.file.mkdir( "dist/docs" ); + grunt.utils.async.forEach( files, function( file, done ) { + var out = fs.createWriteStream( file.dest ); + out.on( "close", done ); + request( file.url ).pipe( out ); + }, this.async() ); +}); + grunt.registerTask( "download_themes", function() { // var AdmZip = require('adm-zip'); var fs = require( "fs" ); -- cgit v1.2.3 From 56de22eeadb5882ad1d78a207b9fb69247e233ee Mon Sep 17 00:00:00 2001 From: Scott González Date: Thu, 29 Mar 2012 18:36:38 -0400 Subject: Tooltip: Avoid infinite recursion when disabling a tooltip on close. --- ui/jquery.ui.tooltip.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index eddd9a0c9..dd0a746d3 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -173,6 +173,12 @@ $.widget( "ui.tooltip", { target = $( event ? event.currentTarget : this.element ), tooltip = this._find( target ); + // disabling closes the tooltip, so we need to track when we're closing + // to avoid an infinite loop in case the tooltip becomes disabled on close + if ( this.closing ) { + return; + } + // don't close if the element has focus // this prevents the tooltip from closing if you hover while focused if ( !force && this.document[0].activeElement === target[0] ) { @@ -195,7 +201,9 @@ $.widget( "ui.tooltip", { target.removeData( "tooltip-open" ); target.unbind( "mouseleave.tooltip focusout.tooltip keyup.tooltip" ); + this.closing = true; this._trigger( "close", event, { tooltip: tooltip } ); + this.closing = false; }, _tooltip: function( element ) { -- cgit v1.2.3 From 45a5a24dfe6322cfeb047a2aed566c824f401307 Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 30 Mar 2012 09:06:06 -0400 Subject: Tooltip: Store the title in ui-tooltip-title data only if the element has a title. --- ui/jquery.ui.tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index dd0a746d3..23b3a9b71 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -99,7 +99,7 @@ $.widget( "ui.tooltip", { return; } - if ( !target.data( "ui-tooltip-title" ) ) { + if ( target.attr( "title" ) ) { target.data( "ui-tooltip-title", target.attr( "title" ) ); } -- cgit v1.2.3 From ff72467038f35fd7d031b33cf61d37ee02535a52 Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 30 Mar 2012 13:32:23 -0400 Subject: Grunt: Move common modules to top, along with lists of files. --- grunt.js | 144 ++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 88 insertions(+), 56 deletions(-) diff --git a/grunt.js b/grunt.js index ea8b86094..e18baeece 100644 --- a/grunt.js +++ b/grunt.js @@ -1,5 +1,80 @@ module.exports = function( grunt ) { +var // modules + fs = require( "fs" ), + path = require( "path" ), + request = require( "request" ), + util = require( "util" ), + inspect = util.inspect, + + // files + coreFiles = [ + "jquery.ui.core.js", + "jquery.ui.widget.js", + "jquery.ui.mouse.js", + "jquery.ui.draggable.js", + "jquery.ui.droppable.js", + "jquery.ui.resizable.js", + "jquery.ui.selectable.js", + "jquery.ui.sortable.js", + "jquery.effects.core.js" + ], + + uiFiles = coreFiles.map(function( file ) { + return "ui/" + file; + }).concat( grunt.file.expandFiles( "ui/*.js" ).filter(function( file ) { + return coreFiles.indexOf( file.substring(3) ) === -1; + })), + + allI18nFiles = grunt.file.expandFiles( "ui/i18n/*.js" ), + + cssFiles = [ + "core", + "accordion", + "autocomplete", + "button", + "datepicker", + "dialog", + "menu", + "progressbar", + "resizable", + "selectable", + "slider", + "spinner", + "tabs", + "tooltip", + "theme" + ].map(function( component ) { + return "themes/base/jquery.ui." + component + ".css"; + }), + + // minified files + minify = { + "dist/jquery-ui.min.js": [ "", "dist/jquery-ui.js" ], + "dist/i18n/jquery-ui-i18n.min.js": [ "", "dist/i18n/jquery-ui-i18n.js" ] + }, + + minifyCSS = { + "dist/jquery-ui.min.css": "dist/jquery-ui.css" + }; + + +uiFiles.concat( allI18nFiles ).forEach(function( file ) { + minify[ "dist/" + file.replace( /\.js$/, ".min.js" ).replace( /ui\//, "minified/" ) ] = [ "", file ]; +}); + +cssFiles.forEach(function( file ) { + minifyCSS[ "dist/" + file.replace( /\.css$/, ".min.css" ).replace( /themes\/base\//, "themes/base/minified/" ) ] = [ "", file ]; +}); + + +// csslint and cssmin tasks +grunt.loadNpmTasks( "grunt-css" ); + +grunt.registerHelper( "strip_all_banners", function( filepath ) { + return grunt.file.read( filepath ).replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" ); +}); + function stripBanner( files ) { return files.map(function( file ) { return ""; @@ -9,6 +84,8 @@ function stripBanner( files ) { function stripDirectory( file ) { return file.replace( /.+\/(.+)$/, "$1" ); } +// allow access from banner template +global.stripDirectory = stripDirectory; function createBanner( files ) { // strip folders @@ -21,46 +98,6 @@ function createBanner( files ) { " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */"; } -// a working grunt.loadNpmTasks replacement -// gets us csslint and cssmin tasks -grunt.loadNpmTasks('grunt-css'); - -// allow access from banner template -global.stripDirectory = stripDirectory; -grunt.registerHelper( "strip_all_banners", function( filepath ) { - return grunt.file.read( filepath ).replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" ); -}); -var inspect = require( "util" ).inspect; - -var coreFiles = "jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js".split( ", " ); -var uiFiles = coreFiles.map(function( file ) { - return "ui/" + file; -}).concat( grunt.file.expandFiles( "ui/*.js" ).filter(function( file ) { - return coreFiles.indexOf( file.substring(3) ) === -1; -})); - -var minify = { - "dist/jquery-ui.min.js": [ "", "dist/jquery-ui.js" ], - "dist/i18n/jquery-ui-i18n.min.js": [ "", "dist/i18n/jquery-ui-i18n.js" ] -}; -function minFile( file ) { - minify[ "dist/" + file.replace( /\.js$/, ".min.js" ).replace( /ui\//, "minified/" ) ] = [ "", file ]; -} -uiFiles.forEach( minFile ); - -var allI18nFiles = grunt.file.expandFiles( "ui/i18n/*.js" ); -allI18nFiles.forEach( minFile ); - -var cssFiles = "core accordion autocomplete button datepicker dialog menu progressbar resizable selectable slider spinner tabs tooltip theme".split( " " ).map(function( component ) { - return "themes/base/jquery.ui." + component + ".css"; -}); -var minifyCSS = { - "dist/jquery-ui.min.css": "dist/jquery-ui.css" -}; -cssFiles.forEach(function( file ) { - minifyCSS[ "dist/" + file.replace( /\.css$/, ".min.css" ).replace( /themes\/base\//, "themes/base/minified/" ) ] = [ "", file ]; -}); - grunt.initConfig({ pkg: "", files: { @@ -324,16 +361,15 @@ grunt.registerMultiTask( "zip", "Create a zip file for release", function() { // var files = grunt.file.expandFiles( "dist/" + this.file.src + "/**/*" ); // grunt.log.writeln( "Creating zip file " + this.file.dest ); - // var fs = require( "fs" ); - // 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 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(); var dest = this.file.dest; @@ -357,8 +393,8 @@ 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 ( require( "path" ).existsSync( this.file.dest ) ) { - require( "fs" ).unlinkSync( this.file.dest ); + if ( path.existsSync( this.file.dest ) ) { + fs.unlinkSync( this.file.dest ); } var crypto = require( "crypto" ); var dir = this.file.src + "/"; @@ -399,8 +435,6 @@ grunt.registerTask( "download_docs", function() { dest: docsDir + '/effect-' + widget.toLowerCase() + '.html' }; })); - var fs = require( "fs" ); - var request = require( "request" ); grunt.file.mkdir( "dist/docs" ); grunt.utils.async.forEach( files, function( file, done ) { var out = fs.createWriteStream( file.dest ); @@ -411,8 +445,6 @@ grunt.registerTask( "download_docs", function() { grunt.registerTask( "download_themes", function() { // var AdmZip = require('adm-zip'); - var fs = require( "fs" ); - var request = require( "request" ); var done = this.async(); var themes = grunt.file.read( "build/themes" ).split(","); var requests = 0; -- cgit v1.2.3 From 48e5c853f995a825dd9d14cd2d8f592037f8505c Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 2 Apr 2012 10:44:51 +0300 Subject: Datepicker: Changed German translation for weekHeader to "KW". Fixes #8231 - Provide a better German translation for the week header. --- ui/i18n/jquery.ui.datepicker-de.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/i18n/jquery.ui.datepicker-de.js b/ui/i18n/jquery.ui.datepicker-de.js index 52d6c82ce..cfe91759b 100644 --- a/ui/i18n/jquery.ui.datepicker-de.js +++ b/ui/i18n/jquery.ui.datepicker-de.js @@ -13,7 +13,7 @@ jQuery(function($){ dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], - weekHeader: 'Wo', + weekHeader: 'KW', dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, -- cgit v1.2.3 From 37dcc3e21df5f1373ff9963217073a9faecfc057 Mon Sep 17 00:00:00 2001 From: Jo Liss Date: Mon, 27 Feb 2012 01:49:51 +0100 Subject: Protect all copyright notices against minification For instance, this is useful for the jquery-ui-rails gem, which does not use jQuery UI's own minification, but relies on Rails to minify the files where necessary. Rails in turn uses UglifyJS for JS and YUI for CSS, both of which respect the /*! ... */ convention. --- themes/base/jquery.ui.accordion.css | 2 +- themes/base/jquery.ui.all.css | 2 +- themes/base/jquery.ui.autocomplete.css | 2 +- themes/base/jquery.ui.base.css | 2 +- themes/base/jquery.ui.button.css | 2 +- themes/base/jquery.ui.core.css | 2 +- themes/base/jquery.ui.datepicker.css | 2 +- themes/base/jquery.ui.dialog.css | 2 +- themes/base/jquery.ui.menu.css | 2 +- themes/base/jquery.ui.progressbar.css | 2 +- themes/base/jquery.ui.resizable.css | 2 +- themes/base/jquery.ui.selectable.css | 2 +- themes/base/jquery.ui.slider.css | 2 +- themes/base/jquery.ui.spinner.css | 2 +- themes/base/jquery.ui.tabs.css | 2 +- themes/base/jquery.ui.theme.css | 2 +- themes/base/jquery.ui.tooltip.css | 2 +- ui/jquery.effects.blind.js | 2 +- ui/jquery.effects.bounce.js | 2 +- ui/jquery.effects.clip.js | 2 +- ui/jquery.effects.core.js | 2 +- ui/jquery.effects.drop.js | 2 +- ui/jquery.effects.explode.js | 2 +- ui/jquery.effects.fade.js | 2 +- ui/jquery.effects.fold.js | 2 +- ui/jquery.effects.highlight.js | 2 +- ui/jquery.effects.pulsate.js | 2 +- ui/jquery.effects.scale.js | 2 +- ui/jquery.effects.shake.js | 2 +- ui/jquery.effects.slide.js | 2 +- ui/jquery.effects.transfer.js | 2 +- ui/jquery.ui.accordion.js | 2 +- ui/jquery.ui.autocomplete.js | 2 +- ui/jquery.ui.button.js | 2 +- ui/jquery.ui.datepicker.js | 2 +- ui/jquery.ui.dialog.js | 2 +- ui/jquery.ui.draggable.js | 2 +- ui/jquery.ui.droppable.js | 2 +- ui/jquery.ui.menu.js | 2 +- ui/jquery.ui.position.js | 2 +- ui/jquery.ui.progressbar.js | 2 +- ui/jquery.ui.resizable.js | 2 +- ui/jquery.ui.selectable.js | 2 +- ui/jquery.ui.slider.js | 2 +- ui/jquery.ui.sortable.js | 2 +- ui/jquery.ui.spinner.js | 2 +- ui/jquery.ui.tabs.js | 2 +- ui/jquery.ui.tooltip.js | 2 +- 48 files changed, 48 insertions(+), 48 deletions(-) diff --git a/themes/base/jquery.ui.accordion.css b/themes/base/jquery.ui.accordion.css index 3e2777adf..c9532a87f 100644 --- a/themes/base/jquery.ui.accordion.css +++ b/themes/base/jquery.ui.accordion.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Accordion @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.all.css b/themes/base/jquery.ui.all.css index 60fd9d6fb..e2310973a 100644 --- a/themes/base/jquery.ui.all.css +++ b/themes/base/jquery.ui.all.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI CSS Framework @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.autocomplete.css b/themes/base/jquery.ui.autocomplete.css index 5ab05e2fd..5e331b63d 100644 --- a/themes/base/jquery.ui.autocomplete.css +++ b/themes/base/jquery.ui.autocomplete.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Autocomplete @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.base.css b/themes/base/jquery.ui.base.css index 97dfd36f0..f52f00f28 100644 --- a/themes/base/jquery.ui.base.css +++ b/themes/base/jquery.ui.base.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI CSS Framework @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.button.css b/themes/base/jquery.ui.button.css index be2e71796..87340658a 100644 --- a/themes/base/jquery.ui.button.css +++ b/themes/base/jquery.ui.button.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Button @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.core.css b/themes/base/jquery.ui.core.css index 1522dabb8..dc27c564a 100644 --- a/themes/base/jquery.ui.core.css +++ b/themes/base/jquery.ui.core.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI CSS Framework @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.datepicker.css b/themes/base/jquery.ui.datepicker.css index d5c81a529..393d86377 100644 --- a/themes/base/jquery.ui.datepicker.css +++ b/themes/base/jquery.ui.datepicker.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Datepicker @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.dialog.css b/themes/base/jquery.ui.dialog.css index 7d6bc0672..0ee0d4dd5 100644 --- a/themes/base/jquery.ui.dialog.css +++ b/themes/base/jquery.ui.dialog.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Dialog @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.menu.css b/themes/base/jquery.ui.menu.css index 1e559e661..4469e74d3 100644 --- a/themes/base/jquery.ui.menu.css +++ b/themes/base/jquery.ui.menu.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Menu @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.progressbar.css b/themes/base/jquery.ui.progressbar.css index e24afc886..d198bb4a3 100644 --- a/themes/base/jquery.ui.progressbar.css +++ b/themes/base/jquery.ui.progressbar.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Progressbar @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.resizable.css b/themes/base/jquery.ui.resizable.css index c652ddb98..0bf680482 100644 --- a/themes/base/jquery.ui.resizable.css +++ b/themes/base/jquery.ui.resizable.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Resizable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.selectable.css b/themes/base/jquery.ui.selectable.css index 0305e2df2..2aa7319aa 100644 --- a/themes/base/jquery.ui.selectable.css +++ b/themes/base/jquery.ui.selectable.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Selectable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.slider.css b/themes/base/jquery.ui.slider.css index e9fc963f2..94d883a44 100644 --- a/themes/base/jquery.ui.slider.css +++ b/themes/base/jquery.ui.slider.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Slider @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.spinner.css b/themes/base/jquery.ui.spinner.css index 2603f2012..7c0737c31 100644 --- a/themes/base/jquery.ui.spinner.css +++ b/themes/base/jquery.ui.spinner.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Spinner @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.tabs.css b/themes/base/jquery.ui.tabs.css index a44242a36..5282817c2 100644 --- a/themes/base/jquery.ui.tabs.css +++ b/themes/base/jquery.ui.tabs.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Tabs @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.theme.css b/themes/base/jquery.ui.theme.css index 94db2c5a7..3a9cfae82 100644 --- a/themes/base/jquery.ui.theme.css +++ b/themes/base/jquery.ui.theme.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI CSS Framework @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/themes/base/jquery.ui.tooltip.css b/themes/base/jquery.ui.tooltip.css index d6cbcb26d..f1fa50cc6 100644 --- a/themes/base/jquery.ui.tooltip.css +++ b/themes/base/jquery.ui.tooltip.css @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Tooltip @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js index a5e0d1c8b..005b59ad6 100644 --- a/ui/jquery.effects.blind.js +++ b/ui/jquery.effects.blind.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Blind @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.bounce.js b/ui/jquery.effects.bounce.js index 73fe3c502..94d73644e 100644 --- a/ui/jquery.effects.bounce.js +++ b/ui/jquery.effects.bounce.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Bounce @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js index 983ac9c53..861508cd0 100644 --- a/ui/jquery.effects.clip.js +++ b/ui/jquery.effects.clip.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Clip @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 24df7178c..1f074e6e2 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.drop.js b/ui/jquery.effects.drop.js index 54cdc25f3..8ccbfe57d 100644 --- a/ui/jquery.effects.drop.js +++ b/ui/jquery.effects.drop.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Drop @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.explode.js b/ui/jquery.effects.explode.js index 08908d3eb..d030efc70 100644 --- a/ui/jquery.effects.explode.js +++ b/ui/jquery.effects.explode.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Explode @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.fade.js b/ui/jquery.effects.fade.js index b653f1dfd..89784bd08 100644 --- a/ui/jquery.effects.fade.js +++ b/ui/jquery.effects.fade.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Fade @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.fold.js b/ui/jquery.effects.fold.js index 3642edf3f..f33c2d050 100644 --- a/ui/jquery.effects.fold.js +++ b/ui/jquery.effects.fold.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Fold @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.highlight.js b/ui/jquery.effects.highlight.js index 88a69ab51..ac6c269e5 100644 --- a/ui/jquery.effects.highlight.js +++ b/ui/jquery.effects.highlight.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Highlight @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js index e1e4d0631..5b27bb324 100644 --- a/ui/jquery.effects.pulsate.js +++ b/ui/jquery.effects.pulsate.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Pulsate @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index 64e31ea96..ea849624b 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Scale @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.shake.js b/ui/jquery.effects.shake.js index 0e12cfe56..d027b740d 100644 --- a/ui/jquery.effects.shake.js +++ b/ui/jquery.effects.shake.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Shake @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js index a376d3c56..e747b2e85 100644 --- a/ui/jquery.effects.slide.js +++ b/ui/jquery.effects.slide.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Slide @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.effects.transfer.js b/ui/jquery.effects.transfer.js index df392339b..3368fb18e 100644 --- a/ui/jquery.effects.transfer.js +++ b/ui/jquery.effects.transfer.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Effects Transfer @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index ba8fa5e44..630d40d4e 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Accordion @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index d95d81bca..866ed7798 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Autocomplete @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index c8e345d93..701cb44d8 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Button @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 5dacd6943..c0de503f5 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Datepicker @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 35b18929f..053b26ab8 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Dialog @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 0e4389305..25b256710 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Draggable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js index 19334bf4d..47d3e38e9 100644 --- a/ui/jquery.ui.droppable.js +++ b/ui/jquery.ui.droppable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Droppable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 17177a906..aeffea026 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Menu @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 977e621a6..c88f75f7b 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Position @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js index 26f5e76f0..1504e5bca 100644 --- a/ui/jquery.ui.progressbar.js +++ b/ui/jquery.ui.progressbar.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Progressbar @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index 77fe8bcc1..9be33927e 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Resizable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.selectable.js b/ui/jquery.ui.selectable.js index ec54b5d9c..3244e654e 100644 --- a/ui/jquery.ui.selectable.js +++ b/ui/jquery.ui.selectable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Selectable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index 75c6631ca..a8bdb1948 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Slider @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 4c6a47169..4093be245 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Sortable @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index dab7ce471..bd55a09ea 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Spinner @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index c9300e69b..d3ef33121 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Tabs @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 23b3a9b71..46c5befaa 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -1,4 +1,4 @@ -/* +/*! * jQuery UI Tooltip @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) -- cgit v1.2.3 From b3374b9063a250214e4939788a99160a5d7c1de2 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Mon, 2 Apr 2012 15:49:34 +0200 Subject: Build/grunt: grunt.file.copy now expects options as third argument. Fixes the version replacing --- grunt.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index e18baeece..0f72e4842 100644 --- a/grunt.js +++ b/grunt.js @@ -339,7 +339,9 @@ grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @ if ( /png$/.test( fileName ) ) { grunt.file.copy( fileName, target + targetFile ); } else { - grunt.file.copy( fileName, target + targetFile, replaceVersion ); + grunt.file.copy( fileName, target + targetFile, { + process: replaceVersion + }); } }); grunt.log.writeln( "Copied " + files.length + " files." ); -- cgit v1.2.3 From 8769798cb32e95e20ebb9bb9772a6895520a78ac Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Mon, 2 Apr 2012 15:59:32 +0200 Subject: Build/grunt: Fix dependencies to versions we've tested against. No more surprise API changes, for now --- package.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 39305f719..30e2b4898 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,9 @@ ], "dependencies": {}, "devDependencies": { - "grunt": "0.3.x", - "grunt-css": "0.1.x", - "request": "2.9.x", - "adm-zip": "0.1.x", + "grunt": "0.3.7", + "grunt-css": "0.1.1", + "request": "2.9.153", "rimraf": "2.0.1" }, "keywords": [] -- cgit v1.2.3 From 83756a1d874823389f6e378ebdce014efe3d9bf7 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Mon, 2 Apr 2012 16:05:59 +0200 Subject: Build/grunt: Strip existing (protected) headers from to-be-minified CSS files --- grunt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 0f72e4842..a8ab7c666 100644 --- a/grunt.js +++ b/grunt.js @@ -64,7 +64,7 @@ uiFiles.concat( allI18nFiles ).forEach(function( file ) { }); cssFiles.forEach(function( file ) { - minifyCSS[ "dist/" + file.replace( /\.css$/, ".min.css" ).replace( /themes\/base\//, "themes/base/minified/" ) ] = [ "", file ]; + minifyCSS[ "dist/" + file.replace( /\.css$/, ".min.css" ).replace( /themes\/base\//, "themes/base/minified/" ) ] = [ "", "" ]; }); -- cgit v1.2.3 From 585ef702ef117232778113efc9979d51549abeeb Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 2 Apr 2012 11:12:49 -0400 Subject: Grunt: Copy jquery from root regardless of version; fix include list for minified CSS files. --- grunt.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grunt.js b/grunt.js index a8ab7c666..3be684908 100644 --- a/grunt.js +++ b/grunt.js @@ -82,7 +82,9 @@ function stripBanner( files ) { } function stripDirectory( file ) { - return file.replace( /.+\/(.+)$/, "$1" ); + // TODO: we're receiving the directive, so we need to strip the trailing > + // we should be receving a clean path without the directive + return file.replace( /.+\/(.+?)>?$/, "$1" ); } // allow access from banner template global.stripDirectory = stripDirectory; @@ -138,7 +140,7 @@ grunt.initConfig({ src: [ "AUTHORS.txt", "GPL-LICENSE.txt", - "jquery-1.7.1.js", + "jquery-*.js", "MIT-LICENSE.txt", "README.md", "grunt.js", -- cgit v1.2.3 From 3876c874e3f311d263aef9f99ed2780afa1d41d7 Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 2 Apr 2012 13:15:54 -0400 Subject: Grunt: Whitelist js and css files for @version replacement instead of blacklisting png. --- grunt.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grunt.js b/grunt.js index 3be684908..ad4c8bd40 100644 --- a/grunt.js +++ b/grunt.js @@ -338,12 +338,12 @@ grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @ } files.forEach(function( fileName ) { var targetFile = strip ? fileName.replace( strip, "" ) : fileName; - if ( /png$/.test( fileName ) ) { - grunt.file.copy( fileName, target + targetFile ); - } else { + if ( /(js|css)$/.test( fileName ) ) { grunt.file.copy( fileName, target + targetFile, { process: replaceVersion }); + } else { + grunt.file.copy( fileName, target + targetFile ); } }); grunt.log.writeln( "Copied " + files.length + " files." ); -- cgit v1.2.3 From ccbfd45924d6ddebc7b2bb575a9c8997a3d9ec03 Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 2 Apr 2012 15:55:50 -0400 Subject: A few lint fixes. --- ui/jquery.effects.core.js | 18 ++++++++++-------- ui/jquery.effects.drop.js | 13 +++++++------ ui/jquery.effects.scale.js | 31 ++++++++++++++++--------------- ui/jquery.effects.shake.js | 2 +- ui/jquery.effects.slide.js | 5 ++--- ui/jquery.ui.accordion.js | 2 +- ui/jquery.ui.autocomplete.js | 4 ++-- ui/jquery.ui.core.js | 12 ++++++------ ui/jquery.ui.menu.js | 6 +++--- ui/jquery.ui.mouse.js | 2 +- ui/jquery.ui.position.js | 10 +++++----- ui/jquery.ui.tabs.js | 2 +- 12 files changed, 55 insertions(+), 52 deletions(-) diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 1f074e6e2..62d6b2c38 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -171,9 +171,9 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS }); function getElementStyles() { - var style = this.ownerDocument.defaultView - ? this.ownerDocument.defaultView.getComputedStyle( this, null ) - : this.currentStyle, + var style = this.ownerDocument.defaultView ? + this.ownerDocument.defaultView.getComputedStyle( this, null ) : + this.currentStyle, newStyle = {}, key, camelCase, @@ -375,13 +375,13 @@ $.extend( $.effects, { case "middle": y = 0.5; break; case "bottom": y = 1; break; default: y = origin[ 0 ] / original.height; - }; + } switch ( origin[ 1 ] ) { case "left": x = 0; break; case "center": x = 0.5; break; case "right": x = 1; break; default: x = origin[ 1 ] / original.width; - }; + } return { x: x, y: y @@ -523,8 +523,10 @@ function _normalizeArguments( effect, options, speed, callback ) { } speed = speed || options.duration; - effect.duration = $.fx.off ? 0 : typeof speed === "number" - ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default; + effect.duration = $.fx.off ? 0 : + typeof speed === "number" ? speed : + speed in $.fx.speeds ? $.fx.speeds[ speed ] : + $.fx.speeds._default; effect.complete = callback || options.complete; @@ -701,7 +703,7 @@ $.each( baseEasings, function( name, easeIn ) { return 1 - easeIn( 1 - p ); }; $.easing[ "easeInOut" + name ] = function( p ) { - return p < .5 ? + return p < 0.5 ? easeIn( p * 2 ) / 2 : easeIn( p * -2 + 2 ) / -2 + 1; }; diff --git a/ui/jquery.effects.drop.js b/ui/jquery.effects.drop.js index 8ccbfe57d..6c72be9e5 100644 --- a/ui/jquery.effects.drop.js +++ b/ui/jquery.effects.drop.js @@ -31,19 +31,19 @@ $.effects.effect.drop = function( o, done ) { el.show(); $.effects.createWrapper( el ); - distance = o.distance || el[ ref == "top" ? "outerHeight": "outerWidth" ]({ margin: true }) / 2; + distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]({ margin: true }) / 2; if ( show ) { el .css( "opacity", 0 ) - .css( ref, motion == "pos" ? -distance : distance ); + .css( ref, motion === "pos" ? -distance : distance ); } // Animation animation[ ref ] = ( show ? ( motion === "pos" ? "+=" : "-=" ) : - ( motion === "pos" ? "-=" : "+=" ) ) - + distance; + ( motion === "pos" ? "-=" : "+=" ) ) + + distance; // Animate el.animate( animation, { @@ -51,13 +51,14 @@ $.effects.effect.drop = function( o, done ) { duration: o.duration, easing: o.easing, complete: function() { - mode == "hide" && el.hide(); + if ( mode === "hide" ) { + el.hide(); + } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); } }); - }; })(jQuery); diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index ea849624b..63b95275c 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -30,9 +30,9 @@ $.effects.effect.puff = function( o, done ) { mode: mode, complete: done, percent: hide ? percent : 100, - from: hide - ? original - : { + from: hide ? + original : + { height: original.height * factor, width: original.width * factor } @@ -47,7 +47,7 @@ $.effects.effect.scale = function( o, done ) { var el = $( this ), options = $.extend( true, {}, o ), mode = $.effects.setMode( el, o.mode || "effect" ), - percent = parseInt( o.percent, 10 ) || ( parseInt( o.percent, 10 ) == 0 ? 0 : ( mode == "hide" ? 0 : 100 ) ), + percent = parseInt( o.percent, 10 ) || ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode == "hide" ? 0 : 100 ) ), direction = o.direction || "both", origin = o.origin, original = { @@ -80,7 +80,8 @@ $.effects.effect.scale = function( o, done ) { outerWidth: original.outerWidth * factor.x }; - if ( options.fade ) { // Fade option to support puff + // Fade option to support puff + if ( options.fade ) { if ( mode == "show" ) { options.from.opacity = 0; options.to.opacity = 1; @@ -89,7 +90,7 @@ $.effects.effect.scale = function( o, done ) { options.from.opacity = 1; options.to.opacity = 0; } - }; + } // Animate el.effect( options ); @@ -152,15 +153,15 @@ $.effects.effect.size = function( o, done ) { props = props.concat( vProps ); el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); - }; + } // Horizontal props scaling if ( factor.from.x !== factor.to.x ) { props = props.concat( hProps ); el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); - }; - }; + } + } // Scale the content if ( scale == "content" || scale == "both" ) { @@ -170,9 +171,9 @@ $.effects.effect.size = function( o, done ) { props = props.concat( cProps ); el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); - }; - }; - + } + } + $.effects.save( el, restore ? props : props1 ); el.show(); $.effects.createWrapper( el ); @@ -217,13 +218,13 @@ $.effects.effect.size = function( o, done ) { if ( factor.from.y != factor.to.y ) { child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); - }; + } // Horizontal props scaling if ( factor.from.x != factor.to.x ) { child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); - }; + } // Animate children child.css( child.from ); @@ -233,7 +234,7 @@ $.effects.effect.size = function( o, done ) { if (restore) $.effects.restore( child, props2 ); }); }); - }; + } // Animate el.animate( el.to, { diff --git a/ui/jquery.effects.shake.js b/ui/jquery.effects.shake.js index d027b740d..c6276d15e 100644 --- a/ui/jquery.effects.shake.js +++ b/ui/jquery.effects.shake.js @@ -49,7 +49,7 @@ $.effects.effect.shake = function( o, done ) { // Shakes for ( i = 1; i < times; i++ ) { el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); - }; + } el .animate( animation1, speed, o.easing ) .animate( animation, speed / 2, o.easing ) diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js index e747b2e85..5c8eb2566 100644 --- a/ui/jquery.effects.slide.js +++ b/ui/jquery.effects.slide.js @@ -44,8 +44,8 @@ $.effects.effect.slide = function( o, done ) { // Animation animation[ ref ] = ( show ? ( positiveMotion ? "+=" : "-=") : - ( positiveMotion ? "-=" : "+=")) - + distance; + ( positiveMotion ? "-=" : "+=")) + + distance; // Animate el.animate( animation, { @@ -61,7 +61,6 @@ $.effects.effect.slide = function( o, done ) { done(); } }); - }; })(jQuery); diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 630d40d4e..92245d28e 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -695,7 +695,7 @@ if ( $.uiBackCompat !== false ) { easing: "easeOutBounce", duration: 1000 } - } + }; } else { options.animate = options.animated; } diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 866ed7798..07992ab2e 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -108,7 +108,7 @@ $.widget( "ui.autocomplete", { suppressKeyPress = true; event.preventDefault(); } - //passthrough - ENTER and TAB both select the current element + // passthrough - ENTER and TAB both select the current element case keyCode.TAB: if ( !self.menu.active ) { return; @@ -270,7 +270,7 @@ $.widget( "ui.autocomplete", { .data( "menu" ); if ( $.fn.bgiframe ) { - this.menu.element.bgiframe(); + this.menu.element.bgiframe(); } // turning off autocomplete prevents the browser from remembering the diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 574256cad..f66b71c6e 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -176,13 +176,13 @@ function focusable( element, isTabIndexNotNaN ) { img = $( "img[usemap=#" + mapName + "]" )[0]; return !!img && visible( img ); } - return ( /input|select|textarea|button|object/.test( nodeName ) - ? !element.disabled - : "a" == nodeName - ? element.href || isTabIndexNotNaN - : isTabIndexNotNaN) + return ( /input|select|textarea|button|object/.test( nodeName ) ? + !element.disabled : + "a" == nodeName ? + element.href || isTabIndexNotNaN : + isTabIndexNotNaN) && // the element and all of its ancestors must be visible - && visible( element ); + visible( element ); } function visible( element ) { diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index aeffea026..6d00f66ae 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -368,9 +368,9 @@ $.widget( "ui.menu", { var position = $.extend({}, { of: this.active - }, $.type(this.options.position) == "function" - ? this.options.position(this.active) - : this.options.position + }, $.type(this.options.position) == "function" ? + this.options.position(this.active) : + this.options.position ); submenu.show() diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js index 5e7744418..53b3dcc20 100644 --- a/ui/jquery.ui.mouse.js +++ b/ui/jquery.ui.mouse.js @@ -53,7 +53,7 @@ $.widget("ui.mouse", { _mouseDown: function(event) { // don't let more than one widget handle mouseStart - if( mouseHandled ) { return }; + if( mouseHandled ) { return; } // we may have missed mouseup (out of window) (this._mouseStarted && this._mouseUp(event)); diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index c88f75f7b..7fe31626d 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -152,13 +152,13 @@ $.fn.position = function( options ) { var elem = $( this ), elemWidth = elem.outerWidth(), elemHeight = elem.outerHeight(), - marginLeft = parseInt( $.css( this, "marginLeft" ) ) || 0, - marginTop = parseInt( $.css( this, "marginTop" ) ) || 0, + marginLeft = parseInt( $.css( this, "marginLeft" ), 10 ) || 0, + marginTop = parseInt( $.css( this, "marginTop" ), 10 ) || 0, scrollInfo = $.position.getScrollInfo( within ), collisionWidth = elemWidth + marginLeft + - ( parseInt( $.css( this, "marginRight" ) ) || 0 ) + scrollInfo.width, + ( parseInt( $.css( this, "marginRight" ), 10 ) || 0 ) + scrollInfo.width, collisionHeight = elemHeight + marginTop + - ( parseInt( $.css( this, "marginBottom" ) ) || 0 ) + scrollInfo.height, + ( parseInt( $.css( this, "marginBottom" ), 10 ) || 0 ) + scrollInfo.height, position = $.extend( {}, basePosition ), myOffset = [ parseInt( offsets.my[ 0 ], 10 ) * @@ -483,7 +483,7 @@ if ( $.uiBackCompat !== false ) { at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ], offset: undefined } ) ); - } + }; }( jQuery ) ); } diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index d3ef33121..45888220d 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -966,7 +966,7 @@ if ( $.uiBackCompat !== false ) { }, _cookie: function( active ) { var cookie = [ this.cookie || - ( this.cookie = this.options.cookie.name || "ui-tabs-" + ++listId ) ]; + ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ]; if ( arguments.length ) { cookie.push( active === false ? -1 : active ); cookie.push( this.options.cookie ); -- cgit v1.2.3 From 3e6877a892b8fb70f1130f639dfde09ce5af6236 Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 2 Apr 2012 19:12:10 -0400 Subject: Grunt: Fixed jshint options. --- grunt.js | 93 ++++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/grunt.js b/grunt.js index ad4c8bd40..1e8a197dc 100644 --- a/grunt.js +++ b/grunt.js @@ -278,52 +278,71 @@ grunt.initConfig({ } } }, - jshint: { - options: { + jshint: (function() { + var defaults = { curly: true, + eqnull: true, eqeqeq: true, - immed: true, + expr: true, latedef: true, newcap: true, noarg: true, - sub: true, - undef: true, - eqnull: true - }, - grunt: { - options: { - node: true - }, - globals: { - task: true, - config: true, - file: true, - log: true, - template: true + onevar: true, + // TODO: limit to multi-line comments https://github.com/jshint/jshint/issues/503 + smarttabs: true, + // TODO: use "faux strict mode" https://github.com/jshint/jshint/issues/504 + // strict: true, + // TODO: enable trailing + // trailing: true, + undef: true + }; + + function extend( a, b ) { + for ( var prop in b ) { + a[ prop ] = b[ prop ]; } - }, - ui: { - options: { - browser: true + return a; + } + + return { + options: defaults, + grunt: { + options: extend({ + node: true + }, defaults ), + globals: { + task: true, + config: true, + file: true, + log: true, + template: true + } }, - globals: { - jQuery: true - } - }, - tests: { - options: { - jquery: true + ui: { + options: extend({ + browser: true, + jquery: true + }, defaults ), + globals: { + Globalize: true + } }, - globals: { - module: true, - test: true, - ok: true, - equal: true, - deepEqual: true, - QUnit: true + tests: { + options: extend({ + browser: true, + jquery: true + }, defaults ), + globals: { + module: true, + test: true, + ok: true, + equal: true, + deepEqual: true, + QUnit: true + } } - } - } + }; + })() }); grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() { -- cgit v1.2.3 From 639afa595465f6a1f61e080f2b671af4aac69b4a Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 2 Apr 2012 19:12:21 -0400 Subject: Lint fixes. --- ui/jquery.effects.core.js | 74 +++++++++++++++++++++++++++----------------- ui/jquery.effects.explode.js | 16 +++++----- ui/jquery.effects.fold.js | 5 +-- ui/jquery.effects.scale.js | 37 ++++++++++++---------- ui/jquery.effects.shake.js | 5 ++- ui/jquery.effects.slide.js | 4 +-- ui/jquery.ui.accordion.js | 36 +++++++++++---------- ui/jquery.ui.autocomplete.js | 8 ++--- ui/jquery.ui.button.js | 9 +++--- ui/jquery.ui.core.js | 20 ++++++------ ui/jquery.ui.dialog.js | 45 ++++++++++++++------------- ui/jquery.ui.menu.js | 42 +++++++++++++------------ ui/jquery.ui.mouse.js | 6 ++-- ui/jquery.ui.progressbar.js | 4 +-- ui/jquery.ui.slider.js | 5 +-- ui/jquery.ui.tabs.js | 33 ++++++++++++-------- ui/jquery.ui.tooltip.js | 2 +- ui/jquery.ui.widget.js | 20 ++++++------ 18 files changed, 207 insertions(+), 164 deletions(-) diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 62d6b2c38..1d56ae62f 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -7,9 +7,11 @@ * * http://docs.jquery.com/UI/Effects/ */ -;jQuery.effects || (function($, undefined) { +;(jQuery.effects || (function($, undefined) { -var backCompat = $.uiBackCompat !== false; +var backCompat = $.uiBackCompat !== false, + // prefix used for storing data on .data() + dataSpace = "ui-effects-"; $.effects = { effect: {} @@ -18,6 +20,7 @@ $.effects = { /******************************************************************************/ /****************************** COLOR ANIMATIONS ******************************/ /******************************************************************************/ +(function() { // override the animation for color styles $.each(["backgroundColor", "borderBottomColor", "borderLeftColor", @@ -46,28 +49,34 @@ function getRGB(color) { var result; // Check if we're already dealing with an array of colors - if ( color && color.constructor === Array && color.length === 3 ) - return color; + if ( color && color.constructor === Array && color.length === 3 ) { + return color; + } // Look for rgb(num,num,num) - if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) - return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; + if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) { + return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; + } // Look for rgb(num%,num%,num%) - if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) - return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; + if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) { + return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; + } // Look for #a0b1c2 - if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) - return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; + if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) { + return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; + } // Look for #fff - if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) - return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; + if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) { + return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; + } // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 - if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) - return colors["transparent"]; + if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) { + return colors.transparent; + } // Otherwise, we're most likely dealing with a named color return colors[$.trim(color).toLowerCase()]; @@ -80,14 +89,15 @@ function getColor(elem, attr) { color = $.css(elem, attr); // Keep going until we find an element that has color, or we hit the body - if ( color != "" && color !== "transparent" || $.nodeName(elem, "body") ) - break; + if ( color && color !== "transparent" || $.nodeName(elem, "body") ) { + break; + } attr = "backgroundColor"; } while ( elem = elem.parentNode ); return getRGB(color); -}; +} // Some named colors to work with // From Interface by Stefan Petre @@ -140,11 +150,12 @@ var colors = { transparent: [255,255,255] }; - +})(); /******************************************************************************/ /****************************** CLASS ANIMATIONS ******************************/ /******************************************************************************/ +(function() { var classAnimationActions = [ "add", "remove", "toggle" ], shorthandStyles = { @@ -157,9 +168,7 @@ var classAnimationActions = [ "add", "remove", "toggle" ], borderWidth: 1, margin: 1, padding: 1 - }, - // prefix used for storing data on .data() - dataSpace = "ui-effects-"; + }; $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) { $.fx.step[ prop ] = function( fx ) { @@ -206,7 +215,7 @@ function styleDifference( oldStyle, newStyle ) { for ( name in newStyle ) { value = newStyle[ name ]; - if ( oldStyle[ name ] != value ) { + if ( oldStyle[ name ] !== value ) { if ( !shorthandStyles[ name ] ) { if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { diff[ name ] = value; @@ -332,12 +341,14 @@ $.fn.extend({ } }); - +})(); /******************************************************************************/ /*********************************** EFFECTS **********************************/ /******************************************************************************/ +(function() { + $.extend( $.effects, { version: "@VERSION", @@ -473,9 +484,11 @@ $.extend( $.effects, { setTransition: function( element, list, factor, value ) { value = value || {}; - $.each( list, function(i, x){ + $.each( list, function( i, x ) { var unit = element.cssUnit( x ); - if ( unit[ 0 ] > 0 ) value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; + if ( unit[ 0 ] > 0 ) { + value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; + } }); return value; } @@ -651,19 +664,22 @@ $.fn.extend({ val = []; $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { - if ( style.indexOf( unit ) > 0 ) + if ( style.indexOf( unit ) > 0 ) { val = [ parseFloat( style ), unit ]; + } }); return val; } }); - +})(); /******************************************************************************/ /*********************************** EASING ***********************************/ /******************************************************************************/ +(function() { + // based on easing equations from Robert Penner (http://www.robertpenner.com/easing) var baseEasings = {}; @@ -709,4 +725,6 @@ $.each( baseEasings, function( name, easeIn ) { }; }); -})(jQuery); +})(); + +})(jQuery)); diff --git a/ui/jquery.effects.explode.js b/ui/jquery.effects.explode.js index d030efc70..ae3efb21e 100644 --- a/ui/jquery.effects.explode.js +++ b/ui/jquery.effects.explode.js @@ -31,6 +31,14 @@ $.effects.effect.explode = function( o, done ) { // loop i, j, left, top, mx, my; + // children animate complete: + function childComplete() { + pieces.push( this ); + if ( pieces.length === rows * cells ) { + animComplete(); + } + } + // clone the element for each row and cell. for( i = 0; i < rows ; i++ ) { // ===> top = offset.top + i * height; @@ -73,14 +81,6 @@ $.effects.effect.explode = function( o, done ) { } } - // children animate complete: - function childComplete() { - pieces.push( this ); - if ( pieces.length == rows * cells ) { - animComplete(); - } - } - function animComplete() { el.css({ visibility: "visible" diff --git a/ui/jquery.effects.fold.js b/ui/jquery.effects.fold.js index f33c2d050..17aa9a36b 100644 --- a/ui/jquery.effects.fold.js +++ b/ui/jquery.effects.fold.js @@ -23,11 +23,12 @@ $.effects.effect.fold = function( o, done ) { size = o.size || 15, percent = /([0-9]+)%/.exec( size ), horizFirst = !!o.horizFirst, - widthFirst = show != horizFirst, + widthFirst = show !== horizFirst, ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ], duration = o.duration / 2, wrapper, distance, - animation1 = {}, animation2 = {}; + animation1 = {}, + animation2 = {}; $.effects.save( el, props ); el.show(); diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index 63b95275c..83b41d3c2 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -47,7 +47,8 @@ $.effects.effect.scale = function( o, done ) { var el = $( this ), options = $.extend( true, {}, o ), mode = $.effects.setMode( el, o.mode || "effect" ), - percent = parseInt( o.percent, 10 ) || ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode == "hide" ? 0 : 100 ) ), + percent = parseInt( o.percent, 10 ) || + ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ), direction = o.direction || "both", origin = o.origin, original = { @@ -57,8 +58,8 @@ $.effects.effect.scale = function( o, done ) { outerWidth: el.outerWidth() }, factor = { - y: direction != "horizontal" ? (percent / 100) : 1, - x: direction != "vertical" ? (percent / 100) : 1 + y: direction !== "horizontal" ? (percent / 100) : 1, + x: direction !== "vertical" ? (percent / 100) : 1 }; // We are going to pass this effect to the size effect: @@ -67,12 +68,12 @@ $.effects.effect.scale = function( o, done ) { options.complete = done; // Set default origin and restore for show/hide - if ( mode != "effect" ) { + if ( mode !== "effect" ) { options.origin = origin || ["middle","center"]; options.restore = true; } - options.from = o.from || ( mode == "show" ? { height: 0, width: 0 } : original ); + options.from = o.from || ( mode === "show" ? { height: 0, width: 0 } : original ); options.to = { height: original.height * factor.y, width: original.width * factor.x, @@ -82,11 +83,11 @@ $.effects.effect.scale = function( o, done ) { // Fade option to support puff if ( options.fade ) { - if ( mode == "show" ) { + if ( mode === "show" ) { options.from.opacity = 0; options.to.opacity = 1; } - if ( mode == "hide" ) { + if ( mode === "hide" ) { options.from.opacity = 1; options.to.opacity = 0; } @@ -146,7 +147,7 @@ $.effects.effect.size = function( o, done ) { }; // Scale the css box - if ( scale == "box" || scale == "both" ) { + if ( scale === "box" || scale === "both" ) { // Vertical props scaling if ( factor.from.y !== factor.to.y ) { @@ -164,7 +165,7 @@ $.effects.effect.size = function( o, done ) { } // Scale the content - if ( scale == "content" || scale == "both" ) { + if ( scale === "content" || scale === "both" ) { // Vertical props scaling if ( factor.from.y !== factor.to.y ) { @@ -190,7 +191,7 @@ $.effects.effect.size = function( o, done ) { el.css( el.from ); // set top & left // Animate - if ( scale == "content" || scale == "both" ) { // Scale the children + if ( scale === "content" || scale === "both" ) { // Scale the children // Add margins/font-size vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); @@ -203,8 +204,10 @@ $.effects.effect.size = function( o, done ) { height: child.height(), width: child.width() }; - if (restore) $.effects.save(child, props2); - + if (restore) { + $.effects.save(child, props2); + } + child.from = { height: c_original.height * factor.from.y, width: c_original.width * factor.from.x @@ -215,13 +218,13 @@ $.effects.effect.size = function( o, done ) { }; // Vertical props scaling - if ( factor.from.y != factor.to.y ) { + if ( factor.from.y !== factor.to.y ) { child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); } // Horizontal props scaling - if ( factor.from.x != factor.to.x ) { + if ( factor.from.x !== factor.to.x ) { child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); } @@ -231,7 +234,9 @@ $.effects.effect.size = function( o, done ) { child.animate( child.to, o.duration, o.easing, function() { // Restore children - if (restore) $.effects.restore( child, props2 ); + if ( restore ) { + $.effects.restore( child, props2 ); + } }); }); } @@ -245,7 +250,7 @@ $.effects.effect.size = function( o, done ) { if ( el.to.opacity === 0 ) { el.css( "opacity", el.from.opacity ); } - if( mode == "hide" ) { + if( mode === "hide" ) { el.hide(); } $.effects.restore( el, restore ? props : props1 ); diff --git a/ui/jquery.effects.shake.js b/ui/jquery.effects.shake.js index c6276d15e..700c6df3d 100644 --- a/ui/jquery.effects.shake.js +++ b/ui/jquery.effects.shake.js @@ -22,8 +22,8 @@ $.effects.effect.shake = function( o, done ) { times = o.times || 3, anims = times * 2 + 1, speed = o.duration, - ref = (direction == "up" || direction == "down") ? "top" : "left", - positiveMotion = (direction == "up" || direction == "left"), + ref = (direction === "up" || direction === "down") ? "top" : "left", + positiveMotion = (direction === "up" || direction === "left"), animation = {}, animation1 = {}, animation2 = {}, @@ -32,7 +32,6 @@ $.effects.effect.shake = function( o, done ) { // we will need to re-assemble the queue to stack our animations in place queue = el.queue(), queuelen = queue.length; - $.effects.save( el, props ); el.show(); diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js index 5c8eb2566..77d540a9c 100644 --- a/ui/jquery.effects.slide.js +++ b/ui/jquery.effects.slide.js @@ -20,8 +20,8 @@ $.effects.effect.slide = function( o, done ) { mode = $.effects.setMode( el, o.mode || "show" ), show = mode === "show", direction = o.direction || "left", - ref = (direction == "up" || direction == "down") ? "top" : "left", - positiveMotion = (direction == "up" || direction == "left"), + ref = (direction === "up" || direction === "down") ? "top" : "left", + positiveMotion = (direction === "up" || direction === "left"), distance, animation = {}, size; diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 92245d28e..00ecd1b64 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -12,7 +12,22 @@ * jquery.ui.widget.js */ (function( $, undefined ) { - var uid = 0; + var uid = 0, + hideProps = {}, + showProps = {}, + showPropsAdjust = {}; + +hideProps.height = hideProps.paddingTop = hideProps.paddingBottom = + hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide"; +showProps.height = showProps.paddingTop = showProps.paddingBottom = + showProps.borderTopWidth = showProps.borderBottomWidth = "show"; +$.extend( showPropsAdjust, showProps, { accordionHeight: "show" } ); + +$.fx.step.accordionHeight = function( fx ) { + var elem = $( fx.elem ), + data = elem.data( "ui-accordion-height" ); + elem.height( data.total - elem.outerHeight() - data.toHide.outerHeight() + elem.height() ); +}; $.widget( "ui.accordion", { version: "@VERSION", @@ -151,7 +166,8 @@ $.widget( "ui.accordion", { }, _destroy: function() { - var accordionId = this.accordionId; + var contents, + accordionId = this.accordionId; // clean up main element this.element @@ -173,7 +189,7 @@ $.widget( "ui.accordion", { this._destroyIcons(); // clean up content panels - var contents = this.headers.next() + contents = this.headers.next() .css( "display", "" ) .removeAttr( "role" ) .removeAttr( "aria-expanded" ) @@ -514,20 +530,6 @@ $.widget( "ui.accordion", { } }); -$.fx.step.accordionHeight = function( fx ) { - var elem = $( fx.elem ), - data = elem.data( "ui-accordion-height" ); - elem.height( data.total - elem.outerHeight() - data.toHide.outerHeight() + elem.height() ); -}; -var hideProps = {}, - showProps = {}, - showPropsAdjust = {}; -hideProps.height = hideProps.paddingTop = hideProps.paddingBottom = - hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide"; -showProps.height = showProps.paddingTop = showProps.paddingBottom = - showProps.borderTopWidth = showProps.borderBottomWidth = "show"; -$.extend( showPropsAdjust, showProps, { accordionHeight: "show" } ); - // DEPRECATED diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 07992ab2e..5ec5790ed 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -1,4 +1,4 @@ -/*! +/* * jQuery UI Autocomplete @VERSION * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) @@ -108,7 +108,7 @@ $.widget( "ui.autocomplete", { suppressKeyPress = true; event.preventDefault(); } - // passthrough - ENTER and TAB both select the current element + //passthrough - ENTER and TAB both select the current element case keyCode.TAB: if ( !self.menu.active ) { return; @@ -238,7 +238,7 @@ $.widget( "ui.autocomplete", { select: function( event, ui ) { // back compat for _renderItem using item.autocomplete, via #7810 // TODO remove the fallback, see #8156 - var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ); + var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ), previous = self.previous; // only trigger when focus was lost (click on menu) @@ -270,7 +270,7 @@ $.widget( "ui.autocomplete", { .data( "menu" ); if ( $.fn.bgiframe ) { - this.menu.element.bgiframe(); + this.menu.element.bgiframe(); } // turning off autocomplete prevents the browser from remembering the diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 701cb44d8..f84d748cf 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -186,7 +186,7 @@ $.widget( "ui.button", { if ( options.disabled ) { return false; } - if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) { + if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) { $( this ).addClass( "ui-state-active" ); } }) @@ -212,6 +212,7 @@ $.widget( "ui.button", { }, _determineButtonType: function() { + var ancestor, labelSelector, checked; if ( this.element.is(":checkbox") ) { this.type = "checkbox"; @@ -226,8 +227,8 @@ $.widget( "ui.button", { if ( this.type === "checkbox" || this.type === "radio" ) { // we don't search against the document in case the element // is disconnected from the DOM - var ancestor = this.element.parents().last(), - labelSelector = "label[for='" + this.element.attr("id") + "']"; + ancestor = this.element.parents().last(); + labelSelector = "label[for='" + this.element.attr("id") + "']"; this.buttonElement = ancestor.find( labelSelector ); if ( !this.buttonElement.length ) { ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); @@ -238,7 +239,7 @@ $.widget( "ui.button", { } this.element.addClass( "ui-helper-hidden-accessible" ); - var checked = this.element.is( ":checked" ); + checked = this.element.is( ":checked" ); if ( checked ) { this.buttonElement.addClass( "ui-state-active" ); } diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index f66b71c6e..93353996e 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -165,11 +165,11 @@ $.each( [ "Width", "Height" ], function( i, name ) { // selectors function focusable( element, isTabIndexNotNaN ) { - var nodeName = element.nodeName.toLowerCase(); + var map, mapName, img, + nodeName = element.nodeName.toLowerCase(); if ( "area" === nodeName ) { - var map = element.parentNode, - mapName = map.name, - img; + map = element.parentNode; + mapName = map.name; if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { return false; } @@ -178,7 +178,7 @@ function focusable( element, isTabIndexNotNaN ) { } return ( /input|select|textarea|button|object/.test( nodeName ) ? !element.disabled : - "a" == nodeName ? + "a" === nodeName ? element.href || isTabIndexNotNaN : isTabIndexNotNaN) && // the element and all of its ancestors must be visible @@ -242,19 +242,21 @@ $.extend( $.ui, { // $.ui.plugin is deprecated. Use the proxy pattern instead. plugin: { add: function( module, option, set ) { - var proto = $.ui[ module ].prototype; - for ( var i in set ) { + var i, + proto = $.ui[ module ].prototype; + for ( i in set ) { proto.plugins[ i ] = proto.plugins[ i ] || []; proto.plugins[ i ].push( [ option, set[ i ] ] ); } }, call: function( instance, name, args ) { - var set = instance.plugins[ name ]; + var i, + set = instance.plugins[ name ]; if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) { return; } - for ( var i = 0; i < set.length; i++ ) { + for ( i = 0; i < set.length; i++ ) { if ( instance.options[ set[ i ][ 0 ] ] ) { set[ i ][ 1 ].apply( instance.element, args ); } diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 053b26ab8..3a9bd5dc6 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -201,13 +201,13 @@ $.widget("ui.dialog", { }, close: function( event ) { - if ( !this._isOpen ) { - return self; - } - var self = this, maxZ, thisZ; + if ( !this._isOpen ) { + return; + } + if ( false === self._trigger( "beforeClose", event ) ) { return; } @@ -292,7 +292,8 @@ $.widget("ui.dialog", { return; } - var self = this, + var hasFocus, + self = this, options = self.options, uiDialog = self.uiDialog; @@ -325,7 +326,7 @@ $.widget("ui.dialog", { // set focus to the first tabbable element in the content area or the first button // if there are no tabbable elements, set focus on the dialog itself - var hasFocus = self.element.find( ":tabbable" ); + hasFocus = self.element.find( ":tabbable" ); if ( !hasFocus.length ) { hasFocus = uiDialog.find( ".ui-dialog-buttonpane :tabbable" ); if ( !hasFocus.length ) { @@ -341,7 +342,8 @@ $.widget("ui.dialog", { }, _createButtons: function( buttons ) { - var self = this, + var uiDialogButtonPane, uiButtonSet, + self = this, hasButtons = false; // if we already have a button pane, remove it @@ -353,11 +355,11 @@ $.widget("ui.dialog", { }); } if ( hasButtons ) { - var uiDialogButtonPane = $( "

" ) - .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ), - uiButtonSet = $( "
" ) - .addClass( "ui-dialog-buttonset" ) - .appendTo( uiDialogButtonPane ); + uiDialogButtonPane = $( "
" ) + .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ); + uiButtonSet = $( "
" ) + .addClass( "ui-dialog-buttonset" ) + .appendTo( uiDialogButtonPane ); $.each( buttons, function( name, props ) { props = $.isFunction( props ) ? @@ -547,7 +549,8 @@ $.widget("ui.dialog", { }, _setOption: function( key, value ) { - var self = this, + var isDraggable, isResizable, + self = this, uiDialog = self.uiDialog; switch ( key ) { @@ -571,7 +574,7 @@ $.widget("ui.dialog", { } break; case "draggable": - var isDraggable = uiDialog.is( ":data(draggable)" ); + isDraggable = uiDialog.is( ":data(draggable)" ); if ( isDraggable && !value ) { uiDialog.draggable( "destroy" ); } @@ -585,7 +588,7 @@ $.widget("ui.dialog", { break; case "resizable": // currently resizable, becoming non-resizable - var isResizable = uiDialog.is( ":data(resizable)" ); + isResizable = uiDialog.is( ":data(resizable)" ); if ( isResizable && !value ) { uiDialog.resizable( "destroy" ); } @@ -614,9 +617,8 @@ $.widget("ui.dialog", { /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content * divs will both have width and height set, so we need to reset them */ - var options = this.options, - nonContentHeight, - minContentHeight, + var nonContentHeight, minContentHeight, autoHeight, + options = this.options, isVisible = this.uiDialog.is( ":visible" ); // reset content sizing @@ -648,7 +650,7 @@ $.widget("ui.dialog", { }); } else { this.uiDialog.show(); - var autoHeight = this.element.css( "height", "auto" ).height(); + autoHeight = this.element.css( "height", "auto" ).height(); if ( !isVisible ) { this.uiDialog.hide(); } @@ -740,7 +742,9 @@ $.extend( $.ui.dialog.overlay, { }, destroy: function( $el ) { - var indexOf = $.inArray( $el, this.instances ); + var indexOf = $.inArray( $el, this.instances ), + maxZ = 0; + if ( indexOf !== -1 ) { this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] ); } @@ -752,7 +756,6 @@ $.extend( $.ui.dialog.overlay, { $el.height( 0 ).width( 0 ).remove(); // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - var maxZ = 0; $.each( this.instances, function() { maxZ = Math.max( maxZ, this.css( "z-index" ) ); }); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 6d00f66ae..af22c19b0 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -85,9 +85,9 @@ $.widget( "ui.menu", { "mouseleave": "collapseAll", "mouseleave .ui-menu": "collapseAll", "focus": function( event ) { - var firstItem = this.element.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).eq( 0 ); + var menu = this.element, + firstItem = menu.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).eq( 0 ); if ( this._hasScroll() && !this.active ) { - var menu = this.element; menu.children().each( function() { var currentItem = $( this ); if ( currentItem.offset().top - menu.offset().top >= 0 ) { @@ -183,7 +183,7 @@ $.widget( "ui.menu", { character = String.fromCharCode( event.keyCode ), skip = false; - if (character == prev) { + if (character === prev) { skip = true; } else { character = prev + character; @@ -195,7 +195,7 @@ $.widget( "ui.menu", { return new RegExp("^" + escape(character), "i") .test( $( this ).children( "a" ).text() ); }); - match = skip && match.index(this.active.next()) != -1 ? this.active.nextAll(".ui-menu-item") : match; + match = skip && match.index(this.active.next()) !== -1 ? this.active.nextAll(".ui-menu-item") : match; if ( !match.length ) { character = String.fromCharCode(event.keyCode); match = this.activeMenu.children(".ui-menu-item").filter( function() { @@ -260,15 +260,18 @@ $.widget( "ui.menu", { refresh: function() { // initialize nested menus - var submenus = this.element.find( this.options.menus + ":not( .ui-menu )" ) - .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) - .attr( "role", "menu" ) - .hide() - .attr( "aria-hidden", "true" ) - .attr( "aria-expanded", "false" ); + var menuId, + submenus = this.element.find( this.options.menus + ":not( .ui-menu )" ) + .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) + .hide() + .attr({ + role: "menu", + "aria-hidden": "true", + "aria-expanded": "false" + }); // don't refresh list items that are already adapted - var menuId = this.menuId; + menuId = this.menuId; submenus.add( this.element ).children( ":not( .ui-menu-item ):has( a )" ) .addClass( "ui-menu-item" ) .attr( "role", "presentation" ) @@ -291,15 +294,16 @@ $.widget( "ui.menu", { }, focus: function( event, item ) { + var nested, borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; this.blur( event ); if ( this._hasScroll() ) { - var borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0, - paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0, - offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop, - scroll = this.activeMenu.scrollTop(), - elementHeight = this.activeMenu.height(), - itemHeight = item.height(); + borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0; + paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0; + offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; + scroll = this.activeMenu.scrollTop(); + elementHeight = this.activeMenu.height(); + itemHeight = item.height(); if ( offset < 0 ) { this.activeMenu.scrollTop( scroll + offset ); @@ -321,7 +325,7 @@ $.widget( "ui.menu", { this._close(); }, this.delay ); - var nested = $( "> .ui-menu", item ); + nested = $( "> .ui-menu", item ); if ( nested.length && ( /^mouse/.test( event.type ) ) ) { this._startOpening(nested); } @@ -368,7 +372,7 @@ $.widget( "ui.menu", { var position = $.extend({}, { of: this.active - }, $.type(this.options.position) == "function" ? + }, $.type(this.options.position) === "function" ? this.options.position(this.active) : this.options.position ); diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js index 53b3dcc20..eaa953ad0 100644 --- a/ui/jquery.ui.mouse.js +++ b/ui/jquery.ui.mouse.js @@ -61,10 +61,10 @@ $.widget("ui.mouse", { this._mouseDownEvent = event; var that = this, - btnIsLeft = (event.which == 1), + btnIsLeft = (event.which === 1), // event.target.nodeName works around a bug in IE 8 with // disabled inputs (#7620) - elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); + elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { return true; } @@ -134,7 +134,7 @@ $.widget("ui.mouse", { if (this._mouseStarted) { this._mouseStarted = false; - if (event.target == this._mouseDownEvent.target) { + if (event.target === this._mouseDownEvent.target) { $.data(event.target, this.widgetName + '.preventClickEvent', true); } diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js index 1504e5bca..68cccc554 100644 --- a/ui/jquery.ui.progressbar.js +++ b/ui/jquery.ui.progressbar.js @@ -85,8 +85,8 @@ $.widget( "ui.progressbar", { }, _refreshValue: function() { - var value = this.value(); - var percentage = this._percentage(); + var value = this.value(), + percentage = this._percentage(); if ( this.oldValue !== value ) { this.oldValue = value; diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index a8bdb1948..b355f8c7e 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -35,7 +35,8 @@ $.widget( "ui.slider", $.ui.mouse, { }, _create: function() { - var self = this, + var i, + self = this, o = this.options, existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), handle = "", @@ -78,7 +79,7 @@ $.widget( "ui.slider", $.ui.mouse, { ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); } - for ( var i = existingHandles.length; i < handleCount; i += 1 ) { + for ( i = existingHandles.length; i < handleCount; i++ ) { handles.push( handle ); } diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 45888220d..68c182c31 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -20,13 +20,13 @@ function getNextTabId() { return ++tabId; } -var isLocal = function( anchor ) { +function isLocal( anchor ) { // clone the node to work around IE 6 not normalizing the href property // if it's manually set, i.e., a.href = "#foo" kills the normalization anchor = anchor.cloneNode( false ); return anchor.hash.length > 1 && anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" ); -}; +} $.widget( "ui.tabs", { version: "@VERSION", @@ -44,7 +44,8 @@ $.widget( "ui.tabs", { }, _create: function() { - var that = this, + var panel, + that = this, options = that.options, active = options.active; @@ -110,7 +111,7 @@ $.widget( "ui.tabs", { // check for length avoids error when initializing empty list if ( options.active !== false && this.anchors.length ) { this.active = this._findActive( options.active ); - var panel = that._getPanelForTab( this.active ); + panel = that._getPanelForTab( this.active ); panel.show(); this.lis.eq( options.active ).addClass( "ui-tabs-active ui-state-active" ); @@ -128,7 +129,7 @@ $.widget( "ui.tabs", { }, _setOption: function( key, value ) { - if ( key == "active" ) { + if ( key === "active" ) { // _activate() will handle invalid values and update this.options this._activate( value ); return; @@ -166,7 +167,8 @@ $.widget( "ui.tabs", { }, refresh: function() { - var self = this, + var next, + self = this, options = this.options, lis = this.list.children( ":has(a[href])" ); @@ -187,7 +189,7 @@ $.widget( "ui.tabs", { // was active, but active tab is gone } else if ( this.active.length && !$.contains( this.list[ 0 ], this.active[ 0 ] ) ) { // activate previous tab - var next = options.active - 1; + next = options.active - 1; this._activate( next >= 0 ? next : 0 ); // was active, active tab still exists } else { @@ -224,7 +226,7 @@ $.widget( "ui.tabs", { this.panels = $( [] ); this.anchors.each(function( i, a ) { - var selector, panel; + var selector, panel, id; // inline tab if ( isLocal( a ) ) { @@ -232,7 +234,7 @@ $.widget( "ui.tabs", { panel = self.element.find( self._sanitizeSelector( selector ) ); // remote tab } else { - var id = self._tabId( a ); + id = self._tabId( a ); selector = "#" + id; panel = self.element.find( selector ); if ( !panel.length ) { @@ -433,7 +435,7 @@ $.widget( "ui.tabs", { _getIndex: function( index ) { // meta-function to give users option to provide a href string instead of a numerical index. // also sanitizes numerical indexes to valid values. - if ( typeof index == "string" ) { + if ( typeof index === "string" ) { index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); } @@ -747,7 +749,8 @@ if ( $.uiBackCompat !== false ) { index = this.anchors.length; } - var options = this.options, + var doInsertAfter, panel, + options = this.options, li = $( options.tabTemplate .replace( /#\{href\}/g, url ) .replace( /#\{label\}/g, label ) ), @@ -758,10 +761,10 @@ if ( $.uiBackCompat !== false ) { li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true ); li.find( "a" ).attr( "aria-controls", id ); - var doInsertAfter = index >= this.lis.length; + doInsertAfter = index >= this.lis.length; // try to find an existing element before creating a new one - var panel = this.element.find( "#" + id ); + panel = this.element.find( "#" + id ); if ( !panel.length ) { panel = this._createPanel( id ); if ( doInsertAfter ) { @@ -946,6 +949,8 @@ if ( $.uiBackCompat !== false ) { }); // cookie option + (function() { + var listId = 0; $.widget( "ui.tabs", $.ui.tabs, { @@ -993,6 +998,8 @@ if ( $.uiBackCompat !== false ) { } }); + })(); + // load event $.widget( "ui.tabs", $.ui.tabs, { _trigger: function( type, event, data ) { diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 46c5befaa..97895a6a8 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -159,7 +159,7 @@ $.widget( "ui.tooltip", { mouseleave: "close", focusout: "close", keyup: function( event ) { - if ( event.keyCode == $.ui.keyCode.ESCAPE ) { + if ( event.keyCode === $.ui.keyCode.ESCAPE ) { var fakeEvent = $.Event(event); fakeEvent.currentTarget = target[0]; this.close( fakeEvent, true ); diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 1b7405e28..3e3723398 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -9,9 +9,8 @@ */ (function( $, undefined ) { -var slice = Array.prototype.slice; - -var _cleanData = $.cleanData; +var slice = Array.prototype.slice, + _cleanData = $.cleanData; $.cleanData = function( elems ) { for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { try { @@ -73,11 +72,11 @@ $.widget = function( name, base, prototype ) { if ( $.isFunction( value ) ) { prototype[ prop ] = (function() { var _super = function() { - return base.prototype[ prop ].apply( this, arguments ); - }; - var _superApply = function( args ) { - return base.prototype[ prop ].apply( this, args ); - }; + return base.prototype[ prop ].apply( this, arguments ); + }, + _superApply = function( args ) { + return base.prototype[ prop ].apply( this, args ); + }; return function() { var __super = this._super, __superApply = this._superApply, @@ -163,7 +162,8 @@ $.widget.bridge = function( name, object ) { if ( isMethodCall ) { this.each(function() { - var instance = $.data( this, fullName ); + var methodValue, + instance = $.data( this, fullName ); if ( !instance ) { return $.error( "cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'" ); @@ -171,7 +171,7 @@ $.widget.bridge = function( name, object ) { if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { return $.error( "no such method '" + options + "' for " + name + " widget instance" ); } - var methodValue = instance[ options ].apply( instance, args ); + methodValue = instance[ options ].apply( instance, args ); if ( methodValue !== instance && methodValue !== undefined ) { returnValue = methodValue && methodValue.jquery ? returnValue.pushStack( methodValue.get() ) : -- cgit v1.2.3 From ea4345db06222225f47d2ef9af6121d34e6e497e Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 2 Apr 2012 22:20:18 -0400 Subject: Grunt: Removed newcap option from jshint task. --- grunt.js | 1 - 1 file changed, 1 deletion(-) diff --git a/grunt.js b/grunt.js index 1e8a197dc..74713be5d 100644 --- a/grunt.js +++ b/grunt.js @@ -285,7 +285,6 @@ grunt.initConfig({ eqeqeq: true, expr: true, latedef: true, - newcap: true, noarg: true, onevar: true, // TODO: limit to multi-line comments https://github.com/jshint/jshint/issues/503 -- cgit v1.2.3 From 0624c74929b60104cfcdd2463619e903fcfd0792 Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 2 Apr 2012 22:35:42 -0400 Subject: Effects core: Properly handle defaults for effects that are called with a single hash. --- ui/jquery.effects.core.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 1d56ae62f..626ab1a89 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -497,9 +497,10 @@ $.extend( $.effects, { // return an effect options object for the given parameters: function _normalizeArguments( effect, options, speed, callback ) { - // short path for passing an effect options object: + // allow passing all optinos as the first parameter if ( $.isPlainObject( effect ) ) { - return effect; + options = effect; + effect = effect.effect; } // convert to an object @@ -518,7 +519,7 @@ function _normalizeArguments( effect, options, speed, callback ) { } // catch (effect, speed, ?) - if ( $.type( options ) === "number" || $.fx.speeds[ options ]) { + if ( typeof options === "number" || $.fx.speeds[ options ] ) { callback = speed; speed = options; options = {}; -- cgit v1.2.3 From b2f8814d0a7c9321ecff421b3aaeb80cd49be0d6 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 3 Apr 2012 10:35:42 +0200 Subject: Tooltip: Remove old callout test page. Completely broken at this point, not worth fixing --- tests/visual/tooltip/callout.html | 213 -------------------------------------- 1 file changed, 213 deletions(-) delete mode 100644 tests/visual/tooltip/callout.html diff --git a/tests/visual/tooltip/callout.html b/tests/visual/tooltip/callout.html deleted file mode 100644 index af89157a2..000000000 --- a/tests/visual/tooltip/callout.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - Tooltip Visual Test: Default - - - - - - - - - - - - - -
- - -
- collision detection should kick in around here -
- - - -
- right aligned with custom position -
- -
- gets its content via ajax -
- -
- span -
- div - nested span -
-
- -
-
- - -
-
- - -
-
- -
This is the footnote, including other elements
- - - -
- - - - -- cgit v1.2.3 From 037db084f20d952558e4529a8b7394d562241a97 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 3 Apr 2012 10:49:34 +0200 Subject: Position: Extend main visual test page with simple 'arrow' callouts, as a starting pointing for a better collision notification API --- tests/visual/position/position.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/visual/position/position.html b/tests/visual/position/position.html index 9a9fb831e..b9b769d9b 100644 --- a/tests/visual/position/position.html +++ b/tests/visual/position/position.html @@ -24,9 +24,9 @@ collision: "none" }); $(this).next().menu().position({ - my: "left top", + my: "left top+20", at: "left bottom", - of: this + of: this, }); }); }).resize(); @@ -37,6 +37,22 @@ .ui-menu { width: 200px; } html, body { width: 99%; height: 99%; min-height:700px; min-width:700px; } #container { width: 95%; height: 95%; border: 1px solid black; margin: auto; } + .ui-menu:before { + font-size: 12pt; + content: "↑"; + position: absolute; + top: -22px; + left: 5px; + } + .ui-flipped-left:before { + left: auto; + right: 5px; + } + .ui-flipped-top:before { + content: "↓"; + top: auto; + bottom: -19px; + } -- cgit v1.2.3