diff options
30 files changed, 669 insertions, 576 deletions
diff --git a/.gitignore b/.gitignore index de4d1f007..a8b8bc7ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ dist node_modules +.sizecache.json
\ No newline at end of file @@ -5,7 +5,8 @@ Alexander Polomoshnov <alex.polomoshnov@gmail.com> Aliaksandr Rahalevich <saksmlz@gmail.com> Andrew Couch <andy@couchand.com> <acouch@bluewolf.com> Andrew Newcomb <ext.github@preceptsoftware.co.uk> -Andrew Powell <powella@gmail.com> <andrew@shellscape.org> +Andrew Powell <andrew@shellscape.org> <andrew@shellcape.org> +Andrew Powell <andrew@shellscape.org> <powella@gmail.com> Andrey Kapitcyn <ru.m157y@gmail.com> Ben Hollis <bhollis@amazon.com> <ben@benhollis.net> Benjamin Scott Boyle <benjamins.boyle@gmail.com> @@ -15,12 +16,15 @@ Christoph Rönsch <christoph.roensch@arcor.de> Corey Frang <gnarf37@gmail.com> <gnarf@gnarf.net> Courtland Allen <courtlandallen@gmail.com> Dan Streetman <ddstreet@ieee.org> +Danny Trunk <dtrunk90@gmail.com> <dtrunk90@googlemail.com> +David De Sloovere <david.desloovere@outlook.com> <david.desloovere@hotmail.com> +David Murdoch <david@davidmurdoch.com> <musicisair@yahoo.com> Diego Tres <diegotres@gmail.com> Dominique Vincent <dominique.vincent@toitl.com> Doug Blood <dougblood@gmail.com> Douglas Cerna <douglascerna@yahoo.com> <replaceafill@system76.(none)> -Douglas Neiner <doug@pixelgraphics.us> -Douglas Neiner <doug@pixelgraphics.us> <doug@Doug-Neiners-MacBook-Pro.local> +Douglas Neiner <doug@dougneiner.com> <doug@pixelgraphics.us> +Douglas Neiner <doug@dougneiner.com> <doug@Doug-Neiners-MacBook-Pro.local> Dylan Just <dev@ephox.com> Eddie Monge <eddie@eddiemonge.com> Edward A Faulkner <ef@alum.mit.edu> @@ -32,13 +36,16 @@ Filippo Cavallarin <filippo.cavallarin@codseq.it> <poplix@papuasia.org> Florian Gutmann <f.gutmann@chronimo.com> <blackfeet@gmx.at> Genie <386@mail.com> Guntupalli Karunakar <karunakarg@yahoo.com> +Heiko Henning <heiko@thehennings.ch> <h.henning@educa.ch> Hiroshi Tomita <tomykaira@gmail.com> Ian Simpson <spoonlikesham@gmail.com> Igor Milla <igor.fsp.milla@gmail.com> Israel Tsadok <itsadok@gmail.com> Jacek Jędrzejewski <jacek.jedrzejewski@gmail.com> Jamie Gegerson <git@jamiegegerson.com> +Jason Oster <jay@kodewerx.org> <jay@loyalize.com> Jay Merrifield <fracmak@gmail.com> <merrifieldj@pixia.com> +Jean-Francois Remy <jeff@melix.org> <jfremy@virtuoz.com> John Enters <github@darkdark.net> Jonathan Vingiano <jvingiano@gmail.com> Josh Varner <josh.varner@gmail.com> @@ -46,17 +53,22 @@ Justin Domnitz <jdomnitz@gmail.com> Justin MacCarthy <Justin@Rubystars.biz> Jörn Zaefferer <joern.zaefferer@gmail.com> Karl Kirch <karlkrch@gmail.com> <karl.ctr.kirch@faa.gov> +Keith Wood <kbwood@iinet.com.au> <kbwood.au@gmail.com> Kevin Dalman <development@allpro.net> -Klaus Hartl <klaus.hartl@googlemail.com> carhartl <klaus.hartl@stilbuero.de> +Klaus Hartl <klaus.hartl@gmail.com> <klaus.hartl@googlemail.com> +Klaus Hartl <klaus.hartl@gmail.com> <klaus.hartl@stilbuero.de> Kris Borchers <kris.borchers@gmail.com> Kris Borchers <kris.borchers@gmail.com> <k_borchers@yahoo.com> Krzysztof Rosiński <rozwell69@gmail.com> Lev Kitsis <spam4lev@gmail.com> -Maggie Costello Wachs <fg.maggie@gmail.com> maggiewachs <maggie@filamentgroup.com> +Maciej Mroziński <maciej.k.mrozinski@gmail.com> <mrozik87@gmail.com> +Maggie Wachs <maggie@filamentgroup.com> +Maggie Wachs <maggie@filamentgroup.com> <fg.maggie@gmail.com> Marc Neuwirth <marc.neuwirth@gmail.com> Marcos Sousa <falecomigo@marcossousa.com> <marcos.sousa@corp.globo.com> Martin Frost <martinf55@hotmail.com> Mathias Stenbom <mathias@stenbom.com> +Matt Hoskins <matt@nipltd.com> <furlined@cat-basket.org> Matthew Edward Hutton <meh@corefiling.co.uk> Max Schnur <max.schnur@gmail.com> Michael Hollis <hollis21@gmail.com> @@ -66,6 +78,7 @@ Mike Alsup <malsup@gmail.com> Milan Broum <midlis@googlemail.com> Mohamed Cherif Bouchelaghem <cherifbouchelaghem@yahoo.fr> <cherif@cherif.(none)> Nick Pierpoint <nick.pierpoint@tidalsand.com> +Paul Bakaus <paul.bakaus@gmail.com> <paul.bakaus@googlemail.com> Paul Irish <paul.irish@gmail.com> Pavol Hluchý <lopo@losys.sk> Peter Heiberg <peter@heiberg.se> @@ -78,6 +91,7 @@ Rick Waldron <waldron.rick@gmail.com> Ryan Neufeld <ryan@neufeldmail.com> Ryan Olton <oltonr@gmail.com> Saji Nediyanchath <saji89@gmail.com> Saji <saji@saji-laptop.(none)> +Scott Jehl <scottjehl@gmail.com> <scott@scottjehl.com> Sebastian Sauer <info@dynpages.de> Sergey Kartashov <ebishkek@yandex.ru> Shahyar Ghobadpour <shahyar@gmail.com> @@ -88,5 +102,7 @@ Stojce Slavkovski <stojce@gmail.com> Tarafder Ashek-E-Elahi <mail.ashek@gmail.com> Thibault Duplessis <thibault.duplessis@gmail.com> Ting Kuei <ting@kuei.com> +Todd Parker <todd@filamentgroup.com> <fg.todd@gmail.com> Wesley Walser <waw325@gmail.com> <wwalser@atlassian.com> Xavi Ramirez <xavi.rmz@gmail.com> +Ziling Zhao <zilingzhao@gmail.com> <zizhao@cisco.com> diff --git a/AUTHORS.txt b/AUTHORS.txt index b39a038c7..b346dd698 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -1,20 +1,20 @@ Authors ordered by first contribution A list of current team members is available at http://jqueryui.com/about -Paul Bakaus <paul.bakaus@googlemail.com> +Paul Bakaus <paul.bakaus@gmail.com> Richard Worth <rdworth@gmail.com> Yehuda Katz <wycats@gmail.com> Sean Catchpole <sean@sunsean.com> John Resig <jeresig@gmail.com> Tane Piper <piper.tane@gmail.com> Dmitri Gaskin <dmitrig01@gmail.com> -Klaus Hartl <klaus.hartl@googlemail.com> +Klaus Hartl <klaus.hartl@gmail.com> Stefan Petre <stefan.petre@gmail.com> Gilles van den Hoven <gilles@webunity.nl> Micheil Bryan Smith <micheil@brandedcode.com> Jörn Zaefferer <joern.zaefferer@gmail.com> Marc Grabanski <m@marcgrabanski.com> -Keith Wood <kbwood.au@gmail.com> +Keith Wood <kbwood@iinet.com.au> Brandon Aaron <brandon.aaron@gmail.com> Scott González <scott.gonzalez@gmail.com> Eduardo Lundgren <eduardolundgren@gmail.com> @@ -27,12 +27,12 @@ David Bolter <david.bolter@gmail.com> Chi Cheng <cloudream@gmail.com> Ca-Phun Ung <pazu2k@gmail.com> Ariel Flesler <aflesler@gmail.com> -Maggie Costello Wachs <fg.maggie@gmail.com> +Maggie Wachs <maggie@filamentgroup.com> Scott Jehl <scott@scottjehl.com> -Todd Parker <fg.todd@gmail.com> -Andrew Powell <powella@gmail.com> +Todd Parker <todd@filamentgroup.com> +Andrew Powell <andrew@shellscape.org> Brant Burnett <btburnett3@gmail.com> -Douglas Neiner <doug@pixelgraphics.us> +Douglas Neiner <doug@dougneiner.com> Paul Irish <paul.irish@gmail.com> Ralph Whitbeck <ralph.whitbeck@gmail.com> Thibault Duplessis <thibault.duplessis@gmail.com> @@ -79,10 +79,10 @@ Phillip Barnes <philbar@gmail.com> Kyle Wilkinson <kai@wikyd.org> Khaled AlHourani <me@khaledalhourani.com> Marian Rudzynski <mr@impaled.org> -Jean-Francois Remy <jfremy@virtuoz.com> -Doug Blood <dougblood@gmail.com> +Jean-Francois Remy <jeff@melix.org> +Doug Blood Filippo Cavallarin <filippo.cavallarin@codseq.it> -Heiko Henning <h.henning@educa.ch> +Heiko Henning <heiko@thehennings.ch> Aliaksandr Rahalevich <saksmlz@gmail.com> Mario Visic <mario@mariovisic.com> Xavi Ramirez <xavi.rmz@gmail.com> @@ -106,7 +106,7 @@ Adam Parod <mystic414@gmail.com> Guillaume Gautreau <guillaume+github@ghusse.com> Marcel Toele <EleotleCram@gmail.com> Dan Streetman <ddstreet@ieee.org> -Matt Hoskins <furlined@cat-basket.org> +Matt Hoskins <matt@nipltd.com> Giovanni Giacobbi <giovanni@giacobbi.net> Kyle Florence <kyle.florence@gmail.com> Pavol Hluchý <lopo@losys.sk> @@ -124,7 +124,7 @@ Israel Tsadok <itsadok@gmail.com> Carson McDonald <carson@ioncannon.net> Jason Davies <jason@jasondavies.com> Garrison Locke <gplocke@gmail.com> -David Murdoch <musicisair@yahoo.com> +David Murdoch <david@davidmurdoch.com> Benjamin Scott Boyle <benjamins.boyle@gmail.com> Jesse Baird <jebaird@gmail.com> Jonathan Vingiano <jvingiano@gmail.com> @@ -150,11 +150,10 @@ Marwan Al Jubeh <marwan.aljubeh@gmail.com> Milan Broum <midlis@googlemail.com> Sebastian Sauer <info@dynpages.de> Gaëtan Muller <m.gaetan89@gmail.com> -Michel Weimerskirch <michel@weimerskirch.net> William Griffiths <william@ycymro.com> Stojce Slavkovski <stojce@gmail.com> David Soms <david.soms@gmail.com> -David De Sloovere <david.desloovere@hotmail.com> +David De Sloovere <david.desloovere@outlook.com> Michael P. Jung <michael.jung@terreon.de> Shannon Pekary <spekary@gmail.com> Matthew Edward Hutton <meh@corefiling.co.uk> @@ -198,7 +197,7 @@ Lee Rowlands <lee.rowlands@previousnext.com.au> Timmy Willison <timmywillisn@gmail.com> Karl Swedberg <kswedberg@gmail.com> Baoju Yuan <the_guy_1987@hotmail.com> -Maciej Mroziński <mrozik87@gmail.com> +Maciej Mroziński <maciej.k.mrozinski@gmail.com> Luis Dalmolin <luis.nh@gmail.com> Mark Aaron Shirley <maspwr@gmail.com> Martin Hoch <martin@fidion.de> diff --git a/Gruntfile.js b/Gruntfile.js index 26e4a88b9..8c0a940bc 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -68,19 +68,6 @@ var } }, - minifyCSS = { - options: { - keepSpecialComments: 0 - }, - main: { - options: { - keepSpecialComments: "*" - }, - src: "dist/jquery-ui.css", - dest: "dist/jquery-ui.min.css" - } - }, - compareFiles = { all: [ "dist/jquery-ui.js", @@ -108,16 +95,6 @@ uiFiles.concat( allI18nFiles ).forEach(function( file ) { minify[ file ].files[ mapMinFile( file ) ] = file; }); -cssFiles.forEach(function( file ) { - minifyCSS[ file ] = { - options: { - banner: createBanner() - }, - src: file, - dest: "dist/" + file.replace( /\.css$/, ".min.css" ).replace( /themes\/base\//, "themes/base/minified/" ) - }; -}); - uiFiles.forEach(function( file ) { // TODO this doesn't do anything until https://github.com/rwldrn/grunt-compare-size/issues/13 compareFiles[ file ] = [ file, mapMinFile( file ) ]; @@ -129,7 +106,6 @@ grunt.loadNpmTasks( "grunt-contrib-uglify" ); grunt.loadNpmTasks( "grunt-contrib-concat" ); grunt.loadNpmTasks( "grunt-contrib-qunit" ); grunt.loadNpmTasks( "grunt-contrib-csslint" ); -grunt.loadNpmTasks( "grunt-contrib-cssmin" ); grunt.loadNpmTasks( "grunt-html" ); grunt.loadNpmTasks( "grunt-compare-size" ); grunt.loadNpmTasks( "grunt-git-authors" ); @@ -187,20 +163,12 @@ grunt.initConfig({ } }, uglify: minify, - cssmin: minifyCSS, htmllint: { // ignore files that contain invalid html, used only for ajax content testing all: grunt.file.expand( [ "demos/**/*.html", "tests/**/*.html" ] ).filter(function( file ) { return !/(?:ajax\/content\d\.html|tabs\/data\/test\.html|tests\/unit\/core\/core.*\.html)/.test( file ); }) }, - copy: { - dist_units_images: { - src: "themes/base/images/*", - strip: /^themes\/base\//, - dest: "dist/" - } - }, qunit: { files: expandFiles( "tests/unit/**/*.html" ).filter(function( file ) { // disabling everything that doesn't (quite) work with PhantomJS for now @@ -250,7 +218,4 @@ grunt.registerTask( "test", [ "qunit" ] ); grunt.registerTask( "sizer", [ "concat:ui", "uglify:main", "compare_size:all" ] ); grunt.registerTask( "sizer_all", [ "concat:ui", "uglify", "compare_size" ] ); -// "copy:dist_units_images" is used by unit tests -grunt.registerTask( "build", [ "concat", "uglify", "cssmin", "copy:dist_units_images" ] ); - }; diff --git a/build/tasks/build.js b/build/tasks/build.js index c50745899..cdc03bd60 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -2,21 +2,6 @@ module.exports = function( grunt ) { "use strict"; -var fs = require( "fs" ); - -function expandFiles( files ) { - return grunt.util._.pluck( grunt.file.expandMapping( files ), "src" ).filter(function(filepath) { - // restrict to files, exclude folders - try { - return fs.statSync( filepath[ 0 ] ).isFile(); - } catch(e) { - throw grunt.task.taskError(e.message, e); - } - }).map(function( values ) { - return values[ 0 ]; - }); -} - grunt.registerTask( "manifest", "Generate jquery.json manifest files", function() { var pkg = grunt.config( "pkg" ), base = { @@ -96,41 +81,6 @@ grunt.registerTask( "manifest", "Generate jquery.json manifest files", function( }); }); -grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() { - function replaceVersion( source ) { - return source.replace( /@VERSION/g, grunt.config( "pkg.version" ) ); - } - function copyFile( src, dest ) { - if ( /(js|css)$/.test( src ) ) { - grunt.file.copy( src, dest, { - process: replaceVersion - }); - } else { - grunt.file.copy( src, dest ); - } - } - var files = expandFiles( this.filesSrc ), - target = this.data.dest + "/", - strip = this.data.strip, - renameCount = 0, - fileName; - if ( typeof strip === "string" ) { - strip = new RegExp( "^" + grunt.template.process( strip, grunt.config() ).replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ) ); - } - files.forEach(function( fileName ) { - var targetFile = strip ? fileName.replace( strip, "" ) : fileName; - copyFile( fileName, target + targetFile ); - }); - grunt.log.writeln( "Copied " + files.length + " files." ); - for ( fileName in this.data.renames ) { - renameCount += 1; - copyFile( fileName, target + grunt.template.process( this.data.renames[ fileName ], grunt.config() ) ); - } - if ( renameCount ) { - grunt.log.writeln( "Renamed " + renameCount + " files." ); - } -}); - grunt.registerTask( "clean", function() { require( "rimraf" ).sync( "dist" ); }); diff --git a/build/tasks/testswarm.js b/build/tasks/testswarm.js index 16d213e4b..86a06a69d 100644 --- a/build/tasks/testswarm.js +++ b/build/tasks/testswarm.js @@ -42,12 +42,13 @@ function submit( commit, runs, configFile, extra, done ) { commitUrl = "https://github.com/jquery/jquery-ui/commit/" + commit; if ( extra ) { - extra = " " + extra; + extra = " (" + extra + ")"; } for ( testName in runs ) { runs[ testName ] = config.testUrl + commit + "/tests/unit/" + runs[ testName ]; } + testswarm.createClient({ url: config.swarmUrl, pollInterval: 10000, @@ -59,7 +60,7 @@ function submit( commit, runs, configFile, extra, done ) { token: config.authToken }) .addjob({ - name: "jQuery UI #<a href='" + commitUrl + "'>" + commit.substr( 0, 10 ) + "</a>" + extra, + name: "Commit <a href='" + commitUrl + "'>" + commit.substr( 0, 10 ) + "</a>" + extra, runs: runs, runMax: config.runMax, browserSets: config.browserSets diff --git a/demos/menu/default.html b/demos/menu/default.html index d44b18b35..5fc0971d9 100644 --- a/demos/menu/default.html +++ b/demos/menu/default.html @@ -22,42 +22,38 @@ <body> <ul id="menu"> - <li class="ui-state-disabled"><a href="#">Aberdeen</a></li> - <li><a href="#">Ada</a></li> - <li><a href="#">Adamsville</a></li> - <li><a href="#">Addyston</a></li> - <li> - <a href="#">Delphi</a> + <li class="ui-state-disabled">Aberdeen</li> + <li>Ada</li> + <li>Adamsville</li> + <li>Addyston</li> + <li>Delphi <ul> - <li class="ui-state-disabled"><a href="#">Ada</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li class="ui-state-disabled">Ada</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li><a href="#">Saarland</a></li> - <li> - <a href="#">Salzburg</a> + <li>Saarland</li> + <li>Salzburg <ul> - <li> - <a href="#">Delphi</a> + <li>Delphi <ul> - <li><a href="#">Ada</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li>Ada</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li> - <a href="#">Delphi</a> + <li>Delphi <ul> - <li><a href="#">Ada</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li>Ada</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li><a href="#">Perch</a></li> + <li>Perch</li> </ul> </li> - <li class="ui-state-disabled"><a href="#">Amesville</a></li> + <li class="ui-state-disabled">Amesville</li> </ul> <div class="demo-description"> diff --git a/package.json b/package.json index 4a9316612..1495a16c2 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,7 @@ "grunt-contrib-concat": "0.1.3", "grunt-contrib-qunit": "0.2.0", "grunt-contrib-csslint": "0.1.1", - "grunt-contrib-cssmin": "0.4.2", - "grunt-compare-size": "0.3.1", + "grunt-compare-size": "0.4.0-rc.3", "grunt-html": "0.3.3", "grunt-git-authors": "1.2.0", "rimraf": "2.1.4", diff --git a/tests/unit/autocomplete/autocomplete_core.js b/tests/unit/autocomplete/autocomplete_core.js index 03ebdfec9..a8b0a7330 100644 --- a/tests/unit/autocomplete/autocomplete_core.js +++ b/tests/unit/autocomplete/autocomplete_core.js @@ -16,7 +16,7 @@ test( "prevent form submit on enter when menu is active", function() { event = $.Event( "keydown" ); event.keyCode = $.ui.keyCode.DOWN; element.trigger( event ); - deepEqual( menu.find( ".ui-menu-item:has(.ui-state-focus)" ).length, 1, "menu item is active" ); + equal( menu.find( ".ui-menu-item.ui-state-focus" ).length, 1, "menu item is active" ); event = $.Event( "keydown" ); event.keyCode = $.ui.keyCode.ENTER; diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js index d60faf47e..e6f08785b 100644 --- a/tests/unit/autocomplete/autocomplete_options.js +++ b/tests/unit/autocomplete/autocomplete_options.js @@ -62,8 +62,7 @@ function autoFocusTest( afValue, focusedLength ) { open: function() { equal( element.autocomplete( "widget" ) - .children( ".ui-menu-item:first" ) - .find( ".ui-state-focus" ) + .children( ".ui-menu-item.ui-state-focus" ) .length, focusedLength, "first item is " + (afValue ? "" : "not") + " auto focused" ); diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index 60a7aa4d8..8918e8d36 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -144,8 +144,8 @@ test("moveToTop", function() { expect( 5 ); function order() { var actual = $( ".ui-dialog" ).map(function() { - return +$( this ).find( ".ui-dialog-content" ).attr( "id" ).replace( /\D+/, "" ); - }).get().reverse(); + return +$( this ).css( "z-index" ); + }).get(); deepEqual( actual, $.makeArray( arguments ) ); } var dialog1, dialog2, @@ -161,10 +161,23 @@ test("moveToTop", function() { equal( focusOn, "dialog2" ); } }); - order( 2, 1 ); + order( 100, 101 ); focusOn = "dialog1"; dialog1.dialog( "moveToTop" ); - order( 1, 2 ); + order( 102, 101 ); +}); + +test( "moveToTop: content scroll stays intact", function() { + expect( 2 ); + var otherDialog = $( "#dialog1" ).dialog(), + scrollDialog = $( "#form-dialog" ).dialog({ + height: 200 + }); + scrollDialog.scrollTop( 50 ); + equal( scrollDialog.scrollTop(), 50 ); + + otherDialog.dialog( "moveToTop" ); + equal( scrollDialog.scrollTop(), 50 ); }); test("open", function() { diff --git a/tests/unit/menu/menu.html b/tests/unit/menu/menu.html index ed376232e..a49c72a04 100644 --- a/tests/unit/menu/menu.html +++ b/tests/unit/menu/menu.html @@ -48,220 +48,254 @@ <div id="qunit-fixture"> <ul class="foo" id="menu1"> - <li class="foo"><a class="foo" href="#">Aberdeen</a></li> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Adamsville</a></li> - <li class="foo"><a id="testID1" class="foo" href="#">Addyston</a></li> - <li class="foo"><a class="foo" href="#">Adelphi</a></li> + <li class="foo">Aberdeen</li> + <li class="foo">Ada</li> + <li class="foo">Adamsville</li> + <li id="testID1" class="foo">Addyston</li> + <li class="foo">Adelphi</li> </ul> <ul id="menu2"> - <li class="foo"><a class="foo" href="#">Aberdeen</a></li> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Adamsville</a></li> - <li class="foo"><a class="foo" href="#"><span class="ui-icon ui-icon-print"></span>Addyston</a></li> - <li> - <a href="#">Delphi</a> + <li class="foo">Aberdeen</li> + <li class="foo">Ada</li> + <li class="foo">Adamsville</li> + <li class="foo"><span class="ui-icon ui-icon-print"></span>Addyston</li> + <li>Delphi <ul> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Saarland</a></li> - <li class="foo"><a class="foo" href="#">Salzburg</a></li> + <li class="foo">Ada</li> + <li class="foo">Saarland</li> + <li class="foo">Salzburg</li> </ul> </li> - <li class="foo"><a class="foo" href="#">Saarland</a></li> - <li> - <a href="#">Salzburg</a> + <li class="foo">Saarland</li> + <li>Salzburg <ul> - <li> - <a href="#">Delphi</a> + <li>Delphi <ul> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Saarland</a></li> - <li class="foo"><a class="foo" href="#">Salzburg</a></li> + <li class="foo">Ada</li> + <li class="foo">Saarland</li> + <li class="foo">Salzburg</li> </ul> </li> - <li> - <a href="#">Delphi</a> + <li>Delphi <ul> - <li class="foo"><a class="foo" href="#">Ada</a></li> + <li class="foo">Ada</li> <li> - </li> - <li class="foo"><a class="foo" href="#">Saarland</a></li> + <li class="foo">Saarland</li> <li></li> - <li class="foo"><a class="foo" href="#">Salzburg</a></li> + <li class="foo">Salzburg</li> <li>–</li> </ul> </li> - <li class="foo"><a class="foo" href="#">Perch</a></li> + <li class="foo">Perch</li> </ul> </li> </ul> <ul class="foo" id="menu3"> - <li class="foo"><a class="foo" href="#">Aberdeen</a></li> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Adamsville</a></li> - <li class="foo"><a class="foo" href="#">Addyston</a></li> - <li class="foo"><a class="foo" href="#">Adelphi</a></li> - <li class="foo"><a class="foo" href="#">Adena</a></li> - <li class="foo"><a class="foo" href="#">Adrian</a></li> - <li class="foo"><a class="foo" href="#">Akron</a></li> - <li class="foo"><a class="foo" href="#">Albany</a></li> - <li class="foo"><a class="foo" href="#">Alexandria</a></li> - <li class="foo"><a class="foo" href="#">Alger</a></li> - <li class="foo"><a class="foo" href="#">Alledonia</a></li> - <li class="foo"><a class="foo" href="#">Alliance</a></li> - <li class="foo"><a class="foo" href="#">Alpha</a></li> - <li class="foo"><a class="foo" href="#">Alvada</a></li> - <li class="foo"><a class="foo" href="#">Alvordton</a></li> - <li class="foo"><a class="foo" href="#">Amanda</a></li> - <li class="foo"><a class="foo" href="#">Amelia</a></li> - <li class="foo"><a class="foo" href="#">Amesville</a></li> - <li class="foo"><a class="foo" href="#">Aberdeen</a></li> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Adamsville</a></li> - <li class="foo"><a class="foo" href="#">Addyston</a></li> - <li class="foo"><a class="foo" href="#">Adelphi</a></li> - <li class="foo"><a class="foo" href="#">Adena</a></li> - <li class="foo"><a class="foo" href="#">Adrian</a></li> - <li class="foo"><a class="foo" href="#">Akron</a></li> - <li class="foo"><a class="foo" href="#">Albany</a></li> - <li class="foo"><a class="foo" href="#">Alexandria</a></li> - <li class="foo"><a class="foo" href="#">Alger</a></li> - <li class="foo"><a class="foo" href="#">Alledonia</a></li> - <li class="foo"><a class="foo" href="#">Alliance</a></li> - <li class="foo"><a class="foo" href="#">Alpha</a></li> - <li class="foo"><a class="foo" href="#">Alvada</a></li> - <li class="foo"><a class="foo" href="#">Alvordton</a></li> - <li class="foo"><a class="foo" href="#">Amanda</a></li> - <li class="foo"><a class="foo" href="#">Amelia</a></li> - <li class="foo"><a class="foo" href="#">Amesville</a></li> + <li class="foo">Aberdeen</li> + <li class="foo">Ada</li> + <li class="foo">Adamsville</li> + <li class="foo">Addyston</li> + <li class="foo">Adelphi</li> + <li class="foo">Adena</li> + <li class="foo">Adrian</li> + <li class="foo">Akron</li> + <li class="foo">Albany</li> + <li class="foo">Alexandria</li> + <li class="foo">Alger</li> + <li class="foo">Alledonia</li> + <li class="foo">Alliance</li> + <li class="foo">Alpha</li> + <li class="foo">Alvada</li> + <li class="foo">Alvordton</li> + <li class="foo">Amanda</li> + <li class="foo">Amelia</li> + <li class="foo">Amesville</li> + <li class="foo">Aberdeen</li> + <li class="foo">Ada</li> + <li class="foo">Adamsville</li> + <li class="foo">Addyston</li> + <li class="foo">Adelphi</li> + <li class="foo">Adena</li> + <li class="foo">Adrian</li> + <li class="foo">Akron</li> + <li class="foo">Albany</li> + <li class="foo">Alexandria</li> + <li class="foo">Alger</li> + <li class="foo">Alledonia</li> + <li class="foo">Alliance</li> + <li class="foo">Alpha</li> + <li class="foo">Alvada</li> + <li class="foo">Alvordton</li> + <li class="foo">Amanda</li> + <li class="foo">Amelia</li> + <li class="foo">Amesville</li> </ul> <ul class="foo" id="menu4"> - <li class="foo"><a class="foo" href="#">Aberdeen</a></li> + <li class="foo">Aberdeen</li> <li class="foo"> - <a class="foo" href="#">Ada</a> + Ada <ul class="foo"> - <li class="foo"><a class="foo" href="#">Aberdeen</a></li> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Adamsville</a></li> - <li class="foo"><a class="foo" href="#">Addyston</a></li> - <li class="foo"><a class="foo" href="#">Adelphi</a></li> - <li class="foo"><a class="foo" href="#">Adena</a></li> - <li class="foo"><a class="foo" href="#">Adrian</a></li> - <li class="foo"><a class="foo" href="#">Akron</a></li> - <li class="foo"><a class="foo" href="#">Albany</a></li> - <li class="foo"><a class="foo" href="#">Alexandria</a></li> - <li class="foo"><a class="foo" href="#">Alger</a></li> - <li class="foo"><a class="foo" href="#">Alledonia</a></li> - <li class="foo"><a class="foo" href="#">Alliance</a></li> - <li class="foo"><a class="foo" href="#">Alpha</a></li> - <li class="foo"><a class="foo" href="#">Alvada</a></li> - <li class="foo"><a class="foo" href="#">Alvordton</a></li> - <li class="foo"><a class="foo" href="#">Amanda</a></li> - <li class="foo"><a class="foo" href="#">Amelia</a></li> - <li class="foo"><a class="foo" href="#">Amesville</a></li> - <li class="foo"><a class="foo" href="#">Aberdeen</a></li> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Adamsville</a></li> - <li class="foo"><a class="foo" href="#">Addyston</a></li> - <li class="foo"><a class="foo" href="#">Adelphi</a></li> - <li class="foo"><a class="foo" href="#">Adena</a></li> - <li class="foo"><a class="foo" href="#">Adrian</a></li> - <li class="foo"><a class="foo" href="#">Akron</a></li> - <li class="foo"><a class="foo" href="#">Albany</a></li> + <li class="foo">Aberdeen</li> + <li class="foo">Ada</li> + <li class="foo">Adamsville</li> + <li class="foo">Addyston</li> + <li class="foo">Adelphi</li> + <li class="foo">Adena</li> + <li class="foo">Adrian</li> + <li class="foo">Akron</li> + <li class="foo">Albany</li> + <li class="foo">Alexandria</li> + <li class="foo">Alger</li> + <li class="foo">Alledonia</li> + <li class="foo">Alliance</li> + <li class="foo">Alpha</li> + <li class="foo">Alvada</li> + <li class="foo">Alvordton</li> + <li class="foo">Amanda</li> + <li class="foo">Amelia</li> + <li class="foo">Amesville</li> + <li class="foo">Aberdeen</li> + <li class="foo">Ada</li> + <li class="foo">Adamsville</li> + <li class="foo">Addyston</li> + <li class="foo">Adelphi</li> + <li class="foo">Adena</li> + <li class="foo">Adrian</li> + <li class="foo">Akron</li> + <li class="foo">Albany</li> </ul> </li> - <li class="foo"><a class="foo" href="#">Adamsville</a></li> - <li class="foo"><a class="foo" href="#">Addyston</a></li> - <li class="foo"><a class="foo" href="#">Adelphi</a></li> - <li class="foo"><a class="foo" href="#">Adena</a></li> - <li class="foo"><a class="foo" href="#">Adrian</a></li> - <li class="foo"><a class="foo" href="#">Akron</a></li> - <li class="foo"><a class="foo" href="#">Albany</a></li> - <li class="foo"><a class="foo" href="#">Alexandria</a></li> - <li class="foo"><a class="foo" href="#">Alger</a></li> - <li class="foo"><a class="foo" href="#">Alledonia</a></li> - <li class="foo"><a class="foo" href="#">Alliance</a></li> - <li class="foo"><a class="foo" href="#">Alpha</a></li> - <li class="foo"><a class="foo" href="#">Alvada</a></li> - <li class="foo"><a class="foo" href="#">Alvordton</a></li> - <li class="foo"><a class="foo" href="#">Amanda</a></li> - <li class="foo"><a class="foo" href="#">Amelia</a></li> - <li class="foo"><a class="foo" href="#">Amesville</a></li> - <li class="foo"><a class="foo" href="#">Aberdeen</a></li> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Adamsville</a></li> - <li class="foo"><a class="foo" href="#">Addyston</a></li> - <li class="foo"><a class="foo" href="#">Adelphi</a></li> - <li class="foo"><a class="foo" href="#">Adena</a></li> - <li class="foo"><a class="foo" href="#">Adrian</a></li> - <li class="foo"><a class="foo" href="#">Akron</a></li> - <li class="foo"><a class="foo" href="#">Albany</a></li> - <li class="foo"><a class="foo" href="#">Alexandria</a></li> - <li class="foo"><a class="foo" href="#">Alger</a></li> - <li class="foo"><a class="foo" href="#">Alledonia</a></li> - <li class="foo"><a class="foo" href="#">Alliance</a></li> - <li class="foo"><a class="foo" href="#">Alpha</a></li> - <li class="foo"><a class="foo" href="#">Alvada</a></li> - <li class="foo"><a class="foo" href="#">Alvordton</a></li> - <li class="foo"><a class="foo" href="#">Amanda</a></li> - <li class="foo"><a class="foo" href="#">Amelia</a></li> - <li class="foo"><a class="foo" href="#">Amesville</a></li> + <li class="foo">Adamsville</li> + <li class="foo">Addyston</li> + <li class="foo">Adelphi</li> + <li class="foo">Adena</li> + <li class="foo">Adrian</li> + <li class="foo">Akron</li> + <li class="foo">Albany</li> + <li class="foo">Alexandria</li> + <li class="foo">Alger</li> + <li class="foo">Alledonia</li> + <li class="foo">Alliance</li> + <li class="foo">Alpha</li> + <li class="foo">Alvada</li> + <li class="foo">Alvordton</li> + <li class="foo">Amanda</li> + <li class="foo">Amelia</li> + <li class="foo">Amesville</li> + <li class="foo">Aberdeen</li> + <li class="foo">Ada</li> + <li class="foo">Adamsville</li> + <li class="foo">Addyston</li> + <li class="foo">Adelphi</li> + <li class="foo">Adena</li> + <li class="foo">Adrian</li> + <li class="foo">Akron</li> + <li class="foo">Albany</li> + <li class="foo">Alexandria</li> + <li class="foo">Alger</li> + <li class="foo">Alledonia</li> + <li class="foo">Alliance</li> + <li class="foo">Alpha</li> + <li class="foo">Alvada</li> + <li class="foo">Alvordton</li> + <li class="foo">Amanda</li> + <li class="foo">Amelia</li> + <li class="foo">Amesville</li> </ul> <div id="menu5"> - <blockquote><a href="#">Aberdeen</a></blockquote> - <blockquote><a href="#">Ada</a></blockquote> - <blockquote><a href="#">Adamsville</a></blockquote> - <blockquote><a href="#">Addyston</a></blockquote> - <blockquote> - <a href="#">Delphi</a> + <blockquote>Aberdeen</blockquote> + <blockquote>Ada</blockquote> + <blockquote>Adamsville</blockquote> + <blockquote>Addyston</blockquote> + <blockquote>Delphi <div> - <blockquote><a href="#">Ada</a></blockquote> - <blockquote><a href="#">Saarland</a></blockquote> - <blockquote><a href="#">Salzburg</a></blockquote> + <blockquote>Ada</blockquote> + <blockquote>Saarland</blockquote> + <blockquote>Salzburg</blockquote> </div> </blockquote> - <blockquote><a href="#">Saarland</a></blockquote> - <blockquote> - <a href="#">Salzburg</a> + <blockquote>Saarland</blockquote> + <blockquote>Salzburg <div> - <blockquote> - <a href="#">Delphi</a> + <blockquote>Delphi <div> - <blockquote><a href="#">Ada</a></blockquote> - <blockquote><a id="testID2" href="#">Saarland</a></blockquote> - <blockquote><a href="#">Salzburg</a></blockquote> + <blockquote>Ada</blockquote> + <blockquote id="testID2">Saarland</blockquote> + <blockquote>Salzburg</blockquote> </div> </blockquote> - <blockquote> - <a href="#">Delphi</a> + <blockquote>Delphi <div> - <blockquote><a href="#">Ada</a></blockquote> - <blockquote><a href="#">Saarland</a></blockquote> - <blockquote><a href="#">Salzburg</a></blockquote> + <blockquote>Ada</blockquote> + <blockquote>Saarland</blockquote> + <blockquote>Salzburg</blockquote> </div> </blockquote> - <blockquote><a href="#">Perch</a></blockquote> + <blockquote>Perch</blockquote> </div> </blockquote> </div> <ul id="menu6"> - <li class="foo"><a class="foo" href="#">Aberdeen</a></li> - <li class="foo ui-state-disabled"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Adamsville</a></li> - <li class="foo"><a class="foo" href="#">Addyston</a></li> - <li class="ui-state-disabled"> - <a id="testID3" href="#">Delphi</a> + <li class="foo">Aberdeen</li> + <li class="foo ui-state-disabled">Ada</li> + <li class="foo">Adamsville</li> + <li class="foo">Addyston</li> + <li id="testID3" class="ui-state-disabled">Delphi <ul> - <li class="foo"><a class="foo" href="#">Ada</a></li> - <li class="foo"><a class="foo" href="#">Saarland</a></li> - <li class="foo"><a class="foo" href="#">Salzburg</a></li> + <li class="foo">Ada</li> + <li class="foo">Saarland</li> + <li class="foo">Salzburg</li> </ul> </li> - <li class="foo"><a class="foo" href="#">Saarland</a></li> + <li class="foo">Saarland</li> +</ul> + +<ul id="menu7"> + <li class="ui-menu-group"><strong>Group 1</strong></li> + <li>Aberdeen</li> + <li>Ada</li> + <li>Adamsville</li> + <li>Addyston</li> + <li></li> + <li class="ui-menu-group"><strong>Group 2</strong></li> + <li>Delphi + <ul> + <li>Ada</li> + <li>Saarland</li> + <li>Salzburg</li> + </ul> + </li> + <li>Saarland</li> + <li>---</li> + <li class="ui-menu-group"><strong>Group 3</strong></li> + <li>Salzburg + <ul> + <li>Delphi + <ul> + <li>Ada</li> + <li> - </li> + <li>Saarland</li> + <li>—</li> + <li>Salzburg</li> + <li>–</li> + </ul> + </li> + <li>Delphi + <ul> + <li>Ada</li> + <li>Saarland</li> + <li>Salzburg</li> + </ul> + </li> + <li>Perch</li> + </ul> + </li> + <li>Amesville</li> </ul> </div> diff --git a/tests/unit/menu/menu_common.js b/tests/unit/menu/menu_common.js index 4a89a947a..2404ebe02 100644 --- a/tests/unit/menu/menu_common.js +++ b/tests/unit/menu/menu_common.js @@ -4,6 +4,7 @@ TestHelpers.commonWidgetTests( "menu", { icons: { submenu: "ui-icon-carat-1-e" }, + items: "> *", menus: "ul", position: { my: "left top", diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js index 5ee28c14a..923d2961e 100644 --- a/tests/unit/menu/menu_core.js +++ b/tests/unit/menu/menu_core.js @@ -27,4 +27,22 @@ test( "accessibility", function () { // Item roles are tested in the role option tests }); +asyncTest( "#9044: Autofocus issue with dialog opened from menu widget", function() { + expect( 1 ); + var element = $( "#menu1" ).menu(); + + $( "<input>", { id: "test9044" } ).appendTo( "body" ); + + $( "#testID1" ).bind( "click", function() { + $( "#test9044" ).focus(); + }); + + TestHelpers.menu.click( element, "3" ); + setTimeout( function() { + equal( document.activeElement.id, "test9044", "Focus was swallowed by menu" ); + $( "#test9044" ).remove(); + start(); + }); +}); + })( jQuery ); diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js index 405300c46..0b89b86ac 100644 --- a/tests/unit/menu/menu_events.js +++ b/tests/unit/menu/menu_events.js @@ -91,7 +91,7 @@ asyncTest( "handle focus of menu with active item", function() { expect( 1 ); var element = $( "#menu1" ).menu({ focus: function( event ) { - log( $( event.target ).find( ".ui-state-focus" ).parent().index() ); + log( $( event.target ).find( ".ui-state-focus" ).index() ); } }); @@ -177,7 +177,7 @@ asyncTest( "handle keyboard navigation on menu without scroll and without submen log( $( ui.item[ 0 ] ).text() ); }, focus: function( event ) { - log( $( event.target ).find( ".ui-state-focus" ).parent().index() ); + log( $( event.target ).find( ".ui-state-focus" ).index() ); } }); @@ -243,7 +243,7 @@ asyncTest( "handle keyboard navigation on menu without scroll and with submenus" log( $( ui.item[0] ).text() ); }, focus: function( event ) { - log( $( event.target ).find( ".ui-state-focus" ).parent().index() ); + log( $( event.target ).find( ".ui-state-focus" ).index() ); } }); @@ -341,7 +341,7 @@ asyncTest( "handle keyboard navigation on menu without scroll and with submenus" element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equal( logOutput(), "keydown,5,6,0,1,0,2,4,0", "Keydown skip dividers and items without anchors" ); + equal( logOutput(), "keydown,5,6,0,1,0,2,4,0", "Keydown skip dividers" ); log( "keydown", true ); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); @@ -363,7 +363,7 @@ asyncTest( "handle keyboard navigation on menu with scroll and without submenus" log( $( ui.item[ 0 ] ).text() ); }, focus: function( event ) { - log( $( event.target ).find( ".ui-state-focus" ).parent().index()); + log( $( event.target ).find( ".ui-state-focus" ).index()); } }); @@ -438,7 +438,7 @@ asyncTest( "handle keyboard navigation on menu with scroll and with submenus", f log( $( ui.item[ 0 ] ).text() ); }, focus: function( event ) { - log( $( event.target ).find( ".ui-state-focus" ).parent().index()); + log( $( event.target ).find( ".ui-state-focus" ).index()); } }); @@ -533,7 +533,7 @@ asyncTest( "handle keyboard navigation and mouse click on menu with disabled ite log( $( ui.item[0] ).text() ); }, focus: function( event ) { - log( $( event.target ).find( ".ui-state-focus" ).parent().index()); + log( $( event.target ).find( ".ui-state-focus" ).index()); } }); @@ -577,11 +577,42 @@ asyncTest( "handle keyboard navigation and mouse click on menu with disabled ite } }); +asyncTest( "handle keyboard navigation and mouse click on menu with dividers and group labels", function() { + expect( 2 ); + var element = $( "#menu7" ).menu({ + items: "> :not('.ui-menu-group')", + select: function( event, ui ) { + log( $( ui.item[0] ).text() ); + }, + focus: function( event ) { + log( $( event.target ).find( ".ui-state-focus" ).index()); + } + }); + + log( "keydown", true ); + element.one( "menufocus", function() { + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); + equal( logOutput(), "keydown,2,Ada", "Keydown skips initial group label" ); + setTimeout( menukeyboard1, 50 ); + }); + element.focus(); + + function menukeyboard1() { + log( "keydown", true ); + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + equal( logOutput(), "keydown,3,4,7", "Keydown focus skips divider and group label" ); + start(); + } +}); + asyncTest( "handle keyboard navigation with spelling of menu items", function() { expect( 2 ); var element = $( "#menu2" ).menu({ focus: function( event ) { - log( $( event.target ).find( ".ui-state-focus" ).parent().index() ); + log( $( event.target ).find( ".ui-state-focus" ).index() ); } }); diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js index 51d772972..5a633998d 100644 --- a/tests/unit/menu/menu_methods.js +++ b/tests/unit/menu/menu_methods.js @@ -73,11 +73,11 @@ test( "refresh icons (see #9377)", function() { expect( 3 ); var element = $( "#menu1" ).menu(); ok( !element.hasClass( "ui-menu-icons") ); - element.find( "li:first a" ).html( "<span class='ui-icon ui-icon-disk'></span>Save</a>" ); + element.find( "li:first" ).html( "<span class='ui-icon ui-icon-disk'></span>Save</a>" ); element.menu( "refresh" ); ok( element.hasClass( "ui-menu-icons" ) ); - element.find( "li:first a" ).html( "Save" ); + element.find( "li:first" ).html( "Save" ); element.menu( "refresh" ); ok( !element.hasClass( "ui-menu-icons" ) ); }); diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js index 27cea67a4..527cc4784 100644 --- a/tests/unit/menu/menu_options.js +++ b/tests/unit/menu/menu_options.js @@ -66,15 +66,14 @@ test( "{ icons: { submenu: 'custom' } }", function() { test( "{ role: 'menu' } ", function() { var element = $( "#menu1" ).menu(), items = element.find( "li" ); - expect( 2 + 5 * items.length ); + expect( 2 + 4 * items.length ); equal( element.attr( "role" ), "menu" ); ok( items.length > 0, "number of menu items" ); items.each(function( item ) { ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" ); - equal( $( this ).attr( "role" ), "presentation", "menu item ("+ item + ") role" ); - equal( $( "a", this ).attr( "role" ), "menuitem", "menu item ("+ item + ") role" ); - ok( $( "a", this ).hasClass( "ui-corner-all" ), "a element class for menu item ("+ item + ")" ); - equal( $( "a", this ).attr( "tabindex" ), "-1", "a element tabindex for menu item ("+ item + ")" ); + equal( $( this ).attr( "role" ), "menuitem", "menu item ("+ item + ") role" ); + ok( $( this ).hasClass( "ui-corner-all" ), "class for menu item ("+ item + ")" ); + equal( $( this ).attr( "tabindex" ), "-1", "tabindex for menu item ("+ item + ")" ); }); }); @@ -83,15 +82,14 @@ test( "{ role: 'listbox' } ", function() { role: "listbox" }), items = element.find( "li" ); - expect( 2 + 5 * items.length ); + expect( 2 + 4 * items.length ); equal( element.attr( "role" ), "listbox" ); ok( items.length > 0, "number of menu items" ); items.each(function( item ) { ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" ); - equal( $( this ).attr( "role" ), "presentation", "menu item ("+ item + ") role" ); - equal( $( "a", this ).attr( "role" ), "option", "menu item ("+ item + ") role" ); - ok( $( "a", this ).hasClass( "ui-corner-all" ), "a element class for menu item ("+ item + ")" ); - equal( $( "a", this ).attr( "tabindex" ), "-1", "a element tabindex for menu item ("+ item + ")" ); + equal( $( this ).attr( "role" ), "option", "menu item ("+ item + ") role" ); + ok( $( this ).hasClass( "ui-corner-all" ), "class for menu item ("+ item + ")" ); + equal( $( this ).attr( "tabindex" ), "-1", "tabindex for menu item ("+ item + ")" ); }); }); @@ -100,15 +98,14 @@ test( "{ role: null }", function() { role: null }), items = element.find( "li" ); - expect( 2 + 5 * items.length ); + expect( 2 + 4 * items.length ); strictEqual( element.attr( "role" ), undefined ); ok( items.length > 0, "number of menu items" ); items.each(function( item ) { ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" ); - equal( $( this ).attr( "role" ), "presentation", "menu item ("+ item + ") role" ); - equal( $( "a", this ).attr( "role" ), undefined, "menu item ("+ item + ") role" ); - ok( $( "a", this ).hasClass( "ui-corner-all" ), "a element class for menu item ("+ item + ")" ); - equal( $( "a", this ).attr( "tabindex" ), "-1", "a element tabindex for menu item ("+ item + ")" ); + equal( $( this ).attr( "role" ), undefined, "menu item ("+ item + ") role" ); + ok( $( this ).hasClass( "ui-corner-all" ), "class for menu item ("+ item + ")" ); + equal( $( this ).attr( "tabindex" ), "-1", "tabindex for menu item ("+ item + ")" ); }); }); diff --git a/tests/unit/menu/menu_test_helpers.js b/tests/unit/menu/menu_test_helpers.js index b6c09ad7a..77737c390 100644 --- a/tests/unit/menu/menu_test_helpers.js +++ b/tests/unit/menu/menu_test_helpers.js @@ -24,7 +24,7 @@ TestHelpers.menu = { click: function( menu, item ) { lastItem = item; - menu.children( ":eq(" + item + ")" ).find( "a:first" ).trigger( "click" ); + menu.children( ":eq(" + item + ")" ).trigger( "click" ); } }; diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index cef24e93b..83d69d2d9 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -27,11 +27,15 @@ QUnit.reset = function() { QUnit.config.requireExpects = true; +/* +// TODO: Add back the ability to test against minified files +// see QUnit.urlParams.min usage below QUnit.config.urlConfig.push({ id: "min", label: "Minified source", tooltip: "Load minified source files instead of the regular unminified ones." }); +*/ TestHelpers.loadResources = QUnit.urlParams.min ? function() { diff --git a/tests/visual/dialog/stacking.html b/tests/visual/dialog/stacking.html new file mode 100644 index 000000000..dcb7de280 --- /dev/null +++ b/tests/visual/dialog/stacking.html @@ -0,0 +1,62 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>Dialog Visual Test</title> + <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css"> + <script src="../../../jquery-1.10.2.js"></script> + <script src="../../../ui/jquery.ui.core.js"></script> + <script src="../../../ui/jquery.ui.widget.js"></script> + <script src="../../../ui/jquery.ui.mouse.js"></script> + <script src="../../../ui/jquery.ui.draggable.js"></script> + <script src="../../../ui/jquery.ui.position.js"></script> + <script src="../../../ui/jquery.ui.resizable.js"></script> + <script src="../../../ui/jquery.ui.button.js"></script> + <script src="../../../ui/jquery.ui.dialog.js"></script> + + <style> + body { + font-size: 62.5%; + } + </style> + <script> + $(function() { + var iframeDialog = $( "#dialog-iframe" ).dialog({ + position: { + my: "right-90 center" + }, + height: 400 + }), + + scrollingDialog = $( "#dialog-scrolling" ).dialog({ + maxHeight: 200, + position: { + my: "left+90 center" + } + }), + + otherDialog = $( "#dialog-other" ).dialog({ + width: 200, + height: 150 + }); + }); + </script> +</head> +<body> + +<p>WHAT: Two dialogs, one embedding an iframe, one having just scrollable content.</p> +<p>EXPECTED: When focusing on one or the other dialog, it shouldn't affect how the content is displayed on the other dialog. It shouldn't reload the iframe or reset the scroll.</p> + + +<div id="dialog-iframe" title="Dialog that embeds an iframe"> + <iframe src="animated.html" height="400"></iframe> +</div> + +<div id="dialog-scrolling" title="Dialog with scroll"> + <p style="height:600px;background:#eee">a bunch of content</p> +</div> + +<div id="dialog-other" title="placeholder">Just another dialog to test stacking</div> + +</body> +</html> diff --git a/tests/visual/index.html b/tests/visual/index.html index 730eb4553..bb46137f4 100644 --- a/tests/visual/index.html +++ b/tests/visual/index.html @@ -33,7 +33,11 @@ <h2>Dialog</h2> <ul> + <li><a href="dialog/animated.html">Animations</a></li> + <li><a href="dialog/complex-dialogs.html">Nested dialogs</a></li> + <li><a href="dialog/form.html">Forms in dialogs</a></li> <li><a href="dialog/performance.html">Performance</a></li> + <li><a href="dialog/stacking.html">Overlapping dialogs</a></li> </ul> <h2>Effects</h2> diff --git a/tests/visual/menu/menu.html b/tests/visual/menu/menu.html index 3d4e81e92..1c203ef12 100644 --- a/tests/visual/menu/menu.html +++ b/tests/visual/menu/menu.html @@ -15,7 +15,7 @@ $( "<p>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" ); } - $( "#menu1, #menu2, #menu3, .menu4, #menu7" ).menu({ + $( "#menu1, #menu2, #menu3, .menu4" ).menu({ select: logger }); @@ -29,6 +29,11 @@ select: logger, icon: "ui-icon-carat-1-s" }); + + $( "#menu7" ).menu({ + items: "> :not('.ui-menu-group')", + select: logger + }); }); </script> <style> @@ -44,171 +49,161 @@ <h2>Default inline menu</h2> <ul id="menu1"> - <li><a href="#">Aberdeen</a></li> - <li><a href="#">Ada</a></li> - <li><a href="#">Adamsville</a></li> - <li><a href="#">Addyston</a></li> - <li><a href="#">Delphi</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li>Aberdeen</li> + <li>Ada</li> + <li>Adamsville</li> + <li>Addyston</li> + <li>Delphi</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> <h2>Inline with disabled items and submenus</h2> <ul id="menu2"> - <li class="ui-state-disabled"><a href="#">Aberdeen</a></li> - <li><a href="#">Ada</a></li> - <li><a href="#">Adamsville</a></li> - <li><a href="#">Addyston</a></li> - <li> - <a href="#">Delphi</a> + <li class="ui-state-disabled">Aberdeen</li> + <li>Ada</li> + <li>Adamsville</li> + <li>Addyston</li> + <li>Delphi <ul> - <li class="ui-state-disabled"><a href="#">Ada</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li class="ui-state-disabled">Ada</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li><a href="#">Saarland</a></li> - <li> - <a href="#">Salzburg</a> + <li>Saarland</li> + <li>Salzburg <ul> - <li> - <a href="#">Delphi</a> + <li>Delphi <ul> - <li><a href="#">Ada</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li>Ada</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li> - <a href="#">Delphi</a> + <li>Delphi <ul> - <li><a href="#">Ada</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li>Ada</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li><a href="#">Perch</a></li> + <li>Perch</li> </ul> </li> - <li class="ui-state-disabled"><a href="#">Amesville</a></li> + <li class="ui-state-disabled">Amesville</li> </ul> <h2>Menu with icons</h2> <ul id="menu3"> - <li><a href="#"><span class="ui-icon ui-icon-print"></span>Aberdeen</a></li> - <li class="ui-state-disabled"><a href="#"><span class="ui-icon ui-icon-scissors"></span>Ada</a></li> - <li><a href="#">Adamsville</a></li> - <li><a href="#"><span class="ui-icon ui-icon-wrench"></span>Addyston</a></li> - <li class="ui-state-disabled"> - <a href="#">Delphi</a> + <li><span class="ui-icon ui-icon-print"></span>Aberdeen</li> + <li class="ui-state-disabled"><span class="ui-icon ui-icon-scissors"></span>Ada</li> + <li>Adamsville</li> + <li><span class="ui-icon ui-icon-wrench"></span>Addyston</li> + <li class="ui-state-disabled">Delphi <ul> - <li><a href="#">Ada</a></li> - <li><a href="#"><span class="ui-icon ui-icon-wrench"></span>Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li>Ada</li> + <li><span class="ui-icon ui-icon-wrench"></span>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li><a href="#">Saarland</a></li> + <li>Saarland</li> <li> - <a href="#"><span class="ui-icon ui-icon-print"></span>Salzburg</a> + <span class="ui-icon ui-icon-print"></span>Salzburg <ul> <li> - <a href="#"><span class="ui-icon ui-icon-wrench"></span>Delphi</a> + <span class="ui-icon ui-icon-wrench"></span>Delphi <ul> - <li><a href="#">Ada</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li>Ada</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li> - <a href="#">Delphi</a> + <li>Delphi <ul> - <li><a href="#"><span class="ui-icon ui-icon-wrench"></span>Ada</a></li> - <li><a href="#"><span class="ui-icon ui-icon-wrench"></span>Saarland</a></li> - <li><a href="#"><span class="ui-icon ui-icon-wrench"></span>Salzburg</a></li> + <li><span class="ui-icon ui-icon-wrench"></span>Ada</li> + <li><span class="ui-icon ui-icon-wrench"></span>Saarland</li> + <li><span class="ui-icon ui-icon-wrench"></span>Salzburg</li> </ul> </li> - <li><a href="#">Perch</a></li> + <li>Perch</li> </ul> </li> </ul> <h2>Long menu with scroll overflow, to test menu's scroll-on-keypress behaviour</h2> <ul class="menu4"> - <li><a href="#">Aberdeen</a></li> - <li><a href="#">Ada</a></li> - <li><a href="#">Adamsville</a></li> - <li><a href="#">Addyston</a></li> - <li><a href="#">Adelphi</a></li> - <li><a href="#">Adena</a></li> - <li><a href="#">Adrian</a></li> - <li><a href="#">Akron</a></li> - <li><a href="#">Albany</a></li> - <li><a href="#">Alexandria</a></li> - <li><a href="#">Alger</a></li> - <li><a href="#">Alledonia</a></li> - <li><a href="#">Alliance</a></li> - <li><a href="#">Alpha</a></li> - <li><a href="#">Alvada</a></li> - <li><a href="#">Alvordton</a></li> - <li><a href="#">Amanda</a></li> - <li><a href="#">Amelia</a></li> - <li><a href="#">Amesville</a></li> - <li><a href="#">Aberdeen</a></li> - <li><a href="#">Ada</a></li> - <li><a href="#">Adamsville</a></li> - <li><a href="#">Addyston</a></li> - <li><a href="#">Adelphi</a></li> - <li><a href="#">Adena</a></li> - <li><a href="#">Adrian</a></li> - <li><a href="#">Akron</a></li> - <li><a href="#">Albany</a></li> - <li><a href="#">Alexandria</a></li> - <li><a href="#">Alger</a></li> - <li><a href="#">Alledonia</a></li> - <li><a href="#">Alliance</a></li> - <li><a href="#">Alpha</a></li> - <li><a href="#">Alvada</a></li> - <li><a href="#">Alvordton</a></li> - <li><a href="#">Amanda</a></li> - <li><a href="#">Amelia</a></li> - <li><a href="#">Amesville</a></li> + <li>Aberdeen</li> + <li>Ada</li> + <li>Adamsville</li> + <li>Addyston</li> + <li>Adelphi</li> + <li>Adena</li> + <li>Adrian</li> + <li>Akron</li> + <li>Albany</li> + <li>Alexandria</li> + <li>Alger</li> + <li>Alledonia</li> + <li>Alliance</li> + <li>Alpha</li> + <li>Alvada</li> + <li>Alvordton</li> + <li>Amanda</li> + <li>Amelia</li> + <li>Amesville</li> + <li>Aberdeen</li> + <li>Ada</li> + <li>Adamsville</li> + <li>Addyston</li> + <li>Adelphi</li> + <li>Adena</li> + <li>Adrian</li> + <li>Akron</li> + <li>Albany</li> + <li>Alexandria</li> + <li>Alger</li> + <li>Alledonia</li> + <li>Alliance</li> + <li>Alpha</li> + <li>Alvada</li> + <li>Alvordton</li> + <li>Amanda</li> + <li>Amelia</li> + <li>Amesville</li> </ul> <h2>Menu with custom markup</h2> <div id="menu5"> - <blockquote><a href="#">Aberdeen</a></blockquote> - <blockquote><a href="#">Ada</a></blockquote> - <blockquote class="ui-state-disabled"><a href="#">Adamsville</a></blockquote> - <blockquote><a href="#">Addyston</a></blockquote> - <blockquote> - <a href="#">Delphi</a> + <blockquote>Aberdeen</blockquote> + <blockquote>Ada</blockquote> + <blockquote class="ui-state-disabled">Adamsville</blockquote> + <blockquote>Addyston</blockquote> + <blockquote>Delphi <div> - <blockquote><a href="#">Ada</a></blockquote> - <blockquote><a href="#">Saarland</a></blockquote> - <blockquote><a href="#">Salzburg</a></blockquote> + <blockquote>Ada</blockquote> + <blockquote>Saarland</blockquote> + <blockquote>Salzburg</blockquote> </div> </blockquote> - <blockquote><a href="#">Saarland</a></blockquote> - <blockquote> - <a href="#">Salzburg</a> + <blockquote>Saarland</blockquote> + <blockquote>Salzburg <div> - <blockquote> - <a href="#">Delphi</a> + <blockquote>Delphi <div> - <blockquote><a href="#">Ada</a></blockquote> - <blockquote><a href="#">Saarland</a></blockquote> - <blockquote><a href="#">Salzburg</a></blockquote> + <blockquote>Ada</blockquote> + <blockquote>Saarland</blockquote> + <blockquote>Salzburg</blockquote> </div> </blockquote> - <blockquote> - <a href="#">Delphi</a> + <blockquote>Delphi <div> - <blockquote><a href="#">Ada</a></blockquote> - <blockquote><a href="#">Saarland</a></blockquote> - <blockquote><a href="#">Salzburg</a></blockquote> + <blockquote>Ada</blockquote> + <blockquote>Saarland</blockquote> + <blockquote>Salzburg</blockquote> </div> </blockquote> - <blockquote><a href="#">Perch</a></blockquote> + <blockquote>Perch</blockquote> </div> </blockquote> </div> @@ -216,93 +211,79 @@ <h2>Menu with custom markup, multi-line items and a custom submenu icon</h2> <div class="menuElement" id="menu6"> <div class="address-item"> - <a href="#"> - <span class="address-header">John Doe</span> - <span class="address-content">78 West Main St Apt 3A</span> - <span class="address-content">Bloomsburg, PA 12345</span> - </a> + <span class="address-header">John Doe</span> + <span class="address-content">78 West Main St Apt 3A</span> + <span class="address-content">Bloomsburg, PA 12345</span> </div> <div class="address-item"> - <a href="#"> - <span class="address-header">Jane Doe</span> - <span class="address-content">78 West Main St Apt 3A</span> - <span class="address-content">Bloomsburg, PA 12345</span> - </a> + <span class="address-header">Jane Doe</span> + <span class="address-content">78 West Main St Apt 3A</span> + <span class="address-content">Bloomsburg, PA 12345</span> </div> <div class="address-item ui-state-disabled"> - <a href="#"> - <span class="address-header">James Doe</span> - <span class="address-content">78 West Main St Apt 3A</span> - <span class="address-content">Bloomsburg, PA 12345</span> - </a> + <span class="address-header">James Doe</span> + <span class="address-content">78 West Main St Apt 3A</span> + <span class="address-content">Bloomsburg, PA 12345</span> </div> <div class="address-item"> - <a href="#"> - <span class="address-header">Jenny Doe</span> - <span class="address-content">78 West Main St Apt 3A</span> - <span class="address-content">Bloomsburg, PA 12345</span> - </a> + <span class="address-header">Jenny Doe</span> + <span class="address-content">78 West Main St Apt 3A</span> + <span class="address-content">Bloomsburg, PA 12345</span> </div> <div class="address-item"> - <a href="#"> - <span class="address-header">John Doe</span> - <span class="address-content">78 West Main St Apt 3A</span> - <span class="address-content">Bloomsburg, PA 12345</span> - </a> + <span class="address-header">John Doe</span> + <span class="address-content">78 West Main St Apt 3A</span> + <span class="address-content">Bloomsburg, PA 12345</span> <div class="menuElement"> - <div><a href="#">Ada</a></div> - <div><a href="#">Saarland</a></div> - <div><a href="#">Salzburg</a></div> + <div>Ada</div> + <div>Saarland</div> + <div>Salzburg</div> </div> </div> </div> -<h2>Inline with dividers and elements without anchors</h2> +<h2>Inline with dividers and group labels</h2> <ul id="menu7"> - <li><strong>Group 1</strong></li> - <li><a href="#">Aberdeen</a></li> - <li><a href="#">Ada</a></li> - <li><a href="#">Adamsville</a></li> - <li><a href="#">Addyston</a></li> + <li class="ui-menu-group"><strong>Group 1</strong></li> + <li>Aberdeen</li> + <li>Ada</li> + <li>Adamsville</li> + <li>Addyston</li> <li></li> - <li><strong>Group 2</strong></li> - <li> - <a href="#">Delphi</a> + <li class="ui-menu-group"><strong>Group 2</strong></li> + <li>Delphi <ul> - <li><a href="#">Ada</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li>Ada</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li><a href="#">Saarland</a></li> + <li>Saarland</li> <li>---</li> - <li><strong>Group 3</strong></li> - <li> - <a href="#">Salzburg</a> + <li class="ui-menu-group"><strong>Group 3</strong></li> + <li>Salzburg <ul> - <li> - <a href="#">Delphi</a> + <li>Delphi <ul> - <li><a href="#">Ada</a></li> + <li>Ada</li> <li> - </li> - <li><a href="#">Saarland</a></li> + <li>Saarland</li> <li>—</li> - <li><a href="#">Salzburg</a></li> + <li>Salzburg</li> <li>–</li> </ul> </li> - <li> - <a href="#">Delphi</a> + <li>Delphi <ul> - <li><a href="#">Ada</a></li> - <li><a href="#">Saarland</a></li> - <li><a href="#">Salzburg</a></li> + <li>Ada</li> + <li>Saarland</li> + <li>Salzburg</li> </ul> </li> - <li><a href="#">Perch</a></li> + <li>Perch</li> </ul> </li> - <li><a href="#">Amesville</a></li> + <li>Amesville</li> </ul> <div style="position: absolute; top: 1em; right: 1em;"> diff --git a/themes/base/jquery.ui.dialog.css b/themes/base/jquery.ui.dialog.css index c5499d8db..b49a4a76d 100644 --- a/themes/base/jquery.ui.dialog.css +++ b/themes/base/jquery.ui.dialog.css @@ -31,7 +31,7 @@ position: absolute; right: .3em; top: 50%; - width: 21px; + width: 20px; margin: -10px 0 0 0; padding: 1px; height: 20px; diff --git a/themes/base/jquery.ui.menu.css b/themes/base/jquery.ui.menu.css index 8a61d1b69..cc390cec4 100644 --- a/themes/base/jquery.ui.menu.css +++ b/themes/base/jquery.ui.menu.css @@ -21,8 +21,11 @@ } .ui-menu .ui-menu-item { margin: 0; - padding: 0; - width: 100%; + display: block; + padding: 2px .4em; + line-height: 1.5; + min-height: 0; /* support: IE7 */ + font-weight: normal; /* support: IE10, see #8844 */ list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7); } @@ -33,16 +36,8 @@ line-height: 0; border-width: 1px 0 0 0; } -.ui-menu .ui-menu-item a { - text-decoration: none; - display: block; - padding: 2px .4em; - line-height: 1.5; - min-height: 0; /* support: IE7 */ - font-weight: normal; -} -.ui-menu .ui-menu-item a.ui-state-focus, -.ui-menu .ui-menu-item a.ui-state-active { +.ui-menu .ui-state-focus, +.ui-menu .ui-state-active { font-weight: normal; margin: -1px; } @@ -60,7 +55,7 @@ .ui-menu-icons { position: relative; } -.ui-menu-icons .ui-menu-item a { +.ui-menu-icons .ui-menu-item { position: relative; padding-left: 2em; } diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 8328cb6e5..d1a3c252d 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -523,9 +523,7 @@ $.widget( "ui.autocomplete", { }, _renderItem: function( ul, item ) { - return $( "<li>" ) - .append( $( "<a>" ).text( item.label ) ) - .appendTo( ul ); + return $( "<li>" ).text( item.label ).appendTo( ul ); }, _move: function( direction, event ) { diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index b433cb79b..0f0ee7fe2 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -1721,7 +1721,7 @@ $.extend(Datepicker.prototype, { thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); for (dow = 0; dow < 7; dow++) { // days of the week day = (dow + firstDay) % 7; - thead += "<th" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + + thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; } calender += thead + "</tr></thead><tbody>"; diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 0170a42d2..cbae739bf 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -169,7 +169,8 @@ $.widget( "ui.dialog", { enable: $.noop, close: function( event ) { - var that = this; + var activeElement, + that = this; if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { return; @@ -179,10 +180,22 @@ $.widget( "ui.dialog", { this._destroyOverlay(); if ( !this.opener.filter(":focusable").focus().length ) { - // Hiding a focused element doesn't trigger blur in WebKit - // so in case we have nothing to focus on, explicitly blur the active element - // https://bugs.webkit.org/show_bug.cgi?id=47182 - $( this.document[0].activeElement ).blur(); + + // support: IE9 + // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> + try { + activeElement = this.document[ 0 ].activeElement; + + // Support: IE9, IE10 + // If the <body> is blurred, IE will switch windows, see #4520 + if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) { + + // Hiding a focused element doesn't trigger blur in WebKit + // so in case we have nothing to focus on, explicitly blur the active element + // https://bugs.webkit.org/show_bug.cgi?id=47182 + $( activeElement ).blur(); + } + } catch ( error ) {} } this._hide( this.uiDialog, this.options.hide, function() { @@ -199,7 +212,17 @@ $.widget( "ui.dialog", { }, _moveToTop: function( event, silent ) { - var moved = !!this.uiDialog.nextAll(":visible").insertBefore( this.uiDialog ).length; + var moved = false, + zIndicies = this.uiDialog.siblings( ".ui-front:visible" ).map(function() { + return +$( this ).css( "z-index" ); + }).get(), + zIndexMax = Math.max.apply( null, zIndicies ); + + if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { + this.uiDialog.css( "z-index", zIndexMax + 1 ); + moved = true; + } + if ( moved && !silent ) { this._trigger( "focus", event ); } @@ -734,6 +757,8 @@ $.widget( "ui.dialog", { if ( !this.document.data( "ui-dialog-overlays" ) ) { // Prevent use of anchors and inputs + // Using _on() for an event handler shared across many instances is + // safe because the dialogs stack and must be closed in reverse order this._on( this.document, { focusin: function( event ) { if ( isOpening ) { diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 3352eb8bd..059f80b30 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -23,6 +23,7 @@ $.widget( "ui.menu", { icons: { submenu: "ui-icon-carat-1-e" }, + items: "> *", menus: "ul", position: { my: "left top", @@ -66,14 +67,14 @@ $.widget( "ui.menu", { this._on({ // Prevent focus from sticking to links inside menu after clicking // them (focus should always stay on UL during navigation). - "mousedown .ui-menu-item > a": function( event ) { + "mousedown .ui-menu-item": function( event ) { event.preventDefault(); }, - "click .ui-state-disabled > a": function( event ) { + "click .ui-state-disabled": function( event ) { event.preventDefault(); }, - "click .ui-menu-item:has(a)": function( event ) { - var target = $( event.target ).closest( ".ui-menu-item" ); + "click .ui-menu-item": function( event ) { + var target = $( event.target ); if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { this.select( event ); @@ -85,7 +86,8 @@ $.widget( "ui.menu", { // Open submenu on click if ( target.has( ".ui-menu" ).length ) { this.expand( event ); - } else if ( !this.element.is( ":focus" ) ) { + } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) { + // Redirect focus to the menu this.element.trigger( "focus", [ true ] ); @@ -101,7 +103,7 @@ $.widget( "ui.menu", { var target = $( event.currentTarget ); // Remove ui-state-active class from siblings of the newly focused menu item // to avoid a jump caused by adjacent elements both having a class with a border - target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" ); + target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" ); this.focus( event, target ); }, mouseleave: "collapseAll", @@ -109,7 +111,7 @@ $.widget( "ui.menu", { focus: function( event, keepActiveItem ) { // If there's already an active item, keep it active // If not, activate the first item - var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 ); + var item = this.active || this.element.find( this.options.items ).eq( 0 ); if ( !keepActiveItem ) { this.focus( event, item ); @@ -160,18 +162,17 @@ $.widget( "ui.menu", { .removeClass( "ui-menu-item" ) .removeAttr( "role" ) .removeAttr( "aria-disabled" ) - .children( "a" ) - .removeUniqueId() - .removeClass( "ui-corner-all ui-state-hover" ) - .removeAttr( "tabIndex" ) - .removeAttr( "role" ) - .removeAttr( "aria-haspopup" ) - .children().each( function() { - var elem = $( this ); - if ( elem.data( "ui-menu-submenu-carat" ) ) { - elem.remove(); - } - }); + .removeUniqueId() + .removeClass( "ui-corner-all ui-state-hover" ) + .removeAttr( "tabIndex" ) + .removeAttr( "role" ) + .removeAttr( "aria-haspopup" ) + .children().each( function() { + var elem = $( this ); + if ( elem.data( "ui-menu-submenu-carat" ) ) { + elem.remove(); + } + }); // Destroy menu dividers this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" ); @@ -234,8 +235,8 @@ $.widget( "ui.menu", { } regex = new RegExp( "^" + escape( character ), "i" ); - match = this.activeMenu.children( ".ui-menu-item" ).filter(function() { - return regex.test( $( this ).children( "a" ).text() ); + match = this.activeMenu.find( this.options.items ).filter(function() { + return regex.test( $( this ).text() ); }); match = skip && match.index( this.active.next() ) !== -1 ? this.active.nextAll( ".ui-menu-item" ) : @@ -246,8 +247,8 @@ $.widget( "ui.menu", { if ( !match.length ) { character = String.fromCharCode( event.keyCode ); regex = new RegExp( "^" + escape( character ), "i" ); - match = this.activeMenu.children( ".ui-menu-item" ).filter(function() { - return regex.test( $( this ).children( "a" ).text() ); + match = this.activeMenu.find( this.options.items ).filter(function() { + return regex.test( $( this ).text() ); }); } @@ -273,7 +274,7 @@ $.widget( "ui.menu", { _activate: function( event ) { if ( !this.active.is( ".ui-state-disabled" ) ) { - if ( this.active.children( "a[aria-haspopup='true']" ).length ) { + if ( this.active.is( "[aria-haspopup='true']" ) ) { this.expand( event ); } else { this.select( event ); @@ -283,6 +284,7 @@ $.widget( "ui.menu", { refresh: function() { var menus, + items, icon = this.options.icons.submenu, submenus = this.element.find( this.options.menus ); @@ -299,7 +301,7 @@ $.widget( "ui.menu", { }) .each(function() { var menu = $( this ), - item = menu.prev( "a" ), + item = menu.parent(), submenuCarat = $( "<span>" ) .addClass( "ui-menu-icon ui-icon " + icon ) .data( "ui-menu-submenu-carat", true ); @@ -311,21 +313,10 @@ $.widget( "ui.menu", { }); menus = submenus.add( this.element ); + items = menus.find( this.options.items ); - // Don't refresh list items that are already adapted - menus.children( ":not(.ui-menu-item):has(a)" ) - .addClass( "ui-menu-item" ) - .attr( "role", "presentation" ) - .children( "a" ) - .uniqueId() - .addClass( "ui-corner-all" ) - .attr({ - tabIndex: -1, - role: this._itemRole() - }); - - // Initialize unlinked menu-items containing spaces and/or dashes only as dividers - menus.children( ":not(.ui-menu-item)" ).each(function() { + // Initialize menu-items containing spaces and/or dashes only as dividers + items.not( ".ui-menu-item" ).each(function() { var item = $( this ); // hyphen, em dash, en dash if ( !/[^\-\u2014\u2013\s]/.test( item.text() ) ) { @@ -333,8 +324,18 @@ $.widget( "ui.menu", { } }); + // Don't refresh list items that are already adapted + items.not( ".ui-menu-item, .ui-menu-divider" ) + .addClass( "ui-menu-item" ) + .uniqueId() + .addClass( "ui-corner-all" ) + .attr({ + tabIndex: -1, + role: this._itemRole() + }); + // Add aria-disabled attribute to any disabled menu item - menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); + items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); // If the active item has been removed, blur the menu if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { @@ -370,7 +371,7 @@ $.widget( "ui.menu", { this._scrollIntoView( item ); this.active = item.first(); - focused = this.active.children( "a" ).addClass( "ui-state-focus" ); + focused = this.active.addClass( "ui-state-focus" ); // Only update aria-activedescendant if there's a role // otherwise we assume focus is managed elsewhere if ( this.options.role ) { @@ -381,7 +382,6 @@ $.widget( "ui.menu", { this.active .parent() .closest( ".ui-menu-item" ) - .children( "a:first" ) .addClass( "ui-state-active" ); if ( event && event.type === "keydown" ) { @@ -428,7 +428,7 @@ $.widget( "ui.menu", { return; } - this.active.children( "a" ).removeClass( "ui-state-focus" ); + this.active.removeClass( "ui-state-focus" ); this.active = null; this._trigger( "blur", event, { item: this.active } ); @@ -498,7 +498,7 @@ $.widget( "ui.menu", { .attr( "aria-hidden", "true" ) .attr( "aria-expanded", "false" ) .end() - .find( "a.ui-state-active" ) + .find( ".ui-state-active" ) .removeClass( "ui-state-active" ); }, @@ -519,7 +519,7 @@ $.widget( "ui.menu", { var newItem = this.active && this.active .children( ".ui-menu " ) - .children( ".ui-menu-item" ) + .find( this.options.items ) .first(); if ( newItem && newItem.length ) { @@ -562,7 +562,7 @@ $.widget( "ui.menu", { } } if ( !next || !next.length || !this.active ) { - next = this.activeMenu.children( ".ui-menu-item" )[ filter ](); + next = this.activeMenu.find( this.options.items )[ filter ](); } this.focus( event, next ); @@ -588,7 +588,7 @@ $.widget( "ui.menu", { this.focus( event, item ); } else { - this.focus( event, this.activeMenu.children( ".ui-menu-item" ) + this.focus( event, this.activeMenu.find( this.options.items ) [ !this.active ? "first" : "last" ]() ); } }, @@ -612,7 +612,7 @@ $.widget( "ui.menu", { this.focus( event, item ); } else { - this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() ); + this.focus( event, this.activeMenu.find( this.options.items ).first() ); } }, diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index a4912fc7e..3bbd35f88 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -55,8 +55,12 @@ $.widget( "ui.spinner", { this._setOption( "min", this.options.min ); this._setOption( "step", this.options.step ); - // format the value, but don't constrain - this._value( this.element.val(), true ); + // Only format if there is a value, prevents the field from being marked + // as invalid in Firefox, see #9573. + if ( this.value() !== "" ) { + // Format the value, but don't constrain. + this._value( this.element.val(), true ); + } this._draw(); this._on( this._events ); diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 5f81cda10..4077c9ac5 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -441,7 +441,7 @@ $.widget( "ui.tabs", { // allow overriding how to find the list for rare usage scenarios (#7715) _getList: function() { - return this.element.find( "ol,ul" ).eq( 0 ); + return this.tablist || this.element.find( "ol,ul" ).eq( 0 ); }, _createPanel: function( id ) { |