Sha256: 401803e0e9b0545e56bd29d6ea54b985c607d0eb4498dc4d331d5c7786035a82

Contents?: true

Size: 1.67 KB

Versions: 13

Compression:

Stored size: 1.67 KB

Contents

/*!
 * jQuery UI Labels 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: labels
//>>group: Core
//>>description: Find all the labels associated with a given input
//>>docs: http://api.jqueryui.com/labels/

( function( factory ) {
	if ( typeof define === "function" && define.amd ) {

		// AMD. Register as an anonymous module.
		define( [ "jquery", "./version", "./escape-selector" ], factory );
	} else {

		// Browser globals
		factory( jQuery );
	}
} ( function( $ ) {

return $.fn.labels = function() {
	var ancestor, selector, id, labels, ancestors;

	// Check control.labels first
	if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
		return this.pushStack( this[ 0 ].labels );
	}

	// Support: IE <= 11, FF <= 37, Android <= 2.3 only
	// Above browsers do not support control.labels. Everything below is to support them
	// as well as document fragments. control.labels does not work on document fragments
	labels = this.eq( 0 ).parents( "label" );

	// Look for the label based on the id
	id = this.attr( "id" );
	if ( id ) {

		// We don't search against the document in case the element
		// is disconnected from the DOM
		ancestor = this.eq( 0 ).parents().last();

		// Get a full set of top level ancestors
		ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );

		// Create a selector for the label based on the id
		selector = "label[for='" + $.ui.escapeSelector( id ) + "']";

		labels = labels.add( ancestors.find( selector ).addBack( selector ) );

	}

	// Return whatever we have found for labels
	return this.pushStack( labels );
};

} ) );

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
ext_yarn-0.6.0 vendor/jquery-ui/ui/labels.js
ext_yarn-0.5.0 vendor/jquery-ui/ui/labels.js
ext_yarn-0.4.0 vendor/jquery-ui/ui/labels.js
ext_yarn-0.3.1 vendor/jquery-ui/ui/labels.js
ext_yarn-0.3.0 vendor/jquery-ui/ui/labels.js
ext_yarn-0.2.0 vendor/jquery-ui/ui/labels.js
ext_yarn-0.1.2 node_modules/jquery-ui/ui/labels.js
ext_yarn-0.1.1 node_modules/jquery-ui/ui/labels.js
ext_yarn-0.1.0 node_modules/jquery-ui/ui/labels.js
ext_sprockets-0.1.6 node_modules/jquery-ui/ui/labels.js
ext_sprockets-0.1.5 node_modules/jquery-ui/ui/labels.js
ext_sprockets-0.1.1 node_modules/jquery-ui/ui/labels.js
date_picker-0.0.9 test/dummy/vendor/assets/components/jquery-ui/ui/labels.js