]> source.dussan.org Git - jquery-ui.git/commitdiff
.attr() -> .prop()
authorScott González <scott.gonzalez@gmail.com>
Wed, 8 Jun 2011 21:02:57 +0000 (17:02 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 8 Jun 2011 21:02:57 +0000 (17:02 -0400)
21 files changed:
tests/unit/accordion/accordion_core.js
tests/unit/button/button_options.js
tests/unit/core/core.html
tests/unit/core/selector.js
tests/unit/datepicker/datepicker_methods.js
tests/unit/datepicker/datepicker_options.js
tests/unit/dialog/dialog_tickets.js
tests/unit/progressbar/progressbar_core.js
tests/unit/testsuite.js
tests/unit/tooltip/tooltip_methods.js
ui/jquery.ui.accordion.js
ui/jquery.ui.autocomplete.js
ui/jquery.ui.button.js
ui/jquery.ui.datepicker.js
ui/jquery.ui.dialog.js
ui/jquery.ui.menu.js
ui/jquery.ui.menubar.js
ui/jquery.ui.popup.js
ui/jquery.ui.slider.js
ui/jquery.ui.spinner.js
ui/jquery.ui.widget.js

index 280339c2666951a7dc07a21adf13940ab065e147..7bf71c31b59a67dbd3f8e311bc13735165f06ff6 100644 (file)
@@ -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 ) );
index 5b25ecd631ac2c4a21bf305536ae22f18d912f2e..a3ab5ae103cdf0b064e00980bedf84456b20fda6 100644 (file)
@@ -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() {
index 31702dd4e6c5fd9c35eb2b596713159329929d6b..62a8b3c86a60809f0f00400daeba4040f27d9676 100644 (file)
                <span id="spanTabindex-50" tabindex="-50">.</span>
        </div>
        
-       <div>
-               <input id="inputTabindexfoo" tabindex="foo" />
-               <input id="inputTabindex3foo" tabindex="3foo" />
-               
-               <span id="spanTabindexfoo" tabindex="foo">.</span>
-               <span id="spanTabindex3foo" tabindex="3foo">.</span>
-       </div>
-       
        <div id="zIndex100" style="z-index: 100; position: absolute">
                <div id="zIndexAutoWithParent">.</div>
        </div>
index e7b7f9b6cd8fce76fbf89b48e326a7163ab8c05a..44888ad8810a39a337e43df560194662cda7821c 100644 (file)
@@ -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');
index 7ef9776042bcba02139a21442d152ebd271753a3..c8f1b75b29417ad279d555b4008841cdfdca3dc8 100644 (file)
@@ -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');
 });
 
index a10d1ea454f973c2f4a7fd076cdfe6eea11d0a37..272af9dac239b84c6b7e524ae160ef33bdb551f1 100644 (file)
@@ -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');
 });
index def2452dedfc5bfb30915b57f55d7626d6847e61..1cfdcefea732b5d89cb31430e4b0653218754162 100644 (file)
@@ -65,17 +65,15 @@ test("#6137: dialog('open') causes form elements to reset on IE7", function() {
        expect(2);
 
        d1 = $('<form><input type="radio" name="radio" id="a" value="a" checked="checked"></input>' +
-                               '<input type="radio" name="radio" id="b" value="b">b</input></form>').dialog({autoOpen: false});
+                               '<input type="radio" name="radio" id="b" value="b">b</input></form>').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 = $('<div></div>').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(){
index e59579634b36c8dc80e5ec8062947910f6232f94..2380061db942fefc5d676d1718d48ce43182f1ac 100644 (file)
@@ -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);
index 3d9e64d6036dc4987b8c6f0fd82632ee8f7ddd70..c8afcbe79c672385dde95140533f4e043a798471 100644 (file)
@@ -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();
index 798d5589614dc3f3af69faeb7fa357b246ebdd4e..74fd35d84754e4be0cb260890a91d016a3ff8d23 100644 (file)
@@ -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" );
index 7602ae9bccdfda7fbcde3b5784da378d34896684..fc0ba3910c6f1c5ad37f211ad8d7a291d46f83fa 100644 (file)
@@ -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();
        },
 
index e39b4649e25ec7d4ddc52606c539f3e5769c53e5..3f5e2d10a39487f11ffab0519a5410a0ac5d0d28 100644 (file)
@@ -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();
        },
 
index 482cdc24cf3564efdab722774aa4ed9724c7f1da..5f48f69a20d8b1aa1999e58f82d1a63cbd9b8244 100644 (file)
@@ -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 );
                        }
                }
        },
index 4c73bdfd8e36eb94701f893b2e02850a8c1a8b15..bf42f0411e7ae01aeef30ce607d39d0b8a4db262 100644 (file)
@@ -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
index 0eba39842ba5819b23f3082cfad09206fef27bd5..89ccdf7345490814b8c92ad0c39697f5a114b104 100644 (file)
@@ -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 );
index 03e14f12491483e584a58fd79f010c95cb769b30..8045797ae03121e3ed2a09d6c75f7ccbf261ff65 100644 (file)
@@ -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('<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>');
                        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 ) {
index a0e9afb3c2b67d2f10efa31b613b5a8022dd0c92..2ce59bd6cc7d9ee70d92338a73b1299bd1ca1526 100644 (file)
@@ -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( "<span class='ui-button-text'></span>" );
 
                        // 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()
index c90755fbb948c3318e239b3c7985f43791cc25b5..4c9f20c065df1290cb544b45ba40ab244d8c8c27 100644 (file)
@@ -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);
 
index 978155370771941d0ddf24f4b1ffa64de0026118..9c5d21ffb549d1a7bcf5f37d20b5e1de2029ff3f 100644 (file)
@@ -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;
index b4cefc9820ccb1796fcff4909fda7f80b81de70f..87da9ac057518fd96d2aa9818d4afaf832f69107 100644 (file)
@@ -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" )
index 00bc07c4fec289428056dc2195b18dfe8a6acf76..8079f03574c841ecb932efdcb26ef3d0fc8c3b48 100644 (file)
@@ -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" );
                }