Button: avoid .last() call to ensure compatibility with jQuery 1.3. Fixed #7089 - Button: .last() used in ui.button but not exists in jQ 1.3

This commit is contained in:
Richard Worth 2011-03-14 17:18:35 -04:00
parent 6fcdff13fa
commit 6bbc43113c

View File

@ -200,7 +200,7 @@ $.widget( "ui.button", {
if ( this.type === "checkbox" || this.type === "radio" ) { if ( this.type === "checkbox" || this.type === "radio" ) {
// we don't search against the document in case the element // we don't search against the document in case the element
// is disconnected from the DOM // is disconnected from the DOM
var ancestor = this.element.parents().last(), var ancestor = this.element.parents().filter(":last"),
labelSelector = "label[for=" + this.element.attr("id") + "]"; labelSelector = "label[for=" + this.element.attr("id") + "]";
this.buttonElement = ancestor.find( labelSelector ); this.buttonElement = ancestor.find( labelSelector );
if ( !this.buttonElement.length ) { if ( !this.buttonElement.length ) {