From da84672db8ad1f3909e645a665e9a9c6c0de0ded Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 8 Jun 2011 17:02:57 -0400 Subject: [PATCH] .attr() -> .prop() --- tests/unit/accordion/accordion_core.js | 16 ++++----- tests/unit/button/button_options.js | 12 +++---- tests/unit/core/core.html | 8 ----- tests/unit/core/selector.js | 18 ---------- tests/unit/datepicker/datepicker_methods.js | 6 ++-- tests/unit/datepicker/datepicker_options.js | 35 +++++++++---------- tests/unit/dialog/dialog_tickets.js | 8 ++--- tests/unit/progressbar/progressbar_core.js | 4 +-- tests/unit/testsuite.js | 2 +- tests/unit/tooltip/tooltip_methods.js | 2 +- ui/jquery.ui.accordion.js | 38 ++++++++++----------- ui/jquery.ui.autocomplete.js | 8 ++--- ui/jquery.ui.button.js | 24 ++++++------- ui/jquery.ui.datepicker.js | 6 ++-- ui/jquery.ui.dialog.js | 4 +-- ui/jquery.ui.menu.js | 28 +++++++-------- ui/jquery.ui.menubar.js | 36 +++++++++++-------- ui/jquery.ui.popup.js | 16 ++++----- ui/jquery.ui.slider.js | 4 +-- ui/jquery.ui.spinner.js | 6 ++-- ui/jquery.ui.widget.js | 4 +-- 21 files changed, 130 insertions(+), 155 deletions(-) diff --git a/tests/unit/accordion/accordion_core.js b/tests/unit/accordion/accordion_core.js index 280339c26..7bf71c31b 100644 --- a/tests/unit/accordion/accordion_core.js +++ b/tests/unit/accordion/accordion_core.js @@ -39,15 +39,15 @@ test( "accessibility", function () { equals( element.attr( "role" ), "tablist", "main role" ); equals( headers.attr( "role" ), "tab", "tab roles" ); equals( headers.next().attr( "role" ), "tabpanel", "tabpanel roles" ); - equals( headers.eq( 1 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded" ); - equals( headers.eq( 0 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded" ); - equals( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected" ); - equals( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" ); + equals( headers.eq( 1 ).prop( "aria-expanded" ), true, "active tab has aria-expanded" ); + equals( headers.eq( 0 ).prop( "aria-expanded" ), false, "inactive tab has aria-expanded" ); + equals( headers.eq( 1 ).prop( "aria-selected" ), true, "active tab has aria-selected" ); + equals( headers.eq( 0 ).prop( "aria-selected" ), false, "inactive tab has aria-selected" ); element.accordion( "option", "active", 0 ); - equals( headers.eq( 0 ).attr( "aria-expanded" ), "true", "newly active tab has aria-expanded" ); - equals( headers.eq( 1 ).attr( "aria-expanded" ), "false", "newly inactive tab has aria-expanded" ); - equals( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected" ); - equals( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" ); + equals( headers.eq( 0 ).prop( "aria-expanded" ), true, "newly active tab has aria-expanded" ); + equals( headers.eq( 1 ).prop( "aria-expanded" ), false, "newly inactive tab has aria-expanded" ); + equals( headers.eq( 0 ).prop( "aria-selected" ), true, "active tab has aria-selected" ); + equals( headers.eq( 1 ).prop( "aria-selected" ), false, "inactive tab has aria-selected" ); }); }( jQuery ) ); diff --git a/tests/unit/button/button_options.js b/tests/unit/button/button_options.js index 5b25ecd63..a3ab5ae10 100644 --- a/tests/unit/button/button_options.js +++ b/tests/unit/button/button_options.js @@ -5,28 +5,28 @@ module("button: options"); -test("disabled, explicity value", function() { +test("disabled, explicit value", function() { $("#radio01").button({ disabled: false }); same(false, $("#radio01").button("option", "disabled"), "disabled option set to false"); - same(false, $("#radio01").attr("disabled"), "element is disabled"); + same(false, $("#radio01").prop("disabled"), "element is disabled"); $("#radio02").button({ disabled: true }); same(true, $("#radio02").button("option", "disabled"), "disabled option set to true"); - same(true, $("#radio02").attr("disabled"), "element is not disabled"); + same(true, $("#radio02").prop("disabled"), "element is not disabled"); }); test("disabled, null", function() { $("#radio01").button({ disabled: null }); same(false, $("#radio01").button("option", "disabled"), "disabled option set to false"); - same(false, $("#radio01").attr("disabled"), "element is disabled"); + same(false, $("#radio01").prop("disabled"), "element is disabled"); - $("#radio02").attr("disabled", "disabled").button({ disabled: null }); + $("#radio02").prop("disabled", true).button({ disabled: null }); same(true, $("#radio02").button("option", "disabled"), "disabled option set to true"); - same(true, $("#radio02").attr("disabled"), "element is not disabled"); + same(true, $("#radio02").prop("disabled"), "element is not disabled"); }); test("text false without icon", function() { diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html index 31702dd4e..62a8b3c86 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -108,14 +108,6 @@ . -
- - - - . - . -
-
.
diff --git a/tests/unit/core/selector.js b/tests/unit/core/selector.js index e7b7f9b6c..44888ad88 100644 --- a/tests/unit/core/selector.js +++ b/tests/unit/core/selector.js @@ -147,15 +147,6 @@ test("focusable - not natively focusable with various tabindex", function() { isFocusable('#spanTabindex-50', 'span, tabindex -50'); }); -test("focusable - invalid tabindex", function() { - expect(4); - - isFocusable('#inputTabindexfoo', 'input, tabindex foo'); - isFocusable('#inputTabindex3foo', 'input, tabindex 3foo'); - isNotFocusable('#spanTabindexfoo', 'span tabindex foo'); - isNotFocusable('#spanTabindex3foo', 'span, tabindex 3foo'); -}); - test("focusable - area elements", function() { isNotFocusable('#areaCoordsNoHref', 'coords but no href'); isFocusable('#areaCoordsHref', 'coords and href'); @@ -233,15 +224,6 @@ test("tabbable - not natively tabbable with various tabindex", function() { isNotTabbable('#spanTabindex-50', 'span, tabindex -50'); }); -test("tabbable - invalid tabindex", function() { - expect(4); - - isTabbable('#inputTabindexfoo', 'input, tabindex foo'); - isTabbable('#inputTabindex3foo', 'input, tabindex 3foo'); - isNotTabbable('#spanTabindexfoo', 'span tabindex foo'); - isNotTabbable('#spanTabindex3foo', 'span, tabindex 3foo'); -}); - test("tabbable - area elements", function() { isNotTabbable('#areaCoordsNoHref', 'coords but no href'); isTabbable('#areaCoordsHref', 'coords and href'); diff --git a/tests/unit/datepicker/datepicker_methods.js b/tests/unit/datepicker/datepicker_methods.js index 7ef977604..c8f1b75b2 100644 --- a/tests/unit/datepicker/datepicker_methods.js +++ b/tests/unit/datepicker/datepicker_methods.js @@ -106,15 +106,15 @@ test('enableDisable', function() { var dp = $('.ui-datepicker-inline', inl); ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled'); ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visually disabled initially'); - ok(!dp.find('select').attr('disabled'), 'Enable/disable inline - form element enabled initially'); + ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled initially'); inl.datepicker('disable'); ok(inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as disabled'); ok(dp.children().is('.ui-state-disabled'), 'Enable/disable inline - visually disabled'); - ok(dp.find('select').attr('disabled'), 'Enable/disable inline - form element disabled'); + ok(dp.find('select').prop('disabled'), 'Enable/disable inline - form element disabled'); inl.datepicker('enable'); ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as enabled'); ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visiually disabled'); - ok(!dp.find('select').attr('disabled'), 'Enable/disable inline - form element enabled'); + ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled'); inl.datepicker('destroy'); }); diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index a10d1ea45..272af9dac 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -531,40 +531,37 @@ test('altField', function() { test('autoSize', function() { var inp = init('#inp'); - equals(inp.attr('size'), 20, 'Auto size - default'); + equals(inp.prop('size'), 20, 'Auto size - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.attr('size'), 10, 'Auto size - mm/dd/yy'); + equals(inp.prop('size'), 10, 'Auto size - mm/dd/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.attr('size'), 10, 'Auto size - m/d/yy'); + equals(inp.prop('size'), 10, 'Auto size - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.attr('size'), 15, 'Auto size - D M d yy'); + equals(inp.prop('size'), 15, 'Auto size - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.attr('size'), 29, 'Auto size - DD, MM dd, yy'); - inp.removeAttr('size'); + equals(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy'); // French inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['fr'])); - equals(inp.attr('size'), 20, 'Auto size - fr - default'); + equals(inp.prop('size'), 29, 'Auto size - fr - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.attr('size'), 10, 'Auto size - fr - dd/mm/yy'); + equals(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.attr('size'), 10, 'Auto size - fr - m/d/yy'); + equals(inp.prop('size'), 10, 'Auto size - fr - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.attr('size'), 18, 'Auto size - fr - D M d yy'); + equals(inp.prop('size'), 18, 'Auto size - fr - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.attr('size'), 28, 'Auto size - fr - DD, MM dd, yy'); - inp.removeAttr('size'); + equals(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy'); // Hebrew inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['he'])); - equals(inp.attr('size'), 20, 'Auto size - he - default'); + equals(inp.prop('size'), 28, 'Auto size - he - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.attr('size'), 10, 'Auto size - he - dd/mm/yy'); + equals(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.attr('size'), 10, 'Auto size - he - m/d/yy'); + equals(inp.prop('size'), 10, 'Auto size - he - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.attr('size'), 14, 'Auto size - he - D M d yy'); + equals(inp.prop('size'), 14, 'Auto size - he - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.attr('size'), 23, 'Auto size - he - DD, MM dd, yy'); - inp.removeAttr('size'); + equals(inp.prop('size'), 23, 'Auto size - he - DD, MM dd, yy'); }); test('daylightSaving', function() { @@ -702,7 +699,7 @@ test('callbacks', function() { ok(day21.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 21'); ok(day20.is('.day10'), 'Before show day - CSS 20'); ok(!day21.is('.day10'), 'Before show day - CSS 21'); - ok(day20.attr('title') == '', 'Before show day - title 20'); + ok(!day20.attr('title'), 'Before show day - title 20'); ok(day21.attr('title') == 'Divisble by 3', 'Before show day - title 21'); inp.datepicker('hide').datepicker('destroy'); }); diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index def2452de..1cfdcefea 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -65,17 +65,15 @@ test("#6137: dialog('open') causes form elements to reset on IE7", function() { expect(2); d1 = $('
' + - 'b
').dialog({autoOpen: false}); + 'b').appendTo( "body" ).dialog({autoOpen: false}); - d1.find('#b')[0].checked = true; + d1.find('#b').prop( "checked", true ); equal($('input:checked').val(), 'b', "checkbox b is checked"); - d2 = $('
').dialog({autoOpen: false}); - d1.dialog('open'); equal($('input:checked').val(), 'b', "checkbox b is checked"); - d1.add(d2).remove(); + d1.remove(); }); test("#6645: Missing element not found check in overlay", function(){ diff --git a/tests/unit/progressbar/progressbar_core.js b/tests/unit/progressbar/progressbar_core.js index e59579634..2380061db 100644 --- a/tests/unit/progressbar/progressbar_core.js +++ b/tests/unit/progressbar/progressbar_core.js @@ -19,10 +19,10 @@ test("accessibility", function() { el.progressbar("value", 77); equals(el.attr("aria-valuenow"), 77, "aria-valuenow"); el.progressbar("disable"); - equals(el.attr("aria-disabled"), "true", "aria-disabled on"); + equals(el.prop("aria-disabled"), true, "aria-disabled on"); el.progressbar("enable"); // FAIL: for some reason IE6 and 7 return a boolean false instead of the string - equals(el.attr("aria-disabled"), $.browser.msie && $.browser.version == 6 || $.browser.version == 7 ? false : "false", "aria-disabled off"); + equals(el.prop("aria-disabled"), false, "aria-disabled off"); }); })(jQuery); diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 3d9e64d60..c8afcbe79 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -82,7 +82,7 @@ window.domEqual = function( selector, modifier, message ) { var result = {}; result.nodeName = value[0].nodeName; $.each(attributes, function(index, attr) { - result[attr] = value.attr(attr); + result[attr] = value.prop(attr); }); result.children = []; var children = value.children(); diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js index 798d55896..74fd35d84 100644 --- a/tests/unit/tooltip/tooltip_methods.js +++ b/tests/unit/tooltip/tooltip_methods.js @@ -40,7 +40,7 @@ test( "enable/disable", function() { element.tooltip( "disable" ); equal( $( ".ui-tooltip" ).length, 0, "no tooltip when disabled" ); - equal( tooltip.attr( "title" ), "", "title removed on disable" ); + equal( tooltip.attr( "title" ), undefined, "title removed on disable" ); element.tooltip( "open" ); equal( $( ".ui-tooltip" ).length, 0, "open does nothing when disabled" ); diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 7602ae9bc..fc0ba3910 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -78,11 +78,11 @@ $.widget( "ui.accordion", { self.headers .not( self.active ) - .attr({ - "aria-expanded": "false", - "aria-selected": "false", - tabIndex: -1 + .prop({ + "aria-expanded": false, + "aria-selected": false }) + .attr( "tabIndex", -1 ) .next() .hide(); @@ -91,11 +91,11 @@ $.widget( "ui.accordion", { self.headers.eq( 0 ).attr( "tabIndex", 0 ); } else { self.active - .attr({ - "aria-expanded": "true", - "aria-selected": "true", - tabIndex: 0 - }); + .prop({ + "aria-expanded": true, + "aria-selected": true + }) + .attr( "tabIndex", 0 ); } // only need links in tab order for Safari @@ -135,8 +135,8 @@ $.widget( "ui.accordion", { .unbind( ".accordion" ) .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) .removeAttr( "role" ) - .removeAttr( "aria-expanded" ) - .removeAttr( "aria-selected" ) + .removeProp( "aria-expanded" ) + .removeProp( "aria-selected" ) .removeAttr( "tabIndex" ) .find( "a" ) .removeAttr( "tabIndex" ) @@ -393,18 +393,18 @@ $.widget( "ui.accordion", { // TODO assert that the blur and focus triggers are really necessary, remove otherwise toHide.prev() - .attr({ - "aria-expanded": "false", - "aria-selected": "false", - tabIndex: -1 + .prop({ + "aria-expanded": false, + "aria-selected": false }) + .attr( "tabIndex", -1 ) .blur(); toShow.prev() - .attr({ - "aria-expanded": "true", - "aria-selected": "true", - tabIndex: 0 + .prop({ + "aria-expanded": true, + "aria-selected": true }) + .attr( "tabIndex", 0 ) .focus(); }, diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index e39b4649e..3f5e2d10a 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -59,11 +59,11 @@ $.widget( "ui.autocomplete", { // TODO verify these actually work as intended .attr({ role: "textbox", - "aria-autocomplete": "list", - "aria-haspopup": "true" + "aria-autocomplete": "list" }) + .prop( "aria-haspopup", true ) .bind( "keydown.autocomplete", function( event ) { - if ( self.options.disabled || self.element.attr( "readonly" ) ) { + if ( self.options.disabled || self.element.prop( "readonly" ) ) { suppressKeyPress = true; suppressInput = true; return; @@ -268,7 +268,7 @@ $.widget( "ui.autocomplete", { .removeAttr( "autocomplete" ) .removeAttr( "role" ) .removeAttr( "aria-autocomplete" ) - .removeAttr( "aria-haspopup" ); + .removeProp( "aria-haspopup" ); this.menu.element.remove(); }, diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 482cdc24c..5f48f69a2 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -58,7 +58,7 @@ $.widget( "ui.button", { .bind( "reset.button", formResetHandler ); if ( typeof this.options.disabled !== "boolean" ) { - this.options.disabled = this.element.attr( "disabled" ); + this.options.disabled = this.element.prop( "disabled" ); } this._determineButtonType(); @@ -147,7 +147,7 @@ $.widget( "ui.button", { return false; } $( this ).toggleClass( "ui-state-active" ); - self.buttonElement.attr( "aria-pressed", self.element[0].checked ); + self.buttonElement.prop( "aria-pressed", self.element[0].checked ); }); } else if ( this.type === "radio" ) { this.buttonElement.bind( "click.button", function() { @@ -155,7 +155,7 @@ $.widget( "ui.button", { return false; } $( this ).addClass( "ui-state-active" ); - self.buttonElement.attr( "aria-pressed", true ); + self.buttonElement.prop( "aria-pressed", true ); var radio = self.element[ 0 ]; radioGroup( radio ) @@ -164,7 +164,7 @@ $.widget( "ui.button", { return $( this ).button( "widget" )[ 0 ]; }) .removeClass( "ui-state-active" ) - .attr( "aria-pressed", false ); + .prop( "aria-pressed", false ); }); } else { this.buttonElement @@ -244,7 +244,7 @@ $.widget( "ui.button", { if ( checked ) { this.buttonElement.addClass( "ui-state-active" ); } - this.buttonElement.attr( "aria-pressed", checked ); + this.buttonElement.prop( "aria-pressed", checked ); } else { this.buttonElement = this.element; } @@ -260,7 +260,7 @@ $.widget( "ui.button", { this.buttonElement .removeClass( baseClasses + " " + stateClasses + " " + typeClasses ) .removeAttr( "role" ) - .removeAttr( "aria-pressed" ) + .removeProp( "aria-pressed" ) .html( this.buttonElement.find(".ui-button-text").html() ); if ( !this.hasTitle ) { @@ -272,9 +272,9 @@ $.widget( "ui.button", { this._super( "_setOption", key, value ); if ( key === "disabled" ) { if ( value ) { - this.element.attr( "disabled", true ); + this.element.prop( "disabled", true ); } else { - this.element.removeAttr( "disabled" ); + this.element.prop( "disabled", false ); } return; } @@ -291,22 +291,22 @@ $.widget( "ui.button", { if ( $( this ).is( ":checked" ) ) { $( this ).button( "widget" ) .addClass( "ui-state-active" ) - .attr( "aria-pressed", true ); + .prop( "aria-pressed", true ); } else { $( this ).button( "widget" ) .removeClass( "ui-state-active" ) - .attr( "aria-pressed", false ); + .prop( "aria-pressed", false ); } }); } else if ( this.type === "checkbox" ) { if ( this.element.is( ":checked" ) ) { this.buttonElement .addClass( "ui-state-active" ) - .attr( "aria-pressed", true ); + .prop( "aria-pressed", true ); } else { this.buttonElement .removeClass( "ui-state-active" ) - .attr( "aria-pressed", false ); + .prop( "aria-pressed", false ); } } }, diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 4c73bdfd8..bf42f0411 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -254,7 +254,7 @@ $.extend(Datepicker.prototype, { date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); } - inst.input.attr('size', this._formatDate(inst, date).length); + inst.input.prop('size', this._formatDate(inst, date).length); } }, @@ -365,7 +365,7 @@ $.extend(Datepicker.prototype, { var inline = $target.children('.' + this._inlineClass); inline.children().removeClass('ui-state-disabled'); inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). - removeAttr("disabled"); + prop("disabled", false); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value == target ? null : value); }); // delete entry @@ -390,7 +390,7 @@ $.extend(Datepicker.prototype, { var inline = $target.children('.' + this._inlineClass); inline.children().addClass('ui-state-disabled'); inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). - attr("disabled", "disabled"); + prop("disabled", true); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value == target ? null : value); }); // delete entry diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 0eba39842..89ccdf734 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -266,8 +266,8 @@ $.widget("ui.dialog", { // Opera 9.5+ resets when parent z-index is changed. // http://bugs.jqueryui.com/ticket/3193 saveScroll = { - scrollTop: self.element.attr( "scrollTop" ), - scrollLeft: self.element.attr( "scrollLeft" ) + scrollTop: self.element.scrollTop(), + scrollLeft: self.element.scrollLeft() }; $.ui.dialog.maxZ += 1; self.uiDialog.css( "z-index", $.ui.dialog.maxZ ); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 03e14f124..8045797ae 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -178,8 +178,8 @@ $.widget("ui.menu", { .removeAttr( "role" ) .removeAttr("tabIndex") .removeAttr( "aria-labelledby" ) - .removeAttr( "aria-expanded" ) - .removeAttr( "aria-hidden" ) + .removeProp( "aria-expanded" ) + .removeProp( "aria-hidden" ) .show(); //destroy menu items @@ -191,7 +191,7 @@ $.widget("ui.menu", { .removeClass( "ui-corner-all ui-state-hover" ) .removeAttr( "tabIndex" ) .removeAttr( "role" ) - .removeAttr( "aria-haspopup" ) + .removeProp( "aria-haspopup" ) .removeAttr( "id" ) .children(".ui-icon").remove(); }, @@ -203,9 +203,10 @@ $.widget("ui.menu", { .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) .attr("role", "menu") .hide() - .attr("aria-hidden", "true") - .attr("aria-expanded", "false") - ; + .prop({ + "aria-hidden": true, + "aria-expanded": false + }); // don't refresh list items that are already adapted var items = submenus.add(this.element).children( "li:not(.ui-menu-item):has(a)" ) @@ -221,7 +222,7 @@ $.widget("ui.menu", { submenus.each(function() { var menu = $(this); var item = menu.prev("a") - item.attr("aria-haspopup", "true") + item.prop("aria-haspopup", true) .prepend(''); menu.attr("aria-labelledby", item.attr("id")); }); @@ -289,19 +290,19 @@ $.widget("ui.menu", { _open: function(submenu) { clearTimeout(this.timer); - this.element.find(".ui-menu").not(submenu.parents()).hide().attr("aria-hidden", "true"); + this.element.find(".ui-menu").not(submenu.parents()).hide().prop("aria-hidden", true); var position = $.extend({}, { of: this.active }, $.type(this.options.position) == "function" ? this.options.position(this.active) : this.options.position ); - submenu.show().removeAttr("aria-hidden").attr("aria-expanded", "true").position(position); + submenu.show().removeProp("aria-hidden").prop("aria-expanded", true).position(position); }, closeAll: function() { this.element - .find("ul").hide().attr("aria-hidden", "true").attr("aria-expanded", "false").end() + .find("ul").hide().prop("aria-hidden", true).prop("aria-expanded", false).end() .find("a.ui-state-active").removeClass("ui-state-active"); this.blur(); this.activeMenu = this.element; @@ -309,14 +310,14 @@ $.widget("ui.menu", { _close: function() { this.active.parent() - .find("ul").hide().attr("aria-hidden", "true").attr("aria-expanded", "false").end() + .find("ul").hide().prop("aria-hidden", true).prop("aria-expanded", false).end() .find("a.ui-state-active").removeClass("ui-state-active"); }, left: function(event) { var newItem = this.active && this.active.parents("li:not(.ui-menubar-item)").first(); if (newItem && newItem.length) { - this.active.parent().attr("aria-hidden", "true").attr("aria-expanded", "false").hide(); + this.active.parent().prop("aria-hidden", true).prop("aria-expanded", false).hide(); this.focus(event, newItem); return true; } @@ -407,8 +408,7 @@ $.widget("ui.menu", { }, _hasScroll: function() { - // TODO: just use .prop() when we drop support for jQuery <1.6 - return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]( "scrollHeight" ); + return this.element.height() < this.element.prop( "scrollHeight" ); }, select: function( event ) { diff --git a/ui/jquery.ui.menubar.js b/ui/jquery.ui.menubar.js index a0e9afb3c..2ce59bd6c 100644 --- a/ui/jquery.ui.menubar.js +++ b/ui/jquery.ui.menubar.js @@ -48,8 +48,10 @@ $.widget( "ui.menubar", { } }) .hide() - .attr( "aria-hidden", "true" ) - .attr( "aria-expanded", "false" ) + .prop({ + "aria-hidden": true, + "aria-expanded": false + }) .bind( "keydown.menubar", function( event ) { var menu = $( this ); if ( menu.is( ":hidden" ) ) @@ -106,7 +108,7 @@ $.widget( "ui.menubar", { }) .addClass( "ui-button ui-widget ui-button-text-only ui-menubar-link" ) .attr( "role", "menuitem" ) - .attr( "aria-haspopup", "true" ) + .prop( "aria-haspopup", true ) .wrapInner( "" ); // TODO review if these options are a good choice, maybe they can be merged @@ -144,19 +146,19 @@ $.widget( "ui.menubar", { _destroy : function() { var items = this.element.children( "li" ) .removeClass( "ui-menubar-item" ) - .removeAttr( "role", "presentation" ) + .removeAttr( "role" ) .children( "button, a" ); this.element .removeClass( "ui-menubar ui-widget-header ui-helper-clearfix" ) - .removeAttr( "role", "menubar" ) + .removeAttr( "role" ) .unbind( ".menubar" ); items .unbind( ".menubar" ) .removeClass( "ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default" ) - .removeAttr( "role", "menuitem" ) - .removeAttr( "aria-haspopup", "true" ) + .removeAttr( "role" ) + .removeProp( "aria-haspopup" ) // TODO unwrap? .children( "span.ui-button-text" ).each(function( i, e ) { var item = $( this ); @@ -168,8 +170,8 @@ $.widget( "ui.menubar", { this.element.find( ":ui-menu" ) .menu( "destroy" ) .show() - .removeAttr( "aria-hidden", "true" ) - .removeAttr( "aria-expanded", "false" ) + .removeProp( "aria-hidden" ) + .removeProp( "aria-expanded" ) .removeAttr( "tabindex" ) .unbind( ".menubar" ); }, @@ -180,8 +182,10 @@ $.widget( "ui.menubar", { this.active .menu( "closeAll" ) .hide() - .attr( "aria-hidden", "true" ) - .attr( "aria-expanded", "false" ); + .prop({ + "aria-hidden": true, + "aria-expanded": false + }); this.active .prev() .removeClass( "ui-state-active" ) @@ -200,8 +204,10 @@ $.widget( "ui.menubar", { this.active .menu( "closeAll" ) .hide() - .attr( "aria-hidden", "true" ) - .attr( "aria-expanded", "false" ); + .prop({ + "aria-hidden": true, + "aria-expanded": false + }); this.active .prev() .removeClass( "ui-state-active" ); @@ -215,8 +221,8 @@ $.widget( "ui.menubar", { at: "left bottom", of: button }) - .removeAttr( "aria-hidden" ) - .attr( "aria-expanded", "true" ) + .removeProp( "aria-hidden" ) + .prop( "aria-expanded", true ) .menu("focus", event, menu.children( "li" ).first() ) // TODO need a comment here why both events are triggered .focus() diff --git a/ui/jquery.ui.popup.js b/ui/jquery.ui.popup.js index c90755fbb..4c9f20c06 100644 --- a/ui/jquery.ui.popup.js +++ b/ui/jquery.ui.popup.js @@ -41,7 +41,7 @@ $.widget( "ui.popup", { } this.options.trigger - .attr( "aria-haspopup", true ) + .prop( "aria-haspopup", true ) .attr( "aria-owns", this.element.attr( "id" ) ); this.element @@ -118,11 +118,11 @@ $.widget( "ui.popup", { this.element .show() .removeClass( "ui-popup" ) - .removeAttr( "aria-hidden" ) - .removeAttr( "aria-expanded" ); + .removeProp( "aria-hidden" ) + .removeProp( "aria-expanded" ); this.options.trigger - .removeAttr( "aria-haspopup" ) + .removeProp( "aria-haspopup" ) .removeAttr( "aria-owns" ); if ( this.generatedId ) { @@ -140,8 +140,8 @@ $.widget( "ui.popup", { this.element .show() - .attr( "aria-hidden", false ) - .attr( "aria-expanded", true ) + .prop( "aria-hidden", false ) + .prop( "aria-expanded", true ) .position( position ) // TODO find a focussable child, otherwise put focus on element, add tabIndex=0 if not focussable .focus(); @@ -160,8 +160,8 @@ $.widget( "ui.popup", { close: function( event ) { this.element .hide() - .attr( "aria-hidden", true ) - .attr( "aria-expanded", false ); + .prop( "aria-hidden", true ) + .prop( "aria-expanded", false ); this.options.trigger.attr("tabindex", 0); diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index 978155370..9c5d21ffb 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -502,10 +502,10 @@ $.widget( "ui.slider", $.ui.mouse, { if ( value ) { this.handles.filter( ".ui-state-focus" ).blur(); this.handles.removeClass( "ui-state-hover" ); - this.handles.attr( "disabled", "disabled" ); + this.handles.prop( "disabled", true ); this.element.addClass( "ui-disabled" ); } else { - this.handles.removeAttr( "disabled" ); + this.handles.prop( "disabled", false ); this.element.removeClass( "ui-disabled" ); } break; diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index b4cefc982..87da9ac05 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -291,10 +291,10 @@ $.widget( "ui.spinner", { if ( key === "disabled" ) { if ( value ) { - this.element.attr( "disabled", true ); + this.element.prop( "disabled", true ); this.buttons.button( "disable" ); } else { - this.element.removeAttr( "disabled" ); + this.element.prop( "disabled", false ); this.buttons.button( "enable" ); } } @@ -332,7 +332,7 @@ $.widget( "ui.spinner", { destroy: function() { this.element .removeClass( "ui-spinner-input" ) - .removeAttr( "disabled" ) + .prop( "disabled", false ) .removeAttr( "autocomplete" ) .removeAttr( "role" ) .removeAttr( "aria-valuemin" ) diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 00bc07c4f..8079f0357 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -211,7 +211,7 @@ $.Widget.prototype = { .removeData( this.widgetName ); this.widget() .unbind( "." + this.widgetName ) - .removeAttr( "aria-disabled" ) + .removeProp( "aria-disabled" ) .removeClass( this.widgetBaseClass + "-disabled " + "ui-state-disabled" ); @@ -276,7 +276,7 @@ $.Widget.prototype = { if ( key === "disabled" ) { this.widget() .toggleClass( this.widgetBaseClass + "-disabled ui-state-disabled", !!value ) - .attr( "aria-disabled", value ); + .prop( "aria-disabled", value ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); } -- 2.39.5