mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
All: Use .addBack() instead of .andSelf().
This commit is contained in:
parent
80e46c93a8
commit
8ec7a1b69f
@ -138,7 +138,7 @@ test( "#7092 - button creation that requires a matching label does not find labe
|
|||||||
|
|
||||||
test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
|
test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
$( "#radio01" ).next().andSelf().hide();
|
$( "#radio01" ).next().addBack().hide();
|
||||||
var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
|
var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
|
||||||
ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
|
ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
|
||||||
ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
|
ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
|
||||||
|
@ -64,7 +64,7 @@ test( "refresh submenu", function() {
|
|||||||
expect( 2 );
|
expect( 2 );
|
||||||
var element = $( "#menu2" ).menu();
|
var element = $( "#menu2" ).menu();
|
||||||
equal( element.find( "ul:first .ui-menu-item" ).length, 3 );
|
equal( element.find( "ul:first .ui-menu-item" ).length, 3 );
|
||||||
element.find( "ul" ).andSelf().append( "<li><a href=\"#\">New Item</a></li>" );
|
element.find( "ul" ).addBack().append( "<li><a href=\"#\">New Item</a></li>" );
|
||||||
element.menu("refresh");
|
element.menu("refresh");
|
||||||
equal( element.find( "ul:first .ui-menu-item" ).length, 4 );
|
equal( element.find( "ul:first .ui-menu-item" ).length, 4 );
|
||||||
});
|
});
|
||||||
|
11
ui/jquery.ui.core.js
vendored
11
ui/jquery.ui.core.js
vendored
@ -152,7 +152,7 @@ function focusable( element, isTabIndexNotNaN ) {
|
|||||||
|
|
||||||
function visible( element ) {
|
function visible( element ) {
|
||||||
return $.expr.filters.visible( element ) &&
|
return $.expr.filters.visible( element ) &&
|
||||||
!$( element ).parents().andSelf().filter(function() {
|
!$( element ).parents().addBack().filter(function() {
|
||||||
return $.css( this, "visibility" ) === "hidden";
|
return $.css( this, "visibility" ) === "hidden";
|
||||||
}).length;
|
}).length;
|
||||||
}
|
}
|
||||||
@ -227,6 +227,15 @@ if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// support: jQuery <1.8
|
||||||
|
if ( !$.fn.addBack ) {
|
||||||
|
$.fn.addBack = function( selector ) {
|
||||||
|
return this.add( selector == null ?
|
||||||
|
this.prevObject : this.prevObject.filter( selector )
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
|
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
|
||||||
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
|
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
|
||||||
$.fn.removeData = (function( removeData ) {
|
$.fn.removeData = (function( removeData ) {
|
||||||
|
2
ui/jquery.ui.draggable.js
vendored
2
ui/jquery.ui.draggable.js
vendored
@ -280,7 +280,7 @@ $.widget("ui.draggable", $.ui.mouse, {
|
|||||||
var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
|
var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
|
||||||
$(this.options.handle, this.element)
|
$(this.options.handle, this.element)
|
||||||
.find("*")
|
.find("*")
|
||||||
.andSelf()
|
.addBack()
|
||||||
.each(function() {
|
.each(function() {
|
||||||
if(this === event.target) {
|
if(this === event.target) {
|
||||||
handle = true;
|
handle = true;
|
||||||
|
2
ui/jquery.ui.droppable.js
vendored
2
ui/jquery.ui.droppable.js
vendored
@ -235,7 +235,7 @@ $.ui.ddmanager = {
|
|||||||
var i, j,
|
var i, j,
|
||||||
m = $.ui.ddmanager.droppables[t.options.scope] || [],
|
m = $.ui.ddmanager.droppables[t.options.scope] || [],
|
||||||
type = event ? event.type : null, // workaround for #2317
|
type = event ? event.type : null, // workaround for #2317
|
||||||
list = (t.currentItem || t.element).find(":data(ui-droppable)").andSelf();
|
list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack();
|
||||||
|
|
||||||
droppablesLoop: for (i = 0; i < m.length; i++) {
|
droppablesLoop: for (i = 0; i < m.length; i++) {
|
||||||
|
|
||||||
|
2
ui/jquery.ui.effect.js
vendored
2
ui/jquery.ui.effect.js
vendored
@ -761,7 +761,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
|
|||||||
var animated = $( this ),
|
var animated = $( this ),
|
||||||
baseClass = animated.attr( "class" ) || "",
|
baseClass = animated.attr( "class" ) || "",
|
||||||
applyClassChange,
|
applyClassChange,
|
||||||
allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
|
allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
|
||||||
|
|
||||||
// map the animated objects to store the original styles.
|
// map the animated objects to store the original styles.
|
||||||
allAnimations = allAnimations.map(function() {
|
allAnimations = allAnimations.map(function() {
|
||||||
|
2
ui/jquery.ui.menu.js
vendored
2
ui/jquery.ui.menu.js
vendored
@ -139,7 +139,7 @@ $.widget( "ui.menu", {
|
|||||||
// Destroy (sub)menus
|
// Destroy (sub)menus
|
||||||
this.element
|
this.element
|
||||||
.removeAttr( "aria-activedescendant" )
|
.removeAttr( "aria-activedescendant" )
|
||||||
.find( ".ui-menu" ).andSelf()
|
.find( ".ui-menu" ).addBack()
|
||||||
.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
|
.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
|
||||||
.removeAttr( "role" )
|
.removeAttr( "role" )
|
||||||
.removeAttr( "tabIndex" )
|
.removeAttr( "tabIndex" )
|
||||||
|
2
ui/jquery.ui.selectable.js
vendored
2
ui/jquery.ui.selectable.js
vendored
@ -113,7 +113,7 @@ $.widget("ui.selectable", $.ui.mouse, {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(event.target).parents().andSelf().each(function() {
|
$(event.target).parents().addBack().each(function() {
|
||||||
var doSelect,
|
var doSelect,
|
||||||
selectee = $.data(this, "selectable-item");
|
selectee = $.data(this, "selectable-item");
|
||||||
if (selectee) {
|
if (selectee) {
|
||||||
|
2
ui/jquery.ui.slider.js
vendored
2
ui/jquery.ui.slider.js
vendored
@ -256,7 +256,7 @@ $.widget( "ui.slider", $.ui.mouse, {
|
|||||||
.focus();
|
.focus();
|
||||||
|
|
||||||
offset = closestHandle.offset();
|
offset = closestHandle.offset();
|
||||||
mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
|
mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
|
||||||
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
|
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
|
||||||
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
|
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
|
||||||
top: event.pageY - offset.top -
|
top: event.pageY - offset.top -
|
||||||
|
2
ui/jquery.ui.sortable.js
vendored
2
ui/jquery.ui.sortable.js
vendored
@ -126,7 +126,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(this.options.handle && !overrideHandle) {
|
if(this.options.handle && !overrideHandle) {
|
||||||
$(this.options.handle, currentItem).find("*").andSelf().each(function() {
|
$(this.options.handle, currentItem).find("*").addBack().each(function() {
|
||||||
if(this === event.target) {
|
if(this === event.target) {
|
||||||
validHandle = true;
|
validHandle = true;
|
||||||
}
|
}
|
||||||
|
4
ui/jquery.ui.tooltip.js
vendored
4
ui/jquery.ui.tooltip.js
vendored
@ -113,7 +113,7 @@ $.widget( "ui.tooltip", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// remove title attributes to prevent native tooltips
|
// remove title attributes to prevent native tooltips
|
||||||
this.element.find( this.options.items ).andSelf().each(function() {
|
this.element.find( this.options.items ).addBack().each(function() {
|
||||||
var element = $( this );
|
var element = $( this );
|
||||||
if ( element.is( "[title]" ) ) {
|
if ( element.is( "[title]" ) ) {
|
||||||
element
|
element
|
||||||
@ -125,7 +125,7 @@ $.widget( "ui.tooltip", {
|
|||||||
|
|
||||||
_enable: function() {
|
_enable: function() {
|
||||||
// restore title attributes
|
// restore title attributes
|
||||||
this.element.find( this.options.items ).andSelf().each(function() {
|
this.element.find( this.options.items ).addBack().each(function() {
|
||||||
var element = $( this );
|
var element = $( this );
|
||||||
if ( element.data( "ui-tooltip-title" ) ) {
|
if ( element.data( "ui-tooltip-title" ) ) {
|
||||||
element.attr( "title", element.data( "ui-tooltip-title" ) );
|
element.attr( "title", element.data( "ui-tooltip-title" ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user