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" ) );
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 );
});
function visible( element ) {
return $.expr.filters.visible( element ) &&
- !$( element ).parents().andSelf().filter(function() {
+ !$( element ).parents().addBack().filter(function() {
return $.css( this, "visibility" ) === "hidden";
}).length;
}
});
}
+// 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 ) {
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;
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++) {
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() {
// 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" )
}
});
- $(event.target).parents().andSelf().each(function() {
+ $(event.target).parents().addBack().each(function() {
var doSelect,
selectee = $.data(this, "selectable-item");
if (selectee) {
.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 -
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;
}
});
// 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
_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" ) );