jQuery 1.6 support.

This commit is contained in:
Scott González 2011-07-29 14:57:06 -04:00
parent 4b17402262
commit b796cc57bd
18 changed files with 26812 additions and 54 deletions

View File

@ -18,7 +18,7 @@
$(function() { $(function() {
function log( message ) { function log( message ) {
$( "<div/>" ).text( message ).prependTo( "#log" ); $( "<div/>" ).text( message ).prependTo( "#log" );
$( "#log" ).attr( "scrollTop", 0 ); $( "#log" ).scrollTop( 0 );
} }
$( "#city" ).autocomplete({ $( "#city" ).autocomplete({

View File

@ -17,7 +17,7 @@
$(function() { $(function() {
function log( message ) { function log( message ) {
$( "<div/>" ).text( message ).prependTo( "#log" ); $( "<div/>" ).text( message ).prependTo( "#log" );
$( "#log" ).attr( "scrollTop", 0 ); $( "#log" ).scrollTop( 0 );
} }
$( "#birds" ).autocomplete({ $( "#birds" ).autocomplete({

View File

@ -17,7 +17,7 @@
$(function() { $(function() {
function log( message ) { function log( message ) {
$( "<div/>" ).text( message ).prependTo( "#log" ); $( "<div/>" ).text( message ).prependTo( "#log" );
$( "#log" ).attr( "scrollTop", 0 ); $( "#log" ).scrollTop( 0 );
} }
$.ajax({ $.ajax({

8936
tests/jquery-1.6.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

8981
tests/jquery-1.6.2.js vendored Normal file

File diff suppressed because it is too large Load Diff

8865
tests/jquery-1.6.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,24 +9,24 @@ test("disabled, explicity value", function() {
$("#radio01").button({ disabled: false }); $("#radio01").button({ disabled: false });
same(false, $("#radio01").button("option", "disabled"), same(false, $("#radio01").button("option", "disabled"),
"disabled option set to false"); "disabled option set to false");
same(false, $("#radio01").attr("disabled"), "element is disabled"); same(false, $("#radio01").propAttr("disabled"), "element is disabled");
$("#radio02").button({ disabled: true }); $("#radio02").button({ disabled: true });
same(true, $("#radio02").button("option", "disabled"), same(true, $("#radio02").button("option", "disabled"),
"disabled option set to true"); "disabled option set to true");
same(true, $("#radio02").attr("disabled"), "element is not disabled"); same(true, $("#radio02").propAttr("disabled"), "element is not disabled");
}); });
test("disabled, null", function() { test("disabled, null", function() {
$("#radio01").button({ disabled: null }); $("#radio01").button({ disabled: null });
same(false, $("#radio01").button("option", "disabled"), same(false, $("#radio01").button("option", "disabled"),
"disabled option set to false"); "disabled option set to false");
same(false, $("#radio01").attr("disabled"), "element is disabled"); same(false, $("#radio01").propAttr("disabled"), "element is disabled");
$("#radio02").attr("disabled", "disabled").button({ disabled: null }); $("#radio02").propAttr("disabled", true).button({ disabled: null });
same(true, $("#radio02").button("option", "disabled"), same(true, $("#radio02").button("option", "disabled"),
"disabled option set to true"); "disabled option set to true");
same(true, $("#radio02").attr("disabled"), "element is not disabled"); same(true, $("#radio02").propAttr("disabled"), "element is not disabled");
}); });
test("text false without icon", function() { test("text false without icon", function() {

View File

@ -107,14 +107,6 @@
<span id="spanTabindex-50" tabindex="-50">.</span> <span id="spanTabindex-50" tabindex="-50">.</span>
</div> </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="zIndex100" style="z-index: 100; position: absolute">
<div id="zIndexAutoWithParent">.</div> <div id="zIndexAutoWithParent">.</div>
</div> </div>

View File

@ -147,15 +147,6 @@ test("focusable - not natively focusable with various tabindex", function() {
isFocusable('#spanTabindex-50', 'span, tabindex -50'); 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() { test("focusable - area elements", function() {
isNotFocusable('#areaCoordsNoHref', 'coords but no href'); isNotFocusable('#areaCoordsNoHref', 'coords but no href');
isFocusable('#areaCoordsHref', 'coords and 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'); 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() { test("tabbable - area elements", function() {
isNotTabbable('#areaCoordsNoHref', 'coords but no href'); isNotTabbable('#areaCoordsNoHref', 'coords but no href');
isTabbable('#areaCoordsHref', 'coords and href'); isTabbable('#areaCoordsHref', 'coords and href');

View File

@ -111,15 +111,15 @@ test('enableDisable', function() {
var dp = $('.ui-datepicker-inline', inl); var dp = $('.ui-datepicker-inline', inl);
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled'); 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.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').propAttr('disabled'), 'Enable/disable inline - form element enabled initially');
inl.datepicker('disable'); inl.datepicker('disable');
ok(inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as disabled'); 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.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').propAttr('disabled'), 'Enable/disable inline - form element disabled');
inl.datepicker('enable'); inl.datepicker('enable');
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as enabled'); 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.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').propAttr('disabled'), 'Enable/disable inline - form element enabled');
inl.datepicker('destroy'); inl.datepicker('destroy');
}); });

View File

@ -692,7 +692,7 @@ test('callbacks', function() {
ok(day21.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 21'); ok(day21.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 21');
ok(day20.is('.day10'), 'Before show day - CSS 20'); ok(day20.is('.day10'), 'Before show day - CSS 20');
ok(!day21.is('.day10'), 'Before show day - CSS 21'); 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'); ok(day21.attr('title') == 'Divisble by 3', 'Before show day - title 21');
inp.datepicker('hide').datepicker('destroy'); inp.datepicker('hide').datepicker('destroy');
}); });

View File

@ -162,12 +162,12 @@ test( "_getCreateOptions()", function() {
options: { options: {
option1: "valuex", option1: "valuex",
option2: "valuex", option2: "valuex",
option3: "value3", option3: "value3"
}, },
_getCreateOptions: function() { _getCreateOptions: function() {
return { return {
option1: "override1", option1: "override1",
option2: "overideX", option2: "overideX"
}; };
}, },
_create: function() { _create: function() {

View File

@ -21,7 +21,7 @@
function log(message) { function log(message) {
$("<div/>").text(message).prependTo("#log"); $("<div/>").text(message).prependTo("#log");
$("#log").attr("scrollTop", 0); $("#log").scrollTop(0);
} }
function enable() { function enable() {

View File

@ -48,7 +48,7 @@ $.widget( "ui.autocomplete", {
"aria-haspopup": "true" "aria-haspopup": "true"
}) })
.bind( "keydown.autocomplete", function( event ) { .bind( "keydown.autocomplete", function( event ) {
if ( self.options.disabled || self.element.attr( "readonly" ) ) { if ( self.options.disabled || self.element.propAttr( "readOnly" ) ) {
return; return;
} }

View File

@ -56,7 +56,7 @@ $.widget( "ui.button", {
.bind( "reset.button", formResetHandler ); .bind( "reset.button", formResetHandler );
if ( typeof this.options.disabled !== "boolean" ) { if ( typeof this.options.disabled !== "boolean" ) {
this.options.disabled = this.element.attr( "disabled" ); this.options.disabled = this.element.propAttr( "disabled" );
} }
this._determineButtonType(); this._determineButtonType();
@ -153,7 +153,7 @@ $.widget( "ui.button", {
return false; return false;
} }
$( this ).addClass( "ui-state-active" ); $( this ).addClass( "ui-state-active" );
self.buttonElement.attr( "aria-pressed", true ); self.buttonElement.attr( "aria-pressed", "true" );
var radio = self.element[ 0 ]; var radio = self.element[ 0 ];
radioGroup( radio ) radioGroup( radio )
@ -162,7 +162,7 @@ $.widget( "ui.button", {
return $( this ).button( "widget" )[ 0 ]; return $( this ).button( "widget" )[ 0 ];
}) })
.removeClass( "ui-state-active" ) .removeClass( "ui-state-active" )
.attr( "aria-pressed", false ); .attr( "aria-pressed", "false" );
}); });
} else { } else {
this.buttonElement this.buttonElement
@ -272,9 +272,9 @@ $.widget( "ui.button", {
$.Widget.prototype._setOption.apply( this, arguments ); $.Widget.prototype._setOption.apply( this, arguments );
if ( key === "disabled" ) { if ( key === "disabled" ) {
if ( value ) { if ( value ) {
this.element.attr( "disabled", true ); this.element.propAttr( "disabled", true );
} else { } else {
this.element.removeAttr( "disabled" ); this.element.propAttr( "disabled", false );
} }
return; return;
} }
@ -291,22 +291,22 @@ $.widget( "ui.button", {
if ( $( this ).is( ":checked" ) ) { if ( $( this ).is( ":checked" ) ) {
$( this ).button( "widget" ) $( this ).button( "widget" )
.addClass( "ui-state-active" ) .addClass( "ui-state-active" )
.attr( "aria-pressed", true ); .attr( "aria-pressed", "true" );
} else { } else {
$( this ).button( "widget" ) $( this ).button( "widget" )
.removeClass( "ui-state-active" ) .removeClass( "ui-state-active" )
.attr( "aria-pressed", false ); .attr( "aria-pressed", "false" );
} }
}); });
} else if ( this.type === "checkbox" ) { } else if ( this.type === "checkbox" ) {
if ( this.element.is( ":checked" ) ) { if ( this.element.is( ":checked" ) ) {
this.buttonElement this.buttonElement
.addClass( "ui-state-active" ) .addClass( "ui-state-active" )
.attr( "aria-pressed", true ); .attr( "aria-pressed", "true" );
} else { } else {
this.buttonElement this.buttonElement
.removeClass( "ui-state-active" ) .removeClass( "ui-state-active" )
.attr( "aria-pressed", false ); .attr( "aria-pressed", "false" );
} }
} }
}, },

View File

@ -58,6 +58,8 @@ $.extend( $.ui, {
// plugins // plugins
$.fn.extend({ $.fn.extend({
propAttr: $.fn.prop || $.fn.attr,
_focus: $.fn.focus, _focus: $.fn.focus,
focus: function( delay, fn ) { focus: function( delay, fn ) {
return typeof delay === "number" ? return typeof delay === "number" ?

View File

@ -306,7 +306,7 @@ $.widget("ui.dialog", {
//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
// http://ui.jquery.com/bugs/ticket/3193 // http://ui.jquery.com/bugs/ticket/3193
saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') }; saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() };
$.ui.dialog.maxZ += 1; $.ui.dialog.maxZ += 1;
self.uiDialog.css('z-index', $.ui.dialog.maxZ); self.uiDialog.css('z-index', $.ui.dialog.maxZ);
self.element.attr(saveScroll); self.element.attr(saveScroll);

View File

@ -502,10 +502,10 @@ $.widget( "ui.slider", $.ui.mouse, {
if ( value ) { if ( value ) {
this.handles.filter( ".ui-state-focus" ).blur(); this.handles.filter( ".ui-state-focus" ).blur();
this.handles.removeClass( "ui-state-hover" ); this.handles.removeClass( "ui-state-hover" );
this.handles.attr( "disabled", "disabled" ); this.handles.propAttr( "disabled", true );
this.element.addClass( "ui-disabled" ); this.element.addClass( "ui-disabled" );
} else { } else {
this.handles.removeAttr( "disabled" ); this.handles.propAttr( "disabled", false );
this.element.removeClass( "ui-disabled" ); this.element.removeClass( "ui-disabled" );
} }
break; break;