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() {
|
||||
expect( 2 );
|
||||
$( "#radio01" ).next().andSelf().hide();
|
||||
$( "#radio01" ).next().addBack().hide();
|
||||
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(1)" ).is( ".ui-button.ui-corner-left" ) );
|
||||
|
@ -64,7 +64,7 @@ test( "refresh submenu", function() {
|
||||
expect( 2 );
|
||||
var element = $( "#menu2" ).menu();
|
||||
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");
|
||||
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 ) {
|
||||
return $.expr.filters.visible( element ) &&
|
||||
!$( element ).parents().andSelf().filter(function() {
|
||||
!$( element ).parents().addBack().filter(function() {
|
||||
return $.css( this, "visibility" ) === "hidden";
|
||||
}).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)
|
||||
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
|
||||
$.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;
|
||||
$(this.options.handle, this.element)
|
||||
.find("*")
|
||||
.andSelf()
|
||||
.addBack()
|
||||
.each(function() {
|
||||
if(this === event.target) {
|
||||
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,
|
||||
m = $.ui.ddmanager.droppables[t.options.scope] || [],
|
||||
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++) {
|
||||
|
||||
|
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 ),
|
||||
baseClass = animated.attr( "class" ) || "",
|
||||
applyClassChange,
|
||||
allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
|
||||
allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
|
||||
|
||||
// map the animated objects to store the original styles.
|
||||
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
|
||||
this.element
|
||||
.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" )
|
||||
.removeAttr( "role" )
|
||||
.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,
|
||||
selectee = $.data(this, "selectable-item");
|
||||
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();
|
||||
|
||||
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 } : {
|
||||
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
|
||||
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;
|
||||
}
|
||||
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) {
|
||||
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
|
||||
this.element.find( this.options.items ).andSelf().each(function() {
|
||||
this.element.find( this.options.items ).addBack().each(function() {
|
||||
var element = $( this );
|
||||
if ( element.is( "[title]" ) ) {
|
||||
element
|
||||
@ -125,7 +125,7 @@ $.widget( "ui.tooltip", {
|
||||
|
||||
_enable: function() {
|
||||
// restore title attributes
|
||||
this.element.find( this.options.items ).andSelf().each(function() {
|
||||
this.element.find( this.options.items ).addBack().each(function() {
|
||||
var element = $( this );
|
||||
if ( element.data( "ui-tooltip-title" ) ) {
|
||||
element.attr( "title", element.data( "ui-tooltip-title" ) );
|
||||
|
Loading…
Reference in New Issue
Block a user