From 62842be5b889055fda9a6f8017205a7828ed2c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 14 May 2012 11:26:51 -0400 Subject: [PATCH 01/80] Updated authors list. --- AUTHORS.txt | 216 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 186 insertions(+), 30 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index ecb4eb4603..f115bdf618 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -1,31 +1,187 @@ -jQuery UI Authors (http://jqueryui.com/about) +Authors ordered by first contribution +A list of current team members is available at http://jqueryui.com/about -This software consists of voluntary contributions made by many -individuals. For exact contribution history, see the revision history -and logs, available at http://github.com/jquery/jquery-ui - -Brandon Aaron -Paul Bakaus (paulbakaus.com) -David Bolter -Rich Caloggero -Chi Cheng (cloudream@gmail.com) -Colin Clark (http://colin.atrc.utoronto.ca/) -Michelle D'Souza -Aaron Eisenberger (aaronchi@gmail.com) -Ariel Flesler -Bohdan Ganicky -Scott González -Marc Grabanski (m@marcgrabanski.com) -Klaus Hartl (stilbuero.de) -Hans Hillen (TPG, funded through AEGIS: http://www.aegis-project.eu/) -Scott Jehl -Cody Lindley -Eduardo Lundgren (eduardolundgren@gmail.com) -Todd Parker -John Resig -Patty Toland -Ca-Phun Ung (yelotofu.com) -Keith Wood (kbwood@virginbroadband.com.au) -Maggie Costello Wachs -Richard D. Worth (rdworth.org) -Jörn Zaefferer (bassistance.de) +Paul Bakaus +Richard Worth +Yehuda Katz +Sean Catchpole +John Resig +Tane Piper +Dmitri Gaskin +Klaus Hartl +Stefan Petre +Gilles van den Hoven +Micheil Smith +Jörn Zaefferer +Marc Grabanski +Keith Wood +Brandon Aaron +Scott González +Eduardo Lundgren +Aaron Eisenberger +Joan Piedra +Bruno Basto +Remy Sharp +Bohdan Ganicky +David Bolter +Chi Cheng +Ca-Phun Ung +Ariel Flesler +Maggie Costello Wachs +Scott Jehl +Todd Parker +Andrew Powell +Brant Burnett +Douglas Neiner +Paul Irish +Ralph Whitbeck +Thibault Duplessis +Dominique Vincent +Jack Hsu +Adam Sontag +Carl Fürstenberg +Kevin Dalman +Alberto Fernández Capel +Jacek Jędrzejewski +Ting Kuei +Samuel Cormier-Iijima +Jon Palmer +Ben Hollis +Justin MacCarthy +Eyal Kobrigo +Tiago Freire +Diego Tres +Holger Rüprich +Ziling Zhao +Mike Alsup +Robson Braga Araujo +Pierre-Henri Ausseil +Christopher McCulloh +Andrew Newcomb +Lim Chee Aun +Jorge Barreiro +Daniel Steigerwald +John Firebaugh +John Enters +Andrey Kapitcyn +Dmitry Petrov +Eric Hynds +Chairat Sunthornwiphat +Josh Varner +Stéphane Raimbault +Jay Merrifield +J. Ryan Stinnett +Peter Heiberg +Alex Dovenmuehle +Jamie Gegerson +Raymond Schwartz +Phillip Barnes +Kyle Wilkinson +Khaled AlHourani +Marian Rudzynski +Jean-Francois Remy +Doug Blood +Filippo Cavallarin +Heiko Henning +Aliaxandr Rahalevich +Mario Visic +Xavi Ramirez +Max Schnur +Saji Nediyanchath +Corey Frang +Aaron Peterson +Ivan Peters +Mohamed Cherif Bouchelaghem +Marcos Sousa +Michael DellaNoce +George Marshall +Tobias Brunner +Martin Solli +David Petersen +Dan Heberden +William Kevin Manire +Gilmore Davidson +Michael Wu +Adam Parod +Guillaume Gautreau +Marcel Toele +Dan Streetman +Matt Hoskins +Giovanni Giacobbi +Kyle Florence +Pavol Hluchý +Hans Hillen +Mark Johnson +Trey Hunner +Shane Whittet +Edward Faulkner +Adam Baratz +Kato Kazuyoshi +Eike Send +Kris Borchers +Eddie Monge +Israel Tsadok +Carson McDonald +Jason Davies +Garrison Locke +David Murdoch +Ben Boyle +Jesse Baird +Jonathan Vingiano +Dylan Just +Tomy Kaira +Glenn Goodrich +Ashek Elahi +Ryan Neufeld +Marc Neuwirth +Philip Graham +Benjamin Sterling +Wesley Walser +Kouhei Sutou +Karl Kirch +Chris Kelly +Jay Oster +Alex Polomoshnov +David Leal +igor milla +Dave Methvin +Florian Gutmann +Marwan Al Jubeh +Milan Broum +Sebastian Sauer +Gaëtan Muller +Michel Weimerskirch +William Griffiths +Stojce Slavkovski +David Soms +David De Sloovere +Michael P. Jung +Shannon Pekary +Matthew Hutton +James Khoury +Rob Loach +Alberto Monteiro +Alex Rhea +Krzysztof Rosiński +Ryan Olton +Genie <386@mail.com> +Rick Waldron +Ian Simpson +Lev Kitsis +TJ VanToll +Justin Domnitz +Douglas Cerna +Bert ter Heide +Jasvir Nagra +Petr Hromadko +Harri Kilpiö +Lado Lomidze +Amir E. Aharoni +Simon Sattes +Jo Liss +Guntupalli Karunakar +Shahyar Ghobadpour +Lukasz Lipinski +Timo Tijhof +Jason Moon +Martin Frost From 1304c50532b65738a7fc3c9deb3943f7de308539 Mon Sep 17 00:00:00 2001 From: Eneko Illarramendi Date: Mon, 14 May 2012 21:15:57 +0300 Subject: [PATCH 02/80] Datepicker: Fixed Basque locale. Fixes #8318 - Datepicker i18n: Basque locale incorrect. --- ui/i18n/jquery.ui.datepicker-eu.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ui/i18n/jquery.ui.datepicker-eu.js b/ui/i18n/jquery.ui.datepicker-eu.js index 4c40eebec6..846ce3abc6 100644 --- a/ui/i18n/jquery.ui.datepicker-eu.js +++ b/ui/i18n/jquery.ui.datepicker-eu.js @@ -6,15 +6,15 @@ jQuery(function($){ prevText: '<Aur', nextText: 'Hur>', currentText: 'Gaur', - monthNames: ['Urtarrila','Otsaila','Martxoa','Apirila','Maiatza','Ekaina', - 'Uztaila','Abuztua','Iraila','Urria','Azaroa','Abendua'], - monthNamesShort: ['Urt','Ots','Mar','Api','Mai','Eka', - 'Uzt','Abu','Ira','Urr','Aza','Abe'], - dayNames: ['Igandea','Astelehena','Asteartea','Asteazkena','Osteguna','Ostirala','Larunbata'], - dayNamesShort: ['Iga','Ast','Ast','Ast','Ost','Ost','Lar'], - dayNamesMin: ['Ig','As','As','As','Os','Os','La'], - weekHeader: 'Wk', - dateFormat: 'yy/mm/dd', + monthNames: ['urtarrila','otsaila','martxoa','apirila','maiatza','ekaina', + 'uztaila','abuztua','iraila','urria','azaroa','abendua'], + monthNamesShort: ['urt.','ots.','mar.','api.','mai.','eka.', + 'uzt.','abu.','ira.','urr.','aza.','abe.'], + dayNames: ['igandea','astelehena','asteartea','asteazkena','osteguna','ostirala','larunbata'], + dayNamesShort: ['ig.','al.','ar.','az.','og.','ol.','lr.'], + dayNamesMin: ['ig','al','ar','az','og','ol','lr'], + weekHeader: 'As', + dateFormat: 'yy-mm-dd', firstDay: 1, isRTL: false, showMonthAfterYear: false, From d4318a5f4c216e1184b6e90c17214b6e6cfbb0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 14 May 2012 14:40:06 -0400 Subject: [PATCH 03/80] Tabs: Replaced fx option with show and hide options. Fixes #8319 - Tabs: Deprecate fx option. --- tests/unit/tabs/tabs_common.js | 3 +- tests/unit/tabs/tabs_common_deprecated.js | 2 + ui/jquery.ui.tabs.js | 104 ++++++++++++++++------ 3 files changed, 81 insertions(+), 28 deletions(-) diff --git a/tests/unit/tabs/tabs_common.js b/tests/unit/tabs/tabs_common.js index 7ffb05da49..b98ff35751 100644 --- a/tests/unit/tabs/tabs_common.js +++ b/tests/unit/tabs/tabs_common.js @@ -4,7 +4,8 @@ TestHelpers.commonWidgetTests( "tabs", { collapsible: false, disabled: false, event: "click", - fx: null, + hide: null, + show: null, // callbacks activate: null, diff --git a/tests/unit/tabs/tabs_common_deprecated.js b/tests/unit/tabs/tabs_common_deprecated.js index fdcff21b33..718ae82724 100644 --- a/tests/unit/tabs/tabs_common_deprecated.js +++ b/tests/unit/tabs/tabs_common_deprecated.js @@ -7,9 +7,11 @@ TestHelpers.commonWidgetTests( "tabs", { cookie: null, disabled: false, event: "click", + hide: null, fx: null, idPrefix: "ui-tabs-", panelTemplate: "
", + // show: null, // conflicts with old show callback spinner: "Loading…", tabTemplate: "
  • #{label}
  • ", diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 026c509939..7198a4180d 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -34,7 +34,8 @@ $.widget( "ui.tabs", { active: null, collapsible: false, event: "click", - fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } + hide: null, + show: null, // callbacks activate: null, @@ -101,8 +102,6 @@ $.widget( "ui.tabs", { ) ).sort(); } - this._setupFx( options.fx ); - this._refresh(); // highlight selected tab @@ -151,10 +150,6 @@ $.widget( "ui.tabs", { if ( key === "event" ) { this._setupEvents( value ); } - - if ( key === "fx" ) { - this._setupFx( value ); - } }, _tabId: function( a ) { @@ -278,18 +273,6 @@ $.widget( "ui.tabs", { this.options.disabled = disabled; }, - _setupFx: function( fx ) { - // set up animations - if ( fx ) { - if ( $.isArray( fx ) ) { - this.hideFx = fx[ 0 ]; - this.showFx = fx[ 1 ]; - } else { - this.hideFx = this.showFx = fx; - } - } - }, - _setupEvents: function( event ) { // attach tab event handler, unbind to avoid duplicates from former tabifying... this.anchors.unbind( ".tabs" ); @@ -364,7 +347,7 @@ $.widget( "ui.tabs", { toShow = eventData.newPanel, toHide = eventData.oldPanel; - that.running = true; + this.running = true; function complete() { that.running = false; @@ -374,11 +357,8 @@ $.widget( "ui.tabs", { function show() { eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); - if ( toShow.length && that.showFx ) { - toShow - .animate( that.showFx, that.showFx.duration || "normal", function() { - complete(); - }); + if ( toShow.length && that.options.show ) { + that._show( toShow, that.options.show, complete ); } else { toShow.show(); complete(); @@ -386,8 +366,8 @@ $.widget( "ui.tabs", { } // start out by hiding, then showing, then completing - if ( toHide.length && that.hideFx ) { - toHide.animate( that.hideFx, that.hideFx.duration || "normal", function() { + if ( toHide.length && this.options.hide ) { + this._hide( toHide, this.options.hide, function() { eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); show(); }); @@ -995,6 +975,76 @@ if ( $.uiBackCompat !== false ) { return this._super( type, event, _data ); } }); + + // fx option + // The new animation options (show, hide) conflict with the old show callback. + // The old fx option wins over show/hide anyway (always favor back-compat). + // If a user wants to use the new animation API, they must give up the old API. + $.widget( "ui.tabs", $.ui.tabs, { + options: { + fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 } + }, + + _getFx: function() { + var hide, show, + fx = this.options.fx; + + if ( fx ) { + if ( $.isArray( fx ) ) { + hide = fx[ 0 ]; + show = fx[ 1 ]; + } else { + hide = show = fx; + } + } + + return fx ? { show: show, hide: hide } : null; + }, + + _toggle: function( event, eventData ) { + var that = this, + toShow = eventData.newPanel, + toHide = eventData.oldPanel, + fx = this._getFx(); + + if ( !fx ) { + return this._super( event, eventData ); + } + + that.running = true; + + function complete() { + that.running = false; + that._trigger( "activate", event, eventData ); + } + + function show() { + eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); + + if ( toShow.length && fx.show ) { + toShow + .animate( fx.show, fx.show.duration, function() { + complete(); + }); + } else { + toShow.show(); + complete(); + } + } + + // start out by hiding, then showing, then completing + if ( toHide.length && fx.hide ) { + toHide.animate( fx.hide, fx.hide.duration, function() { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + show(); + }); + } else { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + toHide.hide(); + show(); + } + } + }); } })( jQuery ); From 6b1fea9baba7c54e58c0e414ad622b25eaa154b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 14 May 2012 17:19:10 -0400 Subject: [PATCH 04/80] Grunt: Added task for generating the list of authors. --- grunt.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/grunt.js b/grunt.js index 202779e0b4..98e8b30f55 100644 --- a/grunt.js +++ b/grunt.js @@ -572,6 +572,30 @@ grunt.registerTask( "clean", function() { require( "rimraf" ).sync( "dist" ); }); +grunt.registerTask( "authors", function() { + var done = this.async(); + + grunt.utils.spawn({ + cmd: "git", + args: [ "log", "--pretty=%an <%ae>" ] + }, function( err, result ) { + if ( err ) { + grunt.log.error( err ); + return done( false ); + } + + var authors, + tracked = {}; + authors = result.split( "\n" ).reverse().filter(function( author ) { + var first = !tracked[ author ]; + tracked[ author ] = true; + return first; + }).join( "\n" ); + grunt.log.writeln( authors ); + done(); + }); +}); + grunt.registerTask( "default", "lint csslint htmllint qunit" ); grunt.registerTask( "sizer", "concat:ui min:dist/jquery-ui.min.js compare_size:all" ); grunt.registerTask( "sizer_all", "concat:ui min compare_size" ); From 1b19121189356879ca39a19ba241a04ff4786b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 14 May 2012 21:38:30 -0400 Subject: [PATCH 05/80] Autocomplete combobox demo: Add combobox-specific classes for styling. Fixes #8322 - Autocomplete: Combobox demo should not override .ui-button styles. --- demos/autocomplete/combobox.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/demos/autocomplete/combobox.html b/demos/autocomplete/combobox.html index e2ef40dd9a..051d55e451 100644 --- a/demos/autocomplete/combobox.html +++ b/demos/autocomplete/combobox.html @@ -18,7 +18,7 @@ position: relative; display: inline-block; } - .ui-button { + .ui-combobox-toggle { position: absolute; top: 0; bottom: 0; @@ -28,7 +28,7 @@ *height: 1.7em; *top: 0.1em; } - .ui-autocomplete-input { + .ui-combobox-input { margin: 0; padding: 0.3em; } @@ -75,7 +75,7 @@ .appendTo( wrapper ) .val( value ) .attr( "title", "" ) - .addClass( "ui-state-default" ) + .addClass( "ui-state-default ui-combobox-input" ) .autocomplete({ delay: 0, minLength: 0, @@ -128,7 +128,7 @@ text: false }) .removeClass( "ui-corner-all" ) - .addClass( "ui-corner-right ui-button-icon" ) + .addClass( "ui-corner-right ui-combobox-toggle" ) .click(function() { // close if already visible if ( input.autocomplete( "widget" ).is( ":visible" ) ) { From 86569d8ebceec4b4c173d5fd635b968796f0361b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Tue, 15 May 2012 10:07:05 -0400 Subject: [PATCH 06/80] Visual tests: Renamed files. --- tests/visual/accordion/{accordion.html => icons.html} | 0 tests/visual/addClass/{addClass_queue.html => queue.html} | 2 +- .../{dialog_on_page_with_large_dom.html => large_dom.html} | 6 ++++-- 3 files changed, 5 insertions(+), 3 deletions(-) rename tests/visual/accordion/{accordion.html => icons.html} (100%) rename tests/visual/addClass/{addClass_queue.html => queue.html} (90%) rename tests/visual/dialog/{dialog_on_page_with_large_dom.html => large_dom.html} (92%) diff --git a/tests/visual/accordion/accordion.html b/tests/visual/accordion/icons.html similarity index 100% rename from tests/visual/accordion/accordion.html rename to tests/visual/accordion/icons.html diff --git a/tests/visual/addClass/addClass_queue.html b/tests/visual/addClass/queue.html similarity index 90% rename from tests/visual/addClass/addClass_queue.html rename to tests/visual/addClass/queue.html index 616f2c7f95..21f4cc1cbe 100644 --- a/tests/visual/addClass/addClass_queue.html +++ b/tests/visual/addClass/queue.html @@ -43,7 +43,7 @@

    WHAT: The two boxes animate from black to red to green to blue.

    -

    The first box should start with a delay, the second box should start immediately.

    +

    EXPECTED: The first box should start with a delay, the second box should start immediately.

    diff --git a/tests/visual/dialog/dialog_on_page_with_large_dom.html b/tests/visual/dialog/large_dom.html similarity index 92% rename from tests/visual/dialog/dialog_on_page_with_large_dom.html rename to tests/visual/dialog/large_dom.html index d807b3e3fe..e84f4b328f 100644 --- a/tests/visual/dialog/dialog_on_page_with_large_dom.html +++ b/tests/visual/dialog/large_dom.html @@ -3,7 +3,6 @@ Dialog Visual Test - Modal Dialog in Large DOM - @@ -37,6 +36,9 @@ +

    WHAT: A single dialog is created on a page with a large DOM.

    +

    EXPECTED: Creating and opening the dialog should be fast, regardless of page size.

    +

    Dialog Content

    @@ -51,7 +53,7 @@
    -

    This is a large DOM

    .
    +

    This is a large DOM.

    +
    + + +
    -
    - - - -
    -
    -
    - - - -
    -
    -
    -
    - - - -
    -
    - -
    - - - - - - - - - - - - - - - - - - +
    + + +
    -
    - - +
    + + +
    -
    - Anchor 1 - Anchor 2 - Anchor 3 - Anchor 4 +
    + + +
    -
    - - +
    + + + + + + +
    + +
    + + + + + + +
    + + -
    - - diff --git a/tests/visual/button/button_disabled_true.html b/tests/visual/button/button_disabled_true.html deleted file mode 100644 index 83a3e9cd6e..0000000000 --- a/tests/visual/button/button_disabled_true.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - Button Visual Test : Button disabled true - - - - - - - - - - -
    - button - -
    - -
    - -
    - anchor - anchor 1 # Attribute "disabled" not allowed on element "a" at this point. -
    - anchor 1 -
    - -
    - input type="button" - -
    - -
    - -
    - input type="radio" - - - -
    - - - -
    - -
    - input type="checkbox" - - - -
    - - - -
    - - - diff --git a/tests/visual/button/button_performance.html b/tests/visual/button/button_performance.html deleted file mode 100644 index 8ff6d03203..0000000000 --- a/tests/visual/button/button_performance.html +++ /dev/null @@ -1,555 +0,0 @@ - - - - - Button Visual push: Default - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/visual/button/button_ticket_5261.html b/tests/visual/button/button_ticket_5261.html deleted file mode 100644 index 7eddc33ae4..0000000000 --- a/tests/visual/button/button_ticket_5261.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - Button Visual Test : Button ticket #5261 - - - - - - - - - - -

    #5261 - button change events don't fire in IE 7/8

    - - - - - - diff --git a/tests/visual/button/button_ticket_5278.html b/tests/visual/button/button_ticket_5278.html deleted file mode 100644 index eed6ebdb07..0000000000 --- a/tests/visual/button/button_ticket_5278.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Button Visual Test : Button ticket #5278 - - - - - - - - - - -

    #5278 - ui.buttons doesn't visually reset on form "reset" event or input "change" event

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - diff --git a/tests/visual/button/performance.html b/tests/visual/button/performance.html new file mode 100644 index 0000000000..1d1884bc29 --- /dev/null +++ b/tests/visual/button/performance.html @@ -0,0 +1,26 @@ + + + + + Button Visual Test: Initialization Performance + + + + + + + + + + + diff --git a/tests/visual/dialog/large_dom.html b/tests/visual/dialog/performance.html similarity index 100% rename from tests/visual/dialog/large_dom.html rename to tests/visual/dialog/performance.html From 44a086b92cbf5a9f20cba23fc7a44d92f9eda5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Tue, 15 May 2012 12:52:18 -0400 Subject: [PATCH 08/80] Visual tests: Effects cleanup. --- .../effects/{effects.all.html => all.html} | 10 +- tests/visual/effects/effects.all.js | 106 ----------------- .../effects/{effects.all.css => effects.css} | 12 +- tests/visual/effects/effects.js | 107 ++++++++++++++++++ .../{effects.scale.html => scale.html} | 8 +- 5 files changed, 118 insertions(+), 125 deletions(-) rename tests/visual/effects/{effects.all.html => all.html} (97%) delete mode 100644 tests/visual/effects/effects.all.js rename tests/visual/effects/{effects.all.css => effects.css} (83%) create mode 100644 tests/visual/effects/effects.js rename tests/visual/effects/{effects.scale.html => scale.html} (95%) diff --git a/tests/visual/effects/effects.all.html b/tests/visual/effects/all.html similarity index 97% rename from tests/visual/effects/effects.all.html rename to tests/visual/effects/all.html index acb8dc41ac..15bfcd2543 100644 --- a/tests/visual/effects/effects.all.html +++ b/tests/visual/effects/all.html @@ -3,7 +3,7 @@ jQuery UI Effects Test Suite - + @@ -19,7 +19,7 @@ - + @@ -186,19 +186,19 @@

    Transfer to first element

    - +
  • addClass

  • - +
  • removeClass

  • - +
  • toggleClass

    diff --git a/tests/visual/effects/effects.all.js b/tests/visual/effects/effects.all.js deleted file mode 100644 index a28c41a89a..0000000000 --- a/tests/visual/effects/effects.all.js +++ /dev/null @@ -1,106 +0,0 @@ - -$(function() { - var duration = 1000, wait = 500; - - $("div.effect") - .hover(function() { $(this).addClass("hover"); }, - function() { $(this).removeClass("hover"); }); - - var effect = function(el, n, o) { - - $.extend(o, { - easing: "easeOutQuint" - }); - - $(el).bind("click", function() { - - $(this).addClass("current") - // delaying the initial animation makes sure that the queue stays in tact - .delay( 10 ) - .hide( n, o, duration ) - .delay( wait ) - .show( n, o, duration, function() { - $( this ).removeClass("current"); - }); - }); - - }; - - $("#hide").click(function() { - var el = $(this); - el.addClass("current").hide(duration, function() { - setTimeout(function() { - el.show(duration, function() { el.removeClass("current"); }); - }, wait); - }); - }); - - effect("#blindLeft", "blind", { direction: "left" }); - effect("#blindUp", "blind", { direction: "up" }); - effect("#blindRight", "blind", { direction: "right" }); - effect("#blindDown", "blind", { direction: "down" }); - - effect("#bounce3times", "bounce", { times: 3 }); - - effect("#clipHorizontally", "clip", { direction: "horizontal" }); - effect("#clipVertically", "clip", { direction: "vertical" }); - - effect("#dropDown", "drop", { direction: "down" }); - effect("#dropUp", "drop", { direction: "up" }); - effect("#dropLeft", "drop", { direction: "left" }); - effect("#dropRight", "drop", { direction: "right" }); - - effect("#explode9", "explode", {}); - effect("#explode36", "explode", { pieces: 36 }); - - effect("#fade", "fade", {}); - - effect("#fold", "fold", { size: 50 }); - - effect("#highlight", "highlight", {}); - - effect("#pulsate", "pulsate", { times: 2 }); - - effect("#puff", "puff", { times: 2 }); - effect("#scale", "scale", {}); - effect("#size", "size", {}); - $("#sizeToggle").bind("click", function() { - var opts = { to: { width: 300, height: 300 }}; - $(this).addClass('current') - .toggle("size", opts, duration) - .delay(wait) - .toggle("size", opts, duration, function() { - $(this).removeClass("current"); - }); - }); - - $("#shake").bind("click", function() { $(this).addClass("current").effect("shake", {}, 100, function() { $(this).removeClass("current"); }); }); - - effect("#slideDown", "slide", { direction: "down" }); - effect("#slideUp", "slide", { direction: "up" }); - effect("#slideLeft", "slide", { direction: "left" }); - effect("#slideRight", "slide", { direction: "right" }); - - $("#transfer").bind("click", function() { $(this).addClass("current").effect("transfer", { to: "div:eq(0)" }, 1000, function() { $(this).removeClass("current"); }); }); - - $("#addClass").click(function() { - $(this).addClass(function() { - window.console && console.log(arguments); - return "current"; - }, duration, function() { - $(this).removeClass("current"); - }); - }); - $("#removeClass").click(function() { - $(this).addClass("current").removeClass(function() { - window.console && console.log(arguments); - return "current"; - }, duration); - }); - $("#toggleClass").click(function() { - $(this).toggleClass(function() { - window.console && console.log(arguments); - return "current"; - }, duration); - }); -}); diff --git a/tests/visual/effects/effects.all.css b/tests/visual/effects/effects.css similarity index 83% rename from tests/visual/effects/effects.all.css rename to tests/visual/effects/effects.css index 1d531b0262..460019f240 100644 --- a/tests/visual/effects/effects.all.css +++ b/tests/visual/effects/effects.css @@ -1,13 +1,9 @@ - -body,html { - margin: 0; +body { + margin: 1em; padding: 0; - font-size: 12px; - font-family: Arial; background: #191919; color: #fff; } -body { margin: 1em; } ul.effects { list-style-type: none; @@ -16,8 +12,6 @@ ul.effects { } ul.effects li { - list-style-type: none; - margin: 0; padding: 0; width: 120px; height: 100px; @@ -44,7 +38,7 @@ div.current { div.effect p { color: #191919; font-weight: bold; - margin: 0px; + margin: 0; padding: 10px; } diff --git a/tests/visual/effects/effects.js b/tests/visual/effects/effects.js new file mode 100644 index 0000000000..624e0b128a --- /dev/null +++ b/tests/visual/effects/effects.js @@ -0,0 +1,107 @@ +$(function() { + +var duration = 1000, + wait = 500; + +function effect( elem, name, options ) { + $.extend( options, { + easing: "easeOutQuint" + }); + + $( elem ).click(function() { + $( this ) + .addClass( "current" ) + // delaying the initial animation makes sure that the queue stays in tact + .delay( 10 ) + .hide( name, options, duration ) + .delay( wait ) + .show( name, options, duration, function() { + $( this ).removeClass( "current" ); + }); + }); +} + +$( "#hide" ).click(function() { + $( this ) + .addClass( "current" ) + .hide( duration ) + .delay( wait ) + .show( duration, function() { + $( this ).removeClass( "current" ); + }); +}); + +effect( "#blindLeft", "blind", { direction: "left" } ); +effect( "#blindUp", "blind", { direction: "up" } ); +effect( "#blindRight", "blind", { direction: "right" } ); +effect( "#blindDown", "blind", { direction: "down" } ); + +effect( "#bounce3times", "bounce", { times: 3 } ); + +effect( "#clipHorizontally", "clip", { direction: "horizontal" } ); +effect( "#clipVertically", "clip", { direction: "vertical" } ); + +effect( "#dropDown", "drop", { direction: "down" } ); +effect( "#dropUp", "drop", { direction: "up" } ); +effect( "#dropLeft", "drop", { direction: "left" } ); +effect( "#dropRight", "drop", { direction: "right" } ); + +effect( "#explode9", "explode", {} ); +effect( "#explode36", "explode", { pieces: 36 } ); + +effect( "#fade", "fade", {} ); + +effect( "#fold", "fold", { size: 50 } ); + +effect( "#highlight", "highlight", {} ); + +effect( "#pulsate", "pulsate", { times: 2 } ); + +effect( "#puff", "puff", { times: 2 } ); +effect( "#scale", "scale", {} ); +effect( "#size", "size", {} ); +$( "#sizeToggle" ).click(function() { + var options = { to: { width: 300, height: 300 } }; + $( this ) + .addClass( "current" ) + .toggle( "size", options, duration ) + .delay( wait ) + .toggle( "size", options, duration, function() { + $( this ).removeClass( "current" ); + }); +}); + +$( "#shake" ).click(function() { + $( this ) + .addClass( "current" ) + .effect( "shake", {}, 100, function() { + $( this ).removeClass( "current" ); + }); +}); + +effect( "#slideDown", "slide", { direction: "down" } ); +effect( "#slideUp", "slide", { direction: "up" } ); +effect( "#slideLeft", "slide", { direction: "left" } ); +effect( "#slideRight", "slide", { direction: "right" } ); + +$( "#transfer" ).click(function() { + $( this ) + .addClass( "current" ) + .effect( "transfer", { to: "div:eq(0)" }, 1000, function() { + $( this ).removeClass( "current" ); + }); +}); + +$( "#addClass" ).click(function() { + $( this ).addClass( "current", duration, function() { + $( this ).removeClass( "current" ); + }); +}); +$( "#removeClass" ).click(function() { + $( this ).addClass( "current" ).removeClass( "current", duration ); +}); +$( "#toggleClass" ).click(function() { + $( this ).toggleClass( "current", duration ); +}); + +}); diff --git a/tests/visual/effects/effects.scale.html b/tests/visual/effects/scale.html similarity index 95% rename from tests/visual/effects/effects.scale.html rename to tests/visual/effects/scale.html index 708543257d..add2ba01c3 100644 --- a/tests/visual/effects/effects.scale.html +++ b/tests/visual/effects/scale.html @@ -3,13 +3,12 @@ jQuery UI Effects Test Suite - + - - - - - -

    Using button elements

    - -
    - - - - - - - - - - - - - -
    - -

    Using anchor elements

    - - - - - -

    Using label elements (used when proxying to radio or check inputs)

    - -
    - - - - - - - - - - - - - -
    - - -

    Button Sets

    - -
    - - - - -
    - - - - - - - diff --git a/tests/static/datepicker/datepicker.html b/tests/static/datepicker/datepicker.html deleted file mode 100644 index 857677cfd4..0000000000 --- a/tests/static/datepicker/datepicker.html +++ /dev/null @@ -1,1367 +0,0 @@ - - - - - jQuery UI Datepicker Static Markup Test Page - - - - - - - - - - -
    -
    - Prev - Next -
    - December - 2008 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    123456
    78910111213
    14151617181920
    21222324252627
    28293031
    -
    - - -
    -
    - Prev - Next -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    123456
    78910111213
    14151617181920
    21222324252627
    28293031
    -
    - - -
    -
    - Prev - Next -
    - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    123456
    78910111213
    14151617181920
    21222324252627
    28293031
    -
    - - -
    -
    - Prev - Next -
    - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    123456
    78910111213
    14151617181920
    21222324252627
    28293031
    -
    - - -
    -
    - - -
    -
    -
    - Prev -
    - December - 2008 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    -
    - Next -
    - January - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    - - -
    -
    -
    - Prev -
    - December - 2008 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    -
    -
    - January - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    -
    - Next -
    - February - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    - - -
    -
    - - -
    -
    -
    - Prev -
    - December - 2008 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    -
    -
    - January - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031
    -
    -
    -
    -
    - February - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    -
    - Next -
    - March - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    - -
    -
    -
    -
    - April - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    -
    -
    - May - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    -
    -
    - June - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    -
    -
    -
    - July - 2009 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031
    -
    -
    - - - diff --git a/tests/static/datepicker/default.html b/tests/static/datepicker/default.html deleted file mode 100644 index 5baebaf4cc..0000000000 --- a/tests/static/datepicker/default.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - Datepicker Static Test : Default - - - - - - - - -
    -
    - Prev - Next -
    - December - 2008 -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SuMoTuWeThFrSa
    - 123456
    78910111213
    14151617181920
    21222324252627
    28293031 - - -
    -
    - - - diff --git a/tests/static/icons.html b/tests/static/icons.html deleted file mode 100644 index d3ae3e3485..0000000000 --- a/tests/static/icons.html +++ /dev/null @@ -1,314 +0,0 @@ - - - - - jQuery UI CSS Framework Icons Test Page - - - - - - - - - - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - diff --git a/tests/static/static.css b/tests/static/static.css deleted file mode 100644 index 60f25b59a3..0000000000 --- a/tests/static/static.css +++ /dev/null @@ -1 +0,0 @@ -body { font-size: 62.5%; } diff --git a/tests/static/static.js b/tests/static/static.js deleted file mode 100644 index 1c29079ef5..0000000000 --- a/tests/static/static.js +++ /dev/null @@ -1,9 +0,0 @@ -/* static_helpers.js - */ -$(function(){ - //add hover states on the static widgets - $('.ui-state-default:not(.ui-state-disabled, .ui-slider-range, .ui-progressbar-value), a.ui-datepicker-next, a.ui-datepicker-prev, .ui-dialog-titlebar-close').hover( - function(){ $(this).addClass('ui-state-hover'); }, - function(){ $(this).removeClass('ui-state-hover'); } - ); -}); From c0f6b0ccdf69c705a03e30778ae318e0cd8a0625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Tue, 15 May 2012 16:43:47 -0400 Subject: [PATCH 13/80] Tests: Cleaned up index pages. Fixes #7374 - Broken link to Static and Visual tests (Index of Static and Visual tests do not exist). --- tests/index.css | 21 ++++++++++ tests/index.html | 35 ++++++++++------ tests/index.js | 10 +++++ tests/unit/index.html | 34 +--------------- tests/visual/index.html | 90 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 44 deletions(-) create mode 100644 tests/index.css create mode 100644 tests/index.js create mode 100644 tests/visual/index.html diff --git a/tests/index.css b/tests/index.css new file mode 100644 index 0000000000..2034cfba5a --- /dev/null +++ b/tests/index.css @@ -0,0 +1,21 @@ +body { + font-size: 62.5%; +} +.ui-widget-header { + padding: 0.2em 0.5em; + margin: 0; +} +.ui-widget-content { + padding: 1em; + margin-bottom: 1em; +} +p { + margin: 0; +} +ul { + margin: 0; + list-style: none; +} +li { + line-height: 2em; +} diff --git a/tests/index.html b/tests/index.html index 3c66bf38fc..d4b3f4a8d5 100644 --- a/tests/index.html +++ b/tests/index.html @@ -1,22 +1,33 @@ - + - + jQuery UI Tests - - - - + + + + + -

    jQuery UI Tests

    +
    +

    jQuery UI Tests

    +
    +

    Unit Tests

    +

    Unit tests exist for all functionality in jQuery UI. + The unit tests can be run locally (some tests require a web server with PHP) + to ensure proper functionality before committing changes. + The unit tests are also run on TestSwarm + for every commit.

    -

    Static Tests

    - -

    Unit Tests

    - -

    Visual Tests

    +

    Visual Tests

    +

    Visual tests only exist in cases where we can't verify proper functionality + with unit tests. These may be either purely visual or just hard to automate. + Most visual tests will provide a description of what is happening on the page + and what to look for.

    +
    +
    diff --git a/tests/index.js b/tests/index.js new file mode 100644 index 0000000000..26c07498f0 --- /dev/null +++ b/tests/index.js @@ -0,0 +1,10 @@ +$(function() { + +$( "#main" ) + .addClass( "ui-widget" ) + .find( "h1, h2" ) + .addClass( "ui-widget-header ui-corner-top" ) + .next() + .addClass( "ui-widget-content ui-corner-bottom" ); + +}); diff --git a/tests/unit/index.html b/tests/unit/index.html index b73ede29cb..e2dd9069a2 100644 --- a/tests/unit/index.html +++ b/tests/unit/index.html @@ -6,39 +6,9 @@ - - + - + diff --git a/tests/visual/index.html b/tests/visual/index.html new file mode 100644 index 0000000000..4e524cdccc --- /dev/null +++ b/tests/visual/index.html @@ -0,0 +1,90 @@ + + + + + jQuery UI Visual Tests + + + + + + + + + +
    +

    jQuery UI Visual Tests

    +
    +

    Accordion

    + + +

    addClass

    + + +

    Button

    + + +

    Dialog

    + + +

    Effects

    + + +

    Menu

    + + +

    Position

    + + +

    Tooltip

    + + +

    Compound

    + + +

    General

    + +
    +
    + + + From f4b2d7a4115814b64ff291e3518fe15f2dfbe390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Tue, 15 May 2012 14:07:35 +0200 Subject: [PATCH 14/80] Autocomplete: ARIA live region as extension, adding a messages option. Fixes #7840 - Autocomplete: popup results not read by screen-readers --- demos/autocomplete/multiple-remote.html | 3 +- demos/autocomplete/multiple.html | 5 +- .../unit/autocomplete/autocomplete_common.js | 4 ++ tests/unit/menu/menu_common.js | 1 + ui/jquery.ui.autocomplete.js | 48 +++++++++++++++---- ui/jquery.ui.menu.js | 26 ++++++---- 6 files changed, 68 insertions(+), 19 deletions(-) diff --git a/demos/autocomplete/multiple-remote.html b/demos/autocomplete/multiple-remote.html index 378e449d5f..00d7399676 100644 --- a/demos/autocomplete/multiple-remote.html +++ b/demos/autocomplete/multiple-remote.html @@ -47,7 +47,8 @@ } }, focus: function() { - // prevent value inserted on focus + // prevent value inserted on focus, update liveRegion instead + $( this ).data( "autocomplete" ).liveRegion.text( ui.item.label ); return false; }, select: function( event, ui ) { diff --git a/demos/autocomplete/multiple.html b/demos/autocomplete/multiple.html index e3f84b65d0..3d1326591a 100644 --- a/demos/autocomplete/multiple.html +++ b/demos/autocomplete/multiple.html @@ -59,8 +59,9 @@ response( $.ui.autocomplete.filter( availableTags, extractLast( request.term ) ) ); }, - focus: function() { - // prevent value inserted on focus + focus: function( event, ui ) { + // prevent value inserted on focus, update liveRegion instead + $( this ).data( "autocomplete" ).liveRegion.text( ui.item.label ); return false; }, select: function( event, ui ) { diff --git a/tests/unit/autocomplete/autocomplete_common.js b/tests/unit/autocomplete/autocomplete_common.js index c090ce4dfb..e1d24ef8db 100644 --- a/tests/unit/autocomplete/autocomplete_common.js +++ b/tests/unit/autocomplete/autocomplete_common.js @@ -4,6 +4,10 @@ TestHelpers.commonWidgetTests( "autocomplete", { autoFocus: false, delay: 300, disabled: false, + messages: { + noResults: "No search results.", + results: $.ui.autocomplete.prototype.options.messages.results + }, minLength: 1, position: { my: "left top", diff --git a/tests/unit/menu/menu_common.js b/tests/unit/menu/menu_common.js index ddcdbebf2d..07295f1af0 100644 --- a/tests/unit/menu/menu_common.js +++ b/tests/unit/menu/menu_common.js @@ -6,6 +6,7 @@ TestHelpers.commonWidgetTests( "menu", { my: "left top", at: "right top" }, + role: "menu", // callbacks blur: null, diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index fab9691a34..fa15bc2788 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -60,13 +60,7 @@ $.widget( "ui.autocomplete", { this.element .addClass( "ui-autocomplete-input" ) - .attr( "autocomplete", "off" ) - // TODO verify these actually work as intended - .attr({ - role: "textbox", - "aria-autocomplete": "list", - "aria-haspopup": "true" - }); + .attr( "autocomplete", "off" ); this._bind({ keydown: function( event ) { @@ -188,7 +182,9 @@ $.widget( "ui.autocomplete", { .appendTo( this.document.find( this.options.appendTo || "body" )[0] ) .menu({ // custom key handling for now - input: $() + input: $(), + // disable ARIA support, the live region takes care of that + role: null }) .zIndex( this.element.zIndex() + 1 ) .hide() @@ -532,4 +528,40 @@ $.extend( $.ui.autocomplete, { } }); + +// live region extension, adding a `messages` option +$.widget( "ui.autocomplete", $.ui.autocomplete, { + options: { + messages: { + noResults: "No search results.", + results: function(amount) { + return amount + ( amount > 1 ? " results are" : " result is" ) + " available, use up and down arrow keys to navigate."; + } + } + }, + _create: function() { + this._super(); + this.liveRegion = $( "", { + role: "status", + "aria-live": "polite" + }) + .addClass( "ui-helper-hidden-accessible" ) + .insertAfter( this.element ); + }, + __response: function( content ) { + var message; + this._superApply( arguments ); + if ( this.options.disabled || this.cancelSearch) { + return; + } + if ( content && content.length ) { + message = this.options.messages.results( content.length ); + } else { + message = this.options.messages.noResults; + } + this.liveRegion.text( message ); + } +}); + + }( jQuery )); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 7704521fbe..36f7e1de4c 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -26,6 +26,7 @@ $.widget( "ui.menu", { my: "left top", at: "right top" }, + role: "menu", // callbacks blur: null, @@ -42,7 +43,7 @@ $.widget( "ui.menu", { .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) .attr({ id: this.menuId, - role: "menu", + role: this.options.role, tabIndex: 0 }) // need to catch all clicks on disabled menu @@ -267,7 +268,7 @@ $.widget( "ui.menu", { .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) .hide() .attr({ - role: "menu", + role: this.options.role, "aria-hidden": "true", "aria-expanded": "false" }); @@ -281,7 +282,7 @@ $.widget( "ui.menu", { .children( "a" ) .addClass( "ui-corner-all" ) .attr( "tabIndex", -1 ) - .attr( "role", "menuitem" ) + .attr( "role", this._itemRole() ) .attr( "id", function( i ) { return menuId + "-" + i; }); @@ -302,8 +303,15 @@ $.widget( "ui.menu", { }); }, + _itemRole: function() { + return { + menu: "menuitem", + listbox: "option" + }[ this.options.role ]; + }, + focus: function( event, item ) { - var nested, borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; + var nested, borderTop, paddingTop, offset, scroll, elementHeight, itemHeight, focused; this.blur( event, event && event.type === "focus" ); if ( this._hasScroll() ) { @@ -322,10 +330,12 @@ $.widget( "ui.menu", { } this.active = item.first(); - this.element.attr( "aria-activedescendant", - this.active.children( "a" ) - .addClass( "ui-state-focus" ) - .attr( "id" ) ); + focused = this.active.children( "a" ).addClass( "ui-state-focus" ); + // only update aria-activedescendant if there's a role + // otherwise we assume focus is managed elsewhere + if ( this.options.role ) { + this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); + } // highlight active parent menu item, if any this.active.parent().closest( ".ui-menu-item" ).children( "a:first" ).addClass( "ui-state-active" ); From 00086a8ab38ee55deeef78fa787ecfe9314185a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 16 May 2012 09:23:40 -0400 Subject: [PATCH 15/80] Readme: Added notes about running unit tests and creating builds. --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index edd7797ebb..f2845df4c8 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,36 @@ pull request for that branch. Don't mix unrelated changes. You can use the commi message as the description for the pull request. +Running the Unit Tests +--- + +Run the unit tests with a local server that supports PHP. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options: + +- Windows: [WAMP download](http://www.wampserver.com/en/) +- Mac: [MAMP download](http://www.mamp.info/en/index.html) +- Linux: [Setting up LAMP](https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation) +- [Mongoose (most platforms)](http://code.google.com/p/mongoose/) + + +Building jQuery UI +--- + +jQuery UI uses the [grunt](http://github.com/cowboy/grunt) build system. Building jQuery UI requires node.js and a command line zip program. + +Clone the jQuery UI git repo. + +`git clone git://github.com/jquery/jquery-ui.git` +`cd jquery-ui` + +Install node modules. + +`npm install` + +Run grunt. + +`grunt build` + + For committers --- When looking at pull requests, first check for [proper commit messages](http://wiki.jqueryui.com/w/page/12137724/Bug-Fixing-Guide). From 5912d36374499e15d8d184df5ca122a4c4a4990f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 16 May 2012 09:27:26 -0400 Subject: [PATCH 16/80] Readme: Added more details about landing pull requests. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f2845df4c8..aa47ea1670 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ To discuss development with team members and the community, visit the [Developin For contributors --- + If you want to help and provide a patch for a bugfix or new feature, please take a few minutes and look at [our Getting Involved guide](http://wiki.jqueryui.com/w/page/35263114/Getting-Involved). In particular check out the [Coding standards](http://wiki.jqueryui.com/w/page/12137737/Coding-standards) @@ -53,9 +54,15 @@ Run grunt. For committers --- + When looking at pull requests, first check for [proper commit messages](http://wiki.jqueryui.com/w/page/12137724/Bug-Fixing-Guide). Do not merge pull requests directly through GitHub's interface. +Most pull requests are a single commit; cherry-picking will avoid creating a merge commit. +It's also common for contributors to make minor fixes in an additional one or two commits. +These should be squashed before landing in master. + +**Make sure the author has a valid name and email address associated with the commit.** Fetch the remote first: From 85639bf0fa39427d8de1dc60131f746045ba4ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 16 May 2012 09:43:49 -0400 Subject: [PATCH 17/80] Autocomplete: Update live region if focus event is canceled. Remove live region on destroy. --- demos/autocomplete/multiple-remote.html | 3 +-- demos/autocomplete/multiple.html | 5 ++--- ui/jquery.ui.autocomplete.js | 30 ++++++++++++++++--------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/demos/autocomplete/multiple-remote.html b/demos/autocomplete/multiple-remote.html index 00d7399676..378e449d5f 100644 --- a/demos/autocomplete/multiple-remote.html +++ b/demos/autocomplete/multiple-remote.html @@ -47,8 +47,7 @@ } }, focus: function() { - // prevent value inserted on focus, update liveRegion instead - $( this ).data( "autocomplete" ).liveRegion.text( ui.item.label ); + // prevent value inserted on focus return false; }, select: function( event, ui ) { diff --git a/demos/autocomplete/multiple.html b/demos/autocomplete/multiple.html index 3d1326591a..e3f84b65d0 100644 --- a/demos/autocomplete/multiple.html +++ b/demos/autocomplete/multiple.html @@ -59,9 +59,8 @@ response( $.ui.autocomplete.filter( availableTags, extractLast( request.term ) ) ); }, - focus: function( event, ui ) { - // prevent value inserted on focus, update liveRegion instead - $( this ).data( "autocomplete" ).liveRegion.text( ui.item.label ); + focus: function() { + // prevent value inserted on focus return false; }, select: function( event, ui ) { diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index fa15bc2788..1fc01d7a4d 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -228,6 +228,13 @@ $.widget( "ui.autocomplete", { if ( /^key/.test(event.originalEvent.type) ) { this._value( item.value ); } + } else { + // Normally the input is populated with the item's value as the + // menu is navigated, causing screen readers to notice a change and + // announce the item. Since the focus event was canceled, this doesn't + // happen, so we update the live region so that screen readers can + // still notice the change and announce it. + this.liveRegion.text( item.value ); } }, menuselect: function( event, ui ) { @@ -261,6 +268,13 @@ $.widget( "ui.autocomplete", { } }); + this.liveRegion = $( "", { + role: "status", + "aria-live": "polite" + }) + .addClass( "ui-helper-hidden-accessible" ) + .insertAfter( this.element ); + if ( $.fn.bgiframe ) { this.menu.element.bgiframe(); } @@ -284,6 +298,7 @@ $.widget( "ui.autocomplete", { .removeAttr( "aria-autocomplete" ) .removeAttr( "aria-haspopup" ); this.menu.element.remove(); + this.liveRegion.remove(); }, _setOption: function( key, value ) { @@ -530,24 +545,19 @@ $.extend( $.ui.autocomplete, { // live region extension, adding a `messages` option +// NOTE: This is an experimental API. We are still investigating +// a full solution for string manipulation and internationalization. $.widget( "ui.autocomplete", $.ui.autocomplete, { options: { messages: { noResults: "No search results.", results: function(amount) { - return amount + ( amount > 1 ? " results are" : " result is" ) + " available, use up and down arrow keys to navigate."; + return amount + ( amount > 1 ? " results are" : " result is" ) + + " available, use up and down arrow keys to navigate."; } } }, - _create: function() { - this._super(); - this.liveRegion = $( "", { - role: "status", - "aria-live": "polite" - }) - .addClass( "ui-helper-hidden-accessible" ) - .insertAfter( this.element ); - }, + __response: function( content ) { var message; this._superApply( arguments ); From 90705cdffe58b0448a4520fef922ec7f28afd722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 16 May 2012 17:14:50 -0400 Subject: [PATCH 18/80] Tabs: Preparing for when jQuery starts always returning jqXHR objects from $.ajax(). --- ui/jquery.ui.tabs.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 7198a4180d..8a6b2ba2e5 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -513,7 +513,10 @@ $.widget( "ui.tabs", { } }); - if ( this.xhr ) { + // support: jQuery <1.8 + // jQuery <1.8 returns false if the request is canceled in beforeSend, + // but as of 1.8, $.ajax() always returns a jqXHR object. + if ( this.xhr && this.xhr.statusText !== "canceled" ) { this.lis.eq( index ).addClass( "ui-tabs-loading" ); this.xhr From a88b94ebeb2ed43c72936b254df8bdc211a56f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 16 May 2012 19:22:49 -0400 Subject: [PATCH 19/80] Tabs: Update todo to reference newer ticket. --- ui/jquery.ui.tabs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 8a6b2ba2e5..23c6ed58d6 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -521,16 +521,16 @@ $.widget( "ui.tabs", { this.xhr .success(function( response ) { - // TODO: IE resolves cached XHRs immediately - // remove when core #10467 is fixed + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 setTimeout(function() { panel.html( response ); that._trigger( "load", event, eventData ); }, 1 ); }) .complete(function( jqXHR, status ) { - // TODO: IE resolves cached XHRs immediately - // remove when core #10467 is fixed + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 setTimeout(function() { if ( status === "abort" ) { that.panels.stop( false, true ); From 980657f3a9eadccb62a57b536193ee5814acbf15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 17 May 2012 10:00:22 -0400 Subject: [PATCH 20/80] Updated authors. --- AUTHORS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AUTHORS.txt b/AUTHORS.txt index f115bdf618..d7cb18d167 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -185,3 +185,5 @@ Lukasz Lipinski Timo Tijhof Jason Moon Martin Frost +Eneko Illarramendi +EungJun Yi From 19458be48372bd99dc8093b616c43ab15f7d5676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 17 May 2012 10:04:50 -0400 Subject: [PATCH 21/80] Tagging 1.9.0m8. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8a83f3f944..0a1773ce1e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "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", + "version": "1.9.0m8", "homepage": "https://github.com/jquery/jquery-ui", "author": { "name": "AUTHORS.txt" From 155e3334b076419893755a0299ab4b639a1d0ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 17 May 2012 10:05:49 -0400 Subject: [PATCH 22/80] Updating version to 1.9.0pre. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a1773ce1e..8a83f3f944 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "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.0m8", + "version": "1.9.0pre", "homepage": "https://github.com/jquery/jquery-ui", "author": { "name": "AUTHORS.txt" From f67b69a288a05c4ab4a020ff1010a1e902ec18d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 17 May 2012 19:46:43 -0400 Subject: [PATCH 23/80] Effects: Lint fixes. --- grunt.js | 2 +- ui/jquery.effects.core.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/grunt.js b/grunt.js index 98e8b30f55..49f359a21a 100644 --- a/grunt.js +++ b/grunt.js @@ -289,7 +289,7 @@ grunt.initConfig({ lint: { ui: grunt.file.expandFiles( "ui/*.js" ).filter(function( file ) { // TODO remove items from this list once rewritten - return !( /(effects.core|mouse|datepicker|draggable|droppable|resizable|selectable|sortable)\.js$/ ).test( file ); + return !( /(mouse|datepicker|draggable|droppable|resizable|selectable|sortable)\.js$/ ).test( file ); }), grunt: "grunt.js", tests: "tests/unit/**/*.js" diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index fe2bf298da..1bb1415a90 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -54,27 +54,27 @@ function getRGB(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)) { + 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)) { + 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)) { + 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)) { + 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)) { + if ( (result = /rgba\(0, 0, 0, 0\)/.exec(color)) ) { return colors.transparent; } @@ -94,7 +94,7 @@ function getColor(elem, attr) { } attr = "backgroundColor"; - } while ( elem = elem.parentNode ); + } while ( (elem = elem.parentNode) ); return getRGB(color); } From 00aa28b7288735e2ada724d6a554e97086e4b662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Fri, 18 May 2012 13:39:06 +0200 Subject: [PATCH 24/80] Grunt: Increase TestSwarm timeout to 30 minutes --- grunt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 49f359a21a..5d65fa037b 100644 --- a/grunt.js +++ b/grunt.js @@ -376,7 +376,7 @@ grunt.registerTask( "testswarm", function( commit, configFile ) { testswarm({ url: "http://swarm.jquery.org/", pollInterval: 10000, - timeout: 1000 * 60 * 20, + timeout: 1000 * 60 * 30, done: this.async() }, { authUsername: "jqueryui", From 70ce3f1f7024523c1daba20eedfaf4aca903149b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Fri, 18 May 2012 15:08:43 +0200 Subject: [PATCH 25/80] Menu: Remove drilldown visual test, broken and superceded by James Rosen's implementation --- tests/visual/index.html | 1 - tests/visual/menu/drilldown.html | 267 ------------------------------- 2 files changed, 268 deletions(-) delete mode 100644 tests/visual/menu/drilldown.html diff --git a/tests/visual/index.html b/tests/visual/index.html index 4e524cdccc..85c725c948 100644 --- a/tests/visual/index.html +++ b/tests/visual/index.html @@ -45,7 +45,6 @@

    Menu

    diff --git a/tests/visual/menu/drilldown.html b/tests/visual/menu/drilldown.html deleted file mode 100644 index 7b40fc62f2..0000000000 --- a/tests/visual/menu/drilldown.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - Menu Visual Test: Default - - - - - - - - - - - - - - -
    -

    Make a selection...

    - - Go back -
    - -
    - Log: -
    -
    - - - From 8bd0426e367b411b7631464d4e7157a50a641f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Fri, 18 May 2012 15:10:44 +0200 Subject: [PATCH 26/80] Menu: Remove tablemenu visual test, broken and not interesting --- tests/visual/index.html | 1 - tests/visual/menu/tablemenu.html | 68 -------------------------------- 2 files changed, 69 deletions(-) delete mode 100644 tests/visual/menu/tablemenu.html diff --git a/tests/visual/index.html b/tests/visual/index.html index 85c725c948..c8caa6bcee 100644 --- a/tests/visual/index.html +++ b/tests/visual/index.html @@ -45,7 +45,6 @@

    Menu

    Position

    diff --git a/tests/visual/menu/tablemenu.html b/tests/visual/menu/tablemenu.html deleted file mode 100644 index ca4345aed2..0000000000 --- a/tests/visual/menu/tablemenu.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Menu Visual Test: Default - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FirstnameLastname
    ScottGonzo
    RichyWorth
    - -
    - Log: -
    -
    - - - - - - From 5fa6821897a739b3fc22f9cf1e75d40ac4895827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Fri, 18 May 2012 15:15:00 +0200 Subject: [PATCH 27/80] Menu: Update default visual test, add headings and fix disable/destroy toggle buttons --- tests/visual/menu/menu.html | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/visual/menu/menu.html b/tests/visual/menu/menu.html index 548f25db4c..ba4017e659 100644 --- a/tests/visual/menu/menu.html +++ b/tests/visual/menu/menu.html @@ -40,16 +40,17 @@ }); } - var menus = $("#menu1, #menu2, #menu3, .menu4"); + var menus = $("#menu1, #menu2, #menu3, .menu4"), + all = menus.add("#menu5, #menu6"); create(); $("#toggle-destroy").toggle(function() { - menus.menu("destroy"); + all.menu("destroy"); }, create); $("#toggle-disable").toggle(function() { - menus.menu("disable"); + all.menu("disable"); }, function() { - menus.menu("enable"); + all.menu("enable"); }); }); @@ -64,6 +65,7 @@ +

    Default inline menu

    +

    Inline with disabled items and submenus

    +

    Menu with icons

    +

    Long menu with scroll overflow, to test menu's scroll-on-keypress behaviour

    +

    Menu with custom markup

    +

    Menu with custom markup, multi-line items

  • Nested Widgets
  • Sortable Tabs in Sortable Accordion
  • Nested Tabs
  • -
  • Tabs with Tooltips
  • +
  • Tabs with Tooltips
  • General

    From 627d27fea23f1fb50db6c9ad8a2ff264505a0f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Fri, 18 May 2012 16:04:54 +0200 Subject: [PATCH 30/80] Menu: Tests for role option --- tests/unit/menu/menu_core.js | 13 ------------- tests/unit/menu/menu_options.js | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js index f2de7ef1aa..68b625687e 100644 --- a/tests/unit/menu/menu_core.js +++ b/tests/unit/menu/menu_core.js @@ -26,17 +26,4 @@ test("accessibility", function () { equal( menu.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id"); }); -test("items class and role", function () { - var menu = $('#menu1').menu(); - expect(1 + 5 * $("li",menu).length); - ok( ($("li",menu).length > 0 ), "number of menu items"); - $("li",menu).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 + ") "); - }); -}); - })(jQuery); diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js index e651fd2d11..306f575ea6 100644 --- a/tests/unit/menu/menu_options.js +++ b/tests/unit/menu/menu_options.js @@ -38,4 +38,30 @@ test( "{ disabled: false }", function() { equal( $("#log").html(), "afterclick,1,click,", "Click order not valid."); }); +test("{ role: 'menu' } ", function () { + var menu = $('#menu1').menu(); + expect(2 + 5 * $("li", menu).length); + equal( menu.attr( "role" ), "menu" ); + ok( $("li", menu).length > 0, "number of menu items"); + $("li", menu).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 + ") "); + }); +}); + +test("{ role: 'listbox' } ", function () { + var menu = $('#menu1').menu({ + role: "listbox" + }); + expect(2 + $("li", menu).length); + equal( menu.attr( "role" ), "listbox" ); + ok( ($("li", menu).length > 0 ), "number of menu items"); + $("li", menu).each(function(item) { + equal( $("a", this).attr("role"), "option", "menu item ("+ item + ") role"); + }); +}); + })(jQuery); From 15ccc1ad7a2de6bde1ce0c34f41fb441bdbecaf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 09:43:54 -0400 Subject: [PATCH 31/80] Tooltip: Cleaned up visual test. --- tests/visual/tooltip/tooltip.html | 308 +++++++++++++++--------------- 1 file changed, 153 insertions(+), 155 deletions(-) diff --git a/tests/visual/tooltip/tooltip.html b/tests/visual/tooltip/tooltip.html index da811645cb..e0ff27aa8a 100644 --- a/tests/visual/tooltip/tooltip.html +++ b/tests/visual/tooltip/tooltip.html @@ -1,121 +1,104 @@ - + Tooltip Visual Test: Default - - - - - - - - - - + + + + + + + -
    -
      +
      +

      Lots of tooltipped elements close together.
      + Mouse through them quickly and slowly.

      + -
      - collision detection should kick in around here +
      +

      These elements are right aligned.
      + One collides and one uses custom position.

      +

      + collision detection should kick in around here +

      +

      + right aligned with custom position +

      - - -
      - right aligned with custom position -
      - -
      - gets its content via ajax -
      -
      - gets its content via ajax, caches the response -
      - -
      - span -
      - div - nested span +
      +

      These footnotes pull content form the elements they link to.

      +
      -
      - Text in bold. -
      - -
      -
      - - +
      +

      These elements load their content asynchronously.
      + There should be a loading message while the content is retrieved.

      +
      + async
      -
      - - +
      + async + cache
      - - -
      - - - -
      -
      - - - - +
      +

      Nested elements.

      +
      +
      + tooltipped + nested tooltipped +
      +
      +
      + Text in bold. +
      -
      This is the footnote, including other elements
      -
      This is the other footnote, including other elements
      +
      +

      Play around with focusing and hovering of form elements.

      +
      +
      + + +
      +
      + + +
      +
      - - +

      Some inputs nested inside labels:

      +
      + + + + +
      + +

      Some button widgets:

      +
      + + + + +
      +
      + +
      +
      This is the footnote, including other elements
      +
      This is the other footnote, including other elements
      +
      From 0b205572bf15f71388238a4f37f7bfd7077eac8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 09:44:56 -0400 Subject: [PATCH 32/80] Tooltip visual tests: Removed now-unused ajax content. --- tests/visual/tooltip/ajaxcontent.php | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 tests/visual/tooltip/ajaxcontent.php diff --git a/tests/visual/tooltip/ajaxcontent.php b/tests/visual/tooltip/ajaxcontent.php deleted file mode 100644 index a689a734dc..0000000000 --- a/tests/visual/tooltip/ajaxcontent.php +++ /dev/null @@ -1,2 +0,0 @@ - -Hello world! \ No newline at end of file From 63915d16af8e2795a7def28155bc9b14ca2f67d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 10:07:27 -0400 Subject: [PATCH 33/80] Tooltip visual tests: Cleaned up animation tests. --- tests/visual/tooltip/animations.html | 122 +++++++++++++-------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/tests/visual/tooltip/animations.html b/tests/visual/tooltip/animations.html index 38ee28f1df..24fe02905f 100644 --- a/tests/visual/tooltip/animations.html +++ b/tests/visual/tooltip/animations.html @@ -1,73 +1,73 @@ - + - Tooltip Visual Test: Default - - - - - - - - - - - - - - - + + + + + + + + + + + -
      -
        -
      -
      +
      {}
      +
      {
      +  "show": {
      +    "effect": "slideDown"
      +  },
      +  "hide": {
      +    "effect": "slideUp"
      +  }
      +}
      +
      {
      +  "show": {
      +    "effect": "explode"
      +  },
      +  "hide": {
      +    "effect": "explode"
      +  }
      +}
      +
      {
      +  "show": {
      +    "effect": "bounce"
      +  },
      +  "hide": {
      +    "effect": "blind"
      +  }
      +}
      +
      {
      +  "show": {
      +    "effect": "drop",
      +    "direction": "right"
      +  },
      +  "hide": {
      +    "effect": "drop",
      +    "direction": "right"
      +  }
      +}
      + From b52c4ece53a8c3cd12adfd988fac13e9db851e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 10:40:44 -0400 Subject: [PATCH 34/80] Menu visual tests: cleanup. --- tests/visual/menu/menu.html | 49 +++++++++++++++---------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/tests/visual/menu/menu.html b/tests/visual/menu/menu.html index b73588bcec..f92de61dbc 100644 --- a/tests/visual/menu/menu.html +++ b/tests/visual/menu/menu.html @@ -3,39 +3,30 @@ Menu Visual Test: Default - - - - - - - - + + + + + @@ -266,9 +257,9 @@
      -
      +
      Log: -
      +
      From c54986457279db18bce5ae3858142906f786855e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 11:31:01 -0400 Subject: [PATCH 35/80] Tests: Use versioned jQuery files in index files. --- tests/index.html | 2 +- tests/unit/index.html | 2 +- tests/visual/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/index.html b/tests/index.html index d4b3f4a8d5..d5e364ad6e 100644 --- a/tests/index.html +++ b/tests/index.html @@ -6,7 +6,7 @@ - + diff --git a/tests/unit/index.html b/tests/unit/index.html index e2dd9069a2..33a3263703 100644 --- a/tests/unit/index.html +++ b/tests/unit/index.html @@ -7,7 +7,7 @@ - + diff --git a/tests/visual/index.html b/tests/visual/index.html index 1f9a5954ff..46615a3a4d 100644 --- a/tests/visual/index.html +++ b/tests/visual/index.html @@ -7,7 +7,7 @@ - + From ba1776a5133ae15d8db9eee86a4082fb017f65aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Fri, 18 May 2012 19:14:37 +0200 Subject: [PATCH 36/80] Position: Cleanup visual tests, keep general and feedback --- tests/visual/index.html | 6 - tests/visual/position/position.html | 262 +++++++++++++----- .../position/position_feedback_rotate.html | 109 -------- tests/visual/position/position_fit.html | 147 ---------- tests/visual/position/position_flip.html | 76 ----- tests/visual/position/position_flipfit.html | 85 ------ tests/visual/position/position_margin.html | 42 --- tests/visual/position/position_within.html | 200 ------------- 8 files changed, 186 insertions(+), 741 deletions(-) delete mode 100644 tests/visual/position/position_feedback_rotate.html delete mode 100644 tests/visual/position/position_fit.html delete mode 100644 tests/visual/position/position_flip.html delete mode 100644 tests/visual/position/position_flipfit.html delete mode 100644 tests/visual/position/position_margin.html delete mode 100644 tests/visual/position/position_within.html diff --git a/tests/visual/index.html b/tests/visual/index.html index 46615a3a4d..0d5aceffae 100644 --- a/tests/visual/index.html +++ b/tests/visual/index.html @@ -51,12 +51,6 @@

      Tooltip

      diff --git a/tests/visual/position/position.html b/tests/visual/position/position.html index 64c5d2300d..6784124751 100644 --- a/tests/visual/position/position.html +++ b/tests/visual/position/position.html @@ -1,91 +1,201 @@ - + - - Position Visual Test: Default - - - - - - - - + + Position Visual Test: Containing Element + + + + + + + + + + + + -
      +
      +
      - - - - - - - - - +
      +

      This is the position parent element.

      +
      - +
      +

      to position

      +
      + +
      +

      to position 2

      +
      + +
      +

      Position configuration: +
      + my: + + +
      +
      + at: + + +
      +
      + collision: + + +
      +
      + + +
      +
      + + +
      + + +

      +
      diff --git a/tests/visual/position/position_feedback_rotate.html b/tests/visual/position/position_feedback_rotate.html deleted file mode 100644 index 11138b1125..0000000000 --- a/tests/visual/position/position_feedback_rotate.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - Position Visual Test: Default - - - - - - - - - - - - -
      all around me
      -
      - - - diff --git a/tests/visual/position/position_fit.html b/tests/visual/position/position_fit.html deleted file mode 100644 index a70423c799..0000000000 --- a/tests/visual/position/position_fit.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - Position Visual Test: Fit - - - - - - - - - - - - -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/visual/position/position_flip.html b/tests/visual/position/position_flip.html deleted file mode 100644 index b67c76fb3b..0000000000 --- a/tests/visual/position/position_flip.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - Position Visual Test: Flip - - - - - - - - - - - - -
      -
      -

      -
      -
      -
      -
      -
      -
      -
      -
      - - - - - - - - - - - - - - - diff --git a/tests/visual/position/position_flipfit.html b/tests/visual/position/position_flipfit.html deleted file mode 100644 index 840dd58680..0000000000 --- a/tests/visual/position/position_flipfit.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - Position Visual Test: FlipFit - - - - - - - - - - - - -
      -
      -

      -
      -
      -
      -

      -
      -
      -
      -
      -
      -
      -
      -
      - - - - - - - - - - - - - - - - - - diff --git a/tests/visual/position/position_margin.html b/tests/visual/position/position_margin.html deleted file mode 100644 index 2e3b632661..0000000000 --- a/tests/visual/position/position_margin.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - Position Visual Test: Default - - - - - - - - - - - -
      - - - diff --git a/tests/visual/position/position_within.html b/tests/visual/position/position_within.html deleted file mode 100644 index 692cb10676..0000000000 --- a/tests/visual/position/position_within.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - Position Visual Test: Containing Element - - - - - - - - - - - - - - - - -
      - Use the form controls to configure the positioning, or drag the positioned element to modify its offset. -
      Drag around the parent element to see collision detection in action. -
      - -
      -
      - -
      -

      This is the position parent element.

      -
      - -
      -

      to position

      -
      - -
      -

      to position 2

      -
      - -
      - position... -
      - my: - - -
      -
      - at: - - -
      -
      - offset: - -
      -
      - collision: - - -
      -
      - -
      -
      - - - From 0adc6f5e17593d6bd42e6c0586eb85000883dec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 15:34:47 -0400 Subject: [PATCH 37/80] Menu: Remove need to pass an event for next(), previous(), focus(). --- ui/jquery.ui.autocomplete.js | 4 ++-- ui/jquery.ui.menu.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 1fc01d7a4d..8ab48ba032 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -225,7 +225,7 @@ $.widget( "ui.autocomplete", { var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ); if ( false !== this._trigger( "focus", event, { item: item } ) ) { // use value to match what will end up in the input, if it was a key event - if ( /^key/.test(event.originalEvent.type) ) { + if ( event.originalEvent && /^key/.test(event.originalEvent.type) ) { this._value( item.value ); } } else { @@ -468,7 +468,7 @@ $.widget( "ui.autocomplete", { }, this.options.position )); if ( this.options.autoFocus ) { - this.menu.next( new $.Event("mouseover") ); + this.menu.next(); } }, diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 36f7e1de4c..b3f323cecb 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -340,7 +340,7 @@ $.widget( "ui.menu", { // highlight active parent menu item, if any this.active.parent().closest( ".ui-menu-item" ).children( "a:first" ).addClass( "ui-state-active" ); - if ( event.type === "keydown" ) { + if ( event && event.type === "keydown" ) { this._close(); } else { this.timer = this._delay(function() { From 098dd1404b7b6025a5735495a91ca2b964c5cb3e Mon Sep 17 00:00:00 2001 From: kborchers Date: Fri, 18 May 2012 15:55:10 -0400 Subject: [PATCH 38/80] Autocomplete: Added check to prevent accidental focus of menu-item on page load in Firefox. Fixed #7024 - Autocomplete menu options are activated even if mouse is not moved. --- ui/jquery.ui.autocomplete.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 8ab48ba032..685bbca114 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -57,6 +57,7 @@ $.widget( "ui.autocomplete", { this.isMultiLine = this.element.is( "textarea,[contenteditable]" ); this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ]; + this.isNewMenu = true; this.element .addClass( "ui-autocomplete-input" ) @@ -220,6 +221,20 @@ $.widget( "ui.autocomplete", { } }, menufocus: function( event, ui ) { + // #7024 - Prevent accidental activation of menu items in Firefox + if ( this.isNewMenu ) { + this.isNewMenu = false; + if ( event.originalEvent && /^mouse/.test(event.originalEvent.type) ) { + this.menu.blur(); + + this.document.one( "mousemove", function() { + $( event.target ).trigger( event.originalEvent ); + }); + + return; + } + } + // 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" ); @@ -422,6 +437,7 @@ $.widget( "ui.autocomplete", { if ( this.menu.element.is(":visible") ) { this.menu.element.hide(); this.menu.blur(); + this.isNewMenu = true; this._trigger( "close", event ); } }, From 5c9d9f9e9dc852ea37b7acc8c6a758f1901aa6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 16:11:14 -0400 Subject: [PATCH 39/80] Tabs: Pass the list item instead of the anchor in events; move aria-controls from the anchor to the list item. --- tests/unit/tabs/tabs.html | 2 +- tests/unit/tabs/tabs_core.js | 13 ++-- tests/unit/tabs/tabs_deprecated.html | 2 +- tests/unit/tabs/tabs_deprecated.js | 61 +++++++++--------- tests/unit/tabs/tabs_events.js | 28 ++++---- tests/unit/tabs/tabs_methods.js | 22 +++++-- tests/unit/tabs/tabs_options.js | 18 +++--- tests/unit/tabs/tabs_test_helpers.js | 2 +- ui/jquery.ui.tabs.js | 95 ++++++++++++++++------------ 9 files changed, 136 insertions(+), 107 deletions(-) diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index b961c60f3e..b9fa507d8e 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -57,7 +57,7 @@
    • 1
    • 2
    • 3
    • -
    • 4
    • +
    • 4
    • 5
    diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js index b9bd81987d..fb3c306e6b 100644 --- a/tests/unit/tabs/tabs_core.js +++ b/tests/unit/tabs/tabs_core.js @@ -47,14 +47,15 @@ test( "disconnected from DOM", function() { test( "aria-controls", function() { expect( 7 ); var element = $( "#tabs1" ).tabs(), - tabs = element.find( ".ui-tabs-nav a" ); + tabs = element.find( ".ui-tabs-nav li" ); tabs.each(function() { - var tab = $( this ); - equal( tab.prop( "hash" ).substring( 1 ), tab.attr( "aria-controls" ) ); + var tab = $( this ), + anchor = tab.find( ".ui-tabs-anchor" ); + equal( anchor.prop( "hash" ).substring( 1 ), tab.attr( "aria-controls" ) ); }); element = $( "#tabs2" ).tabs(); - tabs = element.find( ".ui-tabs-nav a" ); + tabs = element.find( ".ui-tabs-nav li" ); equal( tabs.eq( 0 ).attr( "aria-controls" ), "colon:test" ); equal( tabs.eq( 1 ).attr( "aria-controls" ), "inline-style" ); ok( /^ui-tabs-\d+$/.test( tabs.eq( 2 ).attr( "aria-controls" ) ), "generated id" ); @@ -86,11 +87,11 @@ test( "#4033 - IE expands hash to full url and misinterprets tab as ajax", funct element.tabs({ beforeLoad: function( event, ui ) { event.preventDefault(); - ok( false, 'should not be an ajax tab'); + ok( false, "should not be an ajax tab" ); } }); - equal( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" ); + equal( element.find( ".ui-tabs-nav li" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" ); state( element, 1 ); }); diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html index 09afc91b44..e58382efb1 100644 --- a/tests/unit/tabs/tabs_deprecated.html +++ b/tests/unit/tabs/tabs_deprecated.html @@ -56,7 +56,7 @@
  • 1
  • 2
  • 3
  • -
  • 4
  • +
  • 4
  • 5
  • diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js index 66768b8669..3514333483 100644 --- a/tests/unit/tabs/tabs_deprecated.js +++ b/tests/unit/tabs/tabs_deprecated.js @@ -107,11 +107,11 @@ test( "tabTemplate + panelTemplate", function() { }); element.tabs( "add", "#new", "New" ); tab = element.find( ".ui-tabs-nav li" ).last(); - anchor = tab.find( "a" ); + anchor = tab.find( ".ui-tabs-anchor" ); equal( tab.text(), "New", "label" ); ok( tab.hasClass( "customTab" ), "tab custom class" ); equal( anchor.attr( "href" ), "http://example.com/#new", "href" ); - equal( anchor.attr( "aria-controls" ), "new", "aria-controls" ); + equal( tab.attr( "aria-controls" ), "new", "aria-controls" ); ok( element.find( "#new" ).hasClass( "customPanel" ), "panel custom class" ); }); @@ -210,7 +210,7 @@ test( "selected", function() { equal( element.tabs( "option", "selected" ), 0 ); state( element, 1, 0, 0 ); - element.find( ".ui-tabs-nav a" ).eq( 1 ).click(); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 1 ).click(); equal( element.tabs( "option", "selected" ), 1 ); state( element, 0, 1, 0 ); @@ -226,17 +226,18 @@ module( "tabs (deprecated): events" ); asyncTest( "load", function() { expect( 15 ); - var tab, panelId, panel, + var tab, anchor, panelId, panel, element = $( "#tabs2" ); // init element.one( "tabsload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 2 ); + tab = element.find( ".ui-tabs-nav li" ).eq( 2 ); + anchor = tab.find( ".ui-tabs-anchor" ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); - strictEqual( ui.tab, tab[ 0 ], "tab" ); + strictEqual( ui.tab, anchor[ 0 ], "tab" ); strictEqual( ui.panel, panel[ 0 ], "panel" ); equal( $( ui.panel ).find( "p" ).length, 1, "panel html" ); state( element, 0, 0, 1, 0, 0 ); @@ -247,12 +248,13 @@ asyncTest( "load", function() { function tabsload1() { // .option() element.one( "tabsload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 3 ); + tab = element.find( ".ui-tabs-nav li" ).eq( 3 ); + anchor = tab.find( ".ui-tabs-anchor" ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); - strictEqual( ui.tab, tab[ 0 ], "tab" ); + strictEqual( ui.tab, anchor[ 0 ], "tab" ); strictEqual( ui.panel, panel[ 0 ], "panel" ); equal( $( ui.panel ).find( "p" ).length, 1, "panel html" ); state( element, 0, 0, 0, 1, 0 ); @@ -264,18 +266,19 @@ asyncTest( "load", function() { function tabsload2() { // click, change panel content element.one( "tabsload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 4 ); + tab = element.find( ".ui-tabs-nav li" ).eq( 4 ); + anchor = tab.find( ".ui-tabs-anchor" ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); equal( event.originalEvent.type, "click", "originalEvent" ); - strictEqual( ui.tab, tab[ 0 ], "tab" ); + strictEqual( ui.tab, anchor[ 0 ], "tab" ); strictEqual( ui.panel, panel[ 0 ], "panel" ); equal( $( ui.panel ).find( "p" ).length, 1, "panel html" ); state( element, 0, 0, 0, 0, 1 ); start(); }); - element.find( ".ui-tabs-nav a" ).eq( 4 ).click(); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 4 ).click(); } }); @@ -285,7 +288,7 @@ test( "enable", function() { var element = $( "#tabs1" ).tabs({ disabled: [ 0, 1 ], enable: function( event, ui ) { - equal( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); + equal( ui.tab, element.find( ".ui-tabs-nav .ui-tabs-anchor" )[ 1 ], "ui.tab" ); equal( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); equal( ui.index, 1, "ui.index" ); } @@ -300,7 +303,7 @@ test( "disable", function() { var element = $( "#tabs1" ).tabs({ disable: function( event, ui ) { - equal( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); + equal( ui.tab, element.find( ".ui-tabs-nav .ui-tabs-anchor" )[ 1 ], "ui.tab" ); equal( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); equal( ui.index, 1, "ui.index" ); } @@ -318,13 +321,13 @@ test( "show", function() { active: false, collapsible: true }), - tabs = element.find( ".ui-tabs-nav a" ), + anchors = element.find( ".ui-tabs-nav .ui-tabs-anchor" ), panels = element.find( ".ui-tabs-panel" ); // from collapsed element.one( "tabsshow", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - strictEqual( ui.tab, tabs[ 0 ], "ui.tab" ); + strictEqual( ui.tab, anchors[ 0 ], "ui.tab" ); strictEqual( ui.panel, panels[ 0 ], "ui.panel" ); equal( ui.index, 0, "ui.index" ); state( element, 1, 0, 0 ); @@ -335,12 +338,12 @@ test( "show", function() { // switching tabs element.one( "tabsshow", function( event, ui ) { equal( event.originalEvent.type, "click", "originalEvent" ); - strictEqual( ui.tab, tabs[ 1 ], "ui.tab" ); + strictEqual( ui.tab, anchors[ 1 ], "ui.tab" ); strictEqual( ui.panel, panels[ 1 ], "ui.panel" ); equal( ui.index, 1, "ui.index" ); state( element, 0, 1, 0 ); }); - tabs.eq( 1 ).click(); + anchors.eq( 1 ).click(); state( element, 0, 1, 0 ); // collapsing @@ -358,13 +361,13 @@ test( "select", function() { active: false, collapsible: true }), - tabs = element.find( ".ui-tabs-nav a" ), + anchors = element.find( ".ui-tabs-nav .ui-tabs-anchor" ), panels = element.find( ".ui-tabs-panel" ); // from collapsed element.one( "tabsselect", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - strictEqual( ui.tab, tabs[ 0 ], "ui.tab" ); + strictEqual( ui.tab, anchors[ 0 ], "ui.tab" ); strictEqual( ui.panel, panels[ 0 ], "ui.panel" ); equal( ui.index, 0, "ui.index" ); state( element, 0, 0, 0 ); @@ -375,12 +378,12 @@ test( "select", function() { // switching tabs element.one( "tabsselect", function( event, ui ) { equal( event.originalEvent.type, "click", "originalEvent" ); - strictEqual( ui.tab, tabs[ 1 ], "ui.tab" ); + strictEqual( ui.tab, anchors[ 1 ], "ui.tab" ); strictEqual( ui.panel, panels[ 1 ], "ui.panel" ); equal( ui.index, 1, "ui.index" ); state( element, 1, 0, 0 ); }); - tabs.eq( 1 ).click(); + anchors.eq( 1 ).click(); state( element, 0, 1, 0 ); // collapsing @@ -414,11 +417,11 @@ test( "add", function() { element.tabs( "add", "#new", "New" ); state( element, 1, 0, 0, 0 ); tab = element.find( ".ui-tabs-nav li" ).last(); - anchor = tab.find( "a" ); + anchor = tab.find( ".ui-tabs-anchor" ); equal( tab.text(), "New", "label" ); equal( stripLeadingSlash( anchor[0].pathname ), stripLeadingSlash( location.pathname ), "href pathname" ); equal( anchor[0].hash, "#new", "href hash" ); - equal( anchor.attr( "aria-controls" ), "new", "aria-controls" ); + equal( tab.attr( "aria-controls" ), "new", "aria-controls" ); ok( !tab.hasClass( "ui-state-hover" ), "not hovered" ); anchor.simulate( "mouseover" ); ok( tab.hasClass( "ui-state-hover" ), "hovered" ); @@ -429,17 +432,17 @@ test( "add", function() { element.one( "tabsadd", function( event, ui ) { equal( ui.index, 1, "ui.index" ); equal( $( ui.tab ).text(), "New Remote", "ui.tab" ); - equal( ui.panel.id, $( ui.tab ).attr( "aria-controls" ), "ui.panel" ); + equal( ui.panel.id, $( ui.tab ).closest( "li" ).attr( "aria-controls" ), "ui.panel" ); }); element.tabs( "add", "data/test.html", "New Remote", 1 ); state( element, 0, 0, 0, 0, 1 ); tab = element.find( ".ui-tabs-nav li" ).eq( 1 ); - anchor = tab.find( "a" ); + anchor = tab.find( ".ui-tabs-anchor" ); equal( tab.text(), "New Remote", "label" ); equal( stripLeadingSlash( stripLeadingSlash( anchor[0].pathname.replace( stripLeadingSlash( location.pathname ).split( "/" ).slice( 0, -1 ).join( "/" ), "" ) ) ), "data/test.html", "href" ); - ok( /^ui-tabs-\d+$/.test( anchor.attr( "aria-controls" ) ), "aria controls" ); + ok( /^ui-tabs-\d+$/.test( tab.attr( "aria-controls" ) ), "aria controls" ); ok( !tab.hasClass( "ui-state-hover" ), "not hovered" ); anchor.simulate( "mouseover" ); ok( tab.hasClass( "ui-state-hover" ), "hovered" ); @@ -560,10 +563,10 @@ test( "url", function() { expect( 2 ); var element = $( "#tabs2" ).tabs(), - tab = element.find( "a" ).eq( 3 ); + anchor = element.find( ".ui-tabs-anchor" ).eq( 3 ); element.tabs( "url", 3, "data/test2.html" ); - equal( tab.attr( "href" ), "data/test2.html", "href was updated" ); + equal( anchor.attr( "href" ), "data/test2.html", "href was updated" ); element.one( "tabsbeforeload", function( event, ui ) { equal( ui.ajaxSettings.url, "data/test2.html", "ajaxSettings.url" ); event.preventDefault(); @@ -582,7 +585,7 @@ asyncTest( "abort", function() { }); }); // prevent IE from caching the request, so that it won't resolve before we call abort - element.find( ".ui-tabs-nav li:eq(2) a" ).attr( "href", function( href ) { + element.find( ".ui-tabs-nav li:eq(2) .ui-tabs-anchor" ).attr( "href", function( href ) { return href + "?" + (+ new Date()); }); element.tabs( "option", "active", 2 ); diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js index f336865813..57011bdad8 100644 --- a/tests/unit/tabs/tabs_events.js +++ b/tests/unit/tabs/tabs_events.js @@ -8,7 +8,7 @@ test( "create", function() { expect( 10 ); var element = $( "#tabs1" ), - tabs = element.find( "ul a" ), + tabs = element.find( "ul li" ), panels = element.children( "div" ); element.tabs({ @@ -50,7 +50,8 @@ test( "beforeActivate", function() { active: false, collapsible: true }), - tabs = element.find( ".ui-tabs-nav a" ), + tabs = element.find( ".ui-tabs-nav li" ), + anchors = tabs.find( ".ui-tabs-anchor" ), panels = element.find( ".ui-tabs-panel" ); // from collapsed @@ -80,7 +81,7 @@ test( "beforeActivate", function() { strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); state( element, 1, 0, 0 ); }); - tabs.eq( 1 ).click(); + anchors.eq( 1 ).click(); state( element, 0, 1, 0 ); // collapsing @@ -120,7 +121,8 @@ test( "activate", function() { active: false, collapsible: true }), - tabs = element.find( ".ui-tabs-nav a" ), + tabs = element.find( ".ui-tabs-nav li" ), + anchors = element.find( ".ui-tabs-anchor" ), panels = element.find( ".ui-tabs-panel" ); // from collapsed @@ -150,7 +152,7 @@ test( "activate", function() { strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); state( element, 0, 1, 0 ); }); - tabs.eq( 1 ).click(); + anchors.eq( 1 ).click(); state( element, 0, 1, 0 ); // collapsing @@ -186,7 +188,7 @@ test( "beforeLoad", function() { // init element.one( "tabsbeforeload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 2 ); + tab = element.find( ".ui-tabs-nav li" ).eq( 2 ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); @@ -208,7 +210,7 @@ test( "beforeLoad", function() { // .option() element.one( "tabsbeforeload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 2 ); + tab = element.find( ".ui-tabs-nav li" ).eq( 2 ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); @@ -230,7 +232,7 @@ test( "beforeLoad", function() { // click, change panel content element.one( "tabsbeforeload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 3 ); + tab = element.find( ".ui-tabs-nav li" ).eq( 3 ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); @@ -245,7 +247,7 @@ test( "beforeLoad", function() { event.preventDefault(); state( element, 0, 0, 1, 0, 0 ); }); - element.find( ".ui-tabs-nav a" ).eq( 3 ).click(); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 3 ).click(); state( element, 0, 0, 0, 1, 0 ); // .toLowerCase() is needed to convert

    to

    in old IEs equal( panel.html().toLowerCase(), "

    testing

    ", "panel html after" ); @@ -260,7 +262,7 @@ if ( $.uiBackCompat === false ) { // init element.one( "tabsload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 2 ); + tab = element.find( ".ui-tabs-nav li" ).eq( 2 ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); @@ -278,7 +280,7 @@ if ( $.uiBackCompat === false ) { function tabsload1() { // .option() element.one( "tabsload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 3 ); + tab = element.find( ".ui-tabs-nav li" ).eq( 3 ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); @@ -297,7 +299,7 @@ if ( $.uiBackCompat === false ) { function tabsload2() { // click, change panel content element.one( "tabsload", function( event, ui ) { - tab = element.find( ".ui-tabs-nav a" ).eq( 4 ); + tab = element.find( ".ui-tabs-nav li" ).eq( 4 ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); @@ -310,7 +312,7 @@ if ( $.uiBackCompat === false ) { state( element, 0, 0, 0, 0, 1 ); start(); }); - element.find( ".ui-tabs-nav a" ).eq( 4 ).click(); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 4 ).click(); } }); } diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js index 0837995e6d..ed3e73745b 100644 --- a/tests/unit/tabs/tabs_methods.js +++ b/tests/unit/tabs/tabs_methods.js @@ -97,7 +97,7 @@ test( "refresh", function() { element.tabs( "refresh" ); state( element, 1, 0, 0, 0 ); disabled( element, [ 1 ] ); - equal( element.find( "#" + $( "#newTab a" ).attr( "aria-controls" ) ).length, 1, + equal( element.find( "#" + $( "#newTab" ).attr( "aria-controls" ) ).length, 1, "panel added for remote tab" ); // remove all tabs @@ -156,7 +156,7 @@ asyncTest( "load", function() { // load content of inactive tab // useful for preloading content with custom caching element.one( "tabsbeforeload", function( event, ui ) { - var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ), + var tab = element.find( ".ui-tabs-nav li" ).eq( 3 ), panelId = tab.attr( "aria-controls" ), panel = $( "#" + panelId ); @@ -171,13 +171,17 @@ asyncTest( "load", function() { // TODO: remove wrapping in 2.0 var uiTab = $( ui.tab ), uiPanel = $( ui.panel ), - tab = element.find( ".ui-tabs-nav a" ).eq( 3 ), + tab = element.find( ".ui-tabs-nav li" ).eq( 3 ), panelId = tab.attr( "aria-controls" ), panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); equal( uiTab.length, 1, "tab length" ); - strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" ); + if ( $.uiBackCompat === false ) { + strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" ); + } else { + strictEqual( uiTab[ 0 ], tab.find( ".ui-tabs-anchor" )[ 0 ], "tab" ); + } equal( uiPanel.length, 1, "panel length" ); strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" ); equal( uiPanel.find( "p" ).length, 1, "panel html" ); @@ -203,7 +207,7 @@ asyncTest( "load", function() { function tabsload2() { // reload content of active tab element.one( "tabsbeforeload", function( event, ui ) { - var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ), + var tab = element.find( ".ui-tabs-nav li" ).eq( 3 ), panelId = tab.attr( "aria-controls" ), panel = $( "#" + panelId ); @@ -218,13 +222,17 @@ asyncTest( "load", function() { // TODO: remove wrapping in 2.0 var uiTab = $( ui.tab ), uiPanel = $( ui.panel ), - tab = element.find( ".ui-tabs-nav a" ).eq( 3 ), + tab = element.find( ".ui-tabs-nav li" ).eq( 3 ), panelId = tab.attr( "aria-controls" ), panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); equal( uiTab.length, 1, "tab length" ); - strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" ); + if ( $.uiBackCompat === false ) { + strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" ); + } else { + strictEqual( uiTab[ 0 ], tab.find( ".ui-tabs-anchor" )[ 0 ], "tab" ); + } equal( uiPanel.length, 1, "panel length" ); strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" ); state( element, 0, 0, 0, 1, 0 ); diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js index ae9e7bdc6d..df6827c576 100644 --- a/tests/unit/tabs/tabs_options.js +++ b/tests/unit/tabs/tabs_options.js @@ -57,7 +57,7 @@ test( "{ active: Number }", function() { equal( element.tabs( "option", "active" ), 0 ); state( element, 1, 0, 0 ); - element.find( ".ui-tabs-nav a" ).eq( 1 ).click(); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 1 ).click(); equal( element.tabs( "option", "active" ), 1 ); state( element, 0, 1, 0 ); @@ -110,7 +110,7 @@ test( "{ collapsible: false }", function() { equal( element.tabs( "option", "active" ), 1 ); state( element, 0, 1, 0 ); - element.find( ".ui-state-active a" ).eq( 1 ).click(); + element.find( ".ui-state-active .ui-tabs-anchor" ).eq( 1 ).click(); equal( element.tabs( "option", "active" ), 1 ); state( element, 0, 1, 0 ); }); @@ -131,7 +131,7 @@ test( "{ collapsible: true }", function() { equal( element.tabs( "option", "active" ), 1 ); state( element, 0, 1, 0 ); - element.find( ".ui-state-active a" ).click(); + element.find( ".ui-state-active .ui-tabs-anchor" ).click(); equal( element.tabs( "option", "active" ), false ); state( element, 0, 0, 0 ); }); @@ -173,7 +173,7 @@ test( "{ event: null }", function() { state( element, 0, 1, 0 ); // ensure default click handler isn't bound - element.find( ".ui-tabs-nav a" ).eq( 2 ).click(); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 2 ).click(); equal( element.tabs( "option", "active" ), 1 ); state( element, 0, 1, 0 ); }); @@ -186,27 +186,27 @@ test( "{ event: custom }", function() { }); state( element, 1, 0, 0 ); - element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" ); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 1 ).trigger( "custom1" ); equal( element.tabs( "option", "active" ), 1 ); state( element, 0, 1, 0 ); // ensure default click handler isn't bound - element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "click" ); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 2 ).trigger( "click" ); equal( element.tabs( "option", "active" ), 1 ); state( element, 0, 1, 0 ); - element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "custom2" ); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 2 ).trigger( "custom2" ); equal( element.tabs( "option", "active" ), 2 ); state( element, 0, 0, 1 ); element.tabs( "option", "event", "custom3" ); // ensure old event handlers are unbound - element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" ); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 1 ).trigger( "custom1" ); equal( element.tabs( "option", "active" ), 2 ); state( element, 0, 0, 1 ); - element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom3" ); + element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 1 ).trigger( "custom3" ); equal( element.tabs( "option", "active" ), 1 ); state( element, 0, 1, 0 ); }); diff --git a/tests/unit/tabs/tabs_test_helpers.js b/tests/unit/tabs/tabs_test_helpers.js index 9f592c0749..5080439430 100644 --- a/tests/unit/tabs/tabs_test_helpers.js +++ b/tests/unit/tabs/tabs_test_helpers.js @@ -43,7 +43,7 @@ TestHelpers.tabs = { actual = tabs.find( ".ui-tabs-nav li" ).map(function() { var tab = $( this ), panel = $( $.ui.tabs.prototype._sanitizeSelector( - "#" + tab.find( "a" ).attr( "aria-controls" ) ) ), + "#" + tab.attr( "aria-controls" ) ) ), tabIsActive = tab.hasClass( "ui-state-active" ), panelIsActive = panel.css( "display" ) !== "none"; diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 23c6ed58d6..c0490e48e2 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -59,8 +59,8 @@ $.widget( "ui.tabs", { if ( active === null ) { // check the fragment identifier in the URL if ( location.hash ) { - that.anchors.each(function( i, tab ) { - if ( tab.hash === location.hash ) { + that.anchors.each(function( i, anchor ) { + if ( anchor.hash === location.hash ) { active = i; return false; } @@ -152,8 +152,8 @@ $.widget( "ui.tabs", { } }, - _tabId: function( a ) { - return $( a ).attr( "aria-controls" ) || "ui-tabs-" + getNextTabId(); + _tabId: function( tab ) { + return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId(); }, _sanitizeSelector: function( hash ) { @@ -187,7 +187,7 @@ $.widget( "ui.tabs", { // was active, active tab still exists } else { // make sure active index is correct - options.active = this.anchors.index( this.active ); + options.active = this.lis.index( this.active ); } }, @@ -197,6 +197,7 @@ $.widget( "ui.tabs", { this.element.toggleClass( "ui-tabs-collapsible", options.collapsible ); this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); this.lis.addClass( "ui-state-default ui-corner-top" ); + this.anchors.addClass( "ui-tabs-anchor" ); this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ); this._setupDisabled( options.disabled ); @@ -219,7 +220,8 @@ $.widget( "ui.tabs", { this.panels = $(); this.anchors.each(function( i, a ) { - var selector, panel, id; + var selector, panel, id, + tab = $( a ).closest( "li" ); // inline tab if ( isLocal( a ) ) { @@ -227,7 +229,7 @@ $.widget( "ui.tabs", { panel = that.element.find( that._sanitizeSelector( selector ) ); // remote tab } else { - id = that._tabId( a ); + id = that._tabId( tab ); selector = "#" + id; panel = that.element.find( selector ); if ( !panel.length ) { @@ -239,7 +241,7 @@ $.widget( "ui.tabs", { if ( panel.length) { that.panels = that.panels.add( panel ); } - $( a ).attr( "aria-controls", selector.substring( 1 ) ); + tab.attr( "aria-controls", selector.substring( 1 ) ); }); }, @@ -294,16 +296,16 @@ $.widget( "ui.tabs", { var that = this, options = that.options, active = that.active, - clicked = $( event.currentTarget ), - clickedIsActive = clicked[ 0 ] === active[ 0 ], + anchor = $( event.currentTarget ), + tab = anchor.closest( "li" ), + clickedIsActive = tab[ 0 ] === active[ 0 ], collapsing = clickedIsActive && options.collapsible, - toShow = collapsing ? $() : that._getPanelForTab( clicked ), + toShow = collapsing ? $() : that._getPanelForTab( tab ), toHide = !active.length ? $() : that._getPanelForTab( active ), - tab = clicked.closest( "li" ), eventData = { oldTab: active, oldPanel: toHide, - newTab: collapsing ? $() : clicked, + newTab: collapsing ? $() : tab, newPanel: toShow }; @@ -318,13 +320,13 @@ $.widget( "ui.tabs", { ( clickedIsActive && !options.collapsible ) || // allow canceling activation ( that._trigger( "beforeActivate", event, eventData ) === false ) ) { - clicked[ 0 ].blur(); + anchor[ 0 ].blur(); return; } - options.active = collapsing ? false : that.anchors.index( clicked ); + options.active = collapsing ? false : that.lis.index( tab ); - that.active = clickedIsActive ? $() : clicked; + that.active = clickedIsActive ? $() : tab; if ( that.xhr ) { that.xhr.abort(); } @@ -335,8 +337,8 @@ $.widget( "ui.tabs", { if ( toShow.length ) { // TODO make passing in node possible - that.load( that.anchors.index( clicked ), event ); - clicked[ 0 ].blur(); + that.load( that.lis.index( tab ), event ); + anchor[ 0 ].blur(); } that._toggle( event, eventData ); }, @@ -379,31 +381,39 @@ $.widget( "ui.tabs", { }, _activate: function( index ) { - var active = this._findActive( index )[ 0 ]; + var anchor, + active = this._findActive( index ); // trying to activate the already active panel - if ( active === this.active[ 0 ] ) { + if ( active[ 0 ] === this.active[ 0 ] ) { return; } // trying to collapse, simulate a click on the current active header - active = active || this.active[ 0 ]; + if ( !active.length ) { + active = this.active; + } + anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; this._eventHandler({ - target: active, - currentTarget: active, + target: anchor, + currentTarget: anchor, preventDefault: $.noop }); }, _findActive: function( selector ) { - return typeof selector === "number" ? this.anchors.eq( selector ) : - typeof selector === "string" ? this.anchors.filter( "[href$='" + selector + "']" ) : $(); + if ( typeof selector === "number" ) { + return this.lis.eq( selector ); + } + if ( typeof selector === "string" ) { + return this.anchors.filter( "[href$='" + selector + "']" ).closest( "li" ); + } + return $(); }, _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" ) { index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); } @@ -421,6 +431,7 @@ $.widget( "ui.tabs", { this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); this.anchors + .removeClass( "ui-tabs-anchor" ) .unbind( ".tabs" ) .removeData( "href.tabs" ) .removeData( "load.tabs" ); @@ -493,10 +504,11 @@ $.widget( "ui.tabs", { load: function( index, event ) { index = this._getIndex( index ); var that = this, - anchor = this.anchors.eq( index ), - panel = that._getPanelForTab( anchor ), + tab = this.lis.eq( index ), + anchor = tab.find( ".ui-tabs-anchor" ), + panel = that._getPanelForTab( tab ), eventData = { - tab: anchor, + tab: tab, panel: panel }; @@ -517,7 +529,7 @@ $.widget( "ui.tabs", { // jQuery <1.8 returns false if the request is canceled in beforeSend, // but as of 1.8, $.ajax() always returns a jqXHR object. if ( this.xhr && this.xhr.statusText !== "canceled" ) { - this.lis.eq( index ).addClass( "ui-tabs-loading" ); + tab.addClass( "ui-tabs-loading" ); this.xhr .success(function( response ) { @@ -536,7 +548,7 @@ $.widget( "ui.tabs", { that.panels.stop( false, true ); } - that.lis.eq( index ).removeClass( "ui-tabs-loading" ); + tab.removeClass( "ui-tabs-loading" ); if ( jqXHR === that.xhr ) { delete that.xhr; @@ -723,10 +735,10 @@ if ( $.uiBackCompat !== false ) { .replace( /#\{label\}/g, label ) ), id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : - this._tabId( li.find( "a" )[ 0 ] ); + this._tabId( li ); li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true ); - li.find( "a" ).attr( "aria-controls", id ); + li.attr( "aria-controls", id ); doInsertAfter = index >= this.lis.length; @@ -769,7 +781,7 @@ if ( $.uiBackCompat !== false ) { index = this._getIndex( index ); var options = this.options, tab = this.lis.eq( index ).remove(), - panel = this._getPanelForTab( tab.find( "a[aria-controls]" ) ).remove(); + panel = this._getPanelForTab( tab ).remove(); // If selected tab was removed focus tab to the right or // in case the last tab was removed the tab to the left. @@ -808,8 +820,10 @@ if ( $.uiBackCompat !== false ) { idPrefix: "ui-tabs-" }, - _tabId: function( a ) { - return $( a ).attr( "aria-controls" ) || + _tabId: function( tab ) { + var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab; + a = a[0]; + return $( a ).closest( "li" ).attr( "aria-controls" ) || a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) || this.options.idPrefix + getNextTabId(); } @@ -875,7 +889,8 @@ if ( $.uiBackCompat !== false ) { this._super(); if ( this.options.active !== false ) { this._trigger( "show", null, this._ui( - this.active[ 0 ], this._getPanelForTab( this.active )[ 0 ] ) ); + this.active.find( ".ui-tabs-anchor" )[ 0 ], + this._getPanelForTab( this.active )[ 0 ] ) ); } }, _trigger: function( type, event, data ) { @@ -885,13 +900,13 @@ if ( $.uiBackCompat !== false ) { } if ( type === "beforeActivate" && data.newTab.length ) { ret = this._super( "select", event, { - tab: data.newTab[ 0], + tab: data.newTab.find( ".ui-tabs-anchor" )[ 0], panel: data.newPanel[ 0 ], index: data.newTab.closest( "li" ).index() }); } else if ( type === "activate" && data.newTab.length ) { ret = this._super( "show", event, { - tab: data.newTab[ 0 ], + tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ], panel: data.newPanel[ 0 ], index: data.newTab.closest( "li" ).index() }); @@ -973,7 +988,7 @@ if ( $.uiBackCompat !== false ) { var _data = $.extend( {}, data ); if ( type === "load" ) { _data.panel = _data.panel[ 0 ]; - _data.tab = _data.tab[ 0 ]; + _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ]; } return this._super( type, event, _data ); } From 3ccf86cffb61b83a5f9917053b720ecb6e3b51e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 16:18:46 -0400 Subject: [PATCH 40/80] Tabs manipulation demo: Update for aria-controls. --- demos/tabs/manipulation.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demos/tabs/manipulation.html b/demos/tabs/manipulation.html index 205fc2e4d4..085d42c430 100644 --- a/demos/tabs/manipulation.html +++ b/demos/tabs/manipulation.html @@ -76,8 +76,8 @@ // close icon: removing the tab on click $( "#tabs span.ui-icon-close" ).live( "click", function() { - $( this ).closest( "li" ).remove(); - $( "#" + $( this ).prev().attr( "aria-controls" ) ).remove(); + var panelId = $( this ).closest( "li" ).remove().attr( "aria-controls" ); + $( "#" + panelId ).remove(); tabs.tabs( "refresh" ); }); }); From cac6831e3408b05446ba2682d2d6232224151a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 18 May 2012 16:23:03 -0400 Subject: [PATCH 41/80] Autocomplete: Coding standards. --- ui/jquery.ui.autocomplete.js | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 685bbca114..ceb4a50c9c 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -110,7 +110,7 @@ $.widget( "ui.autocomplete", { } break; case keyCode.ESCAPE: - if ( this.menu.element.is(":visible") ) { + if ( this.menu.element.is( ":visible" ) ) { this._value( this.term ); this.close( event ); // Different browsers have different default behavior for escape @@ -178,9 +178,9 @@ $.widget( "ui.autocomplete", { }); this._initSource(); - this.menu = $( "
      " ) + this.menu = $( "