summaryrefslogtreecommitdiffstats
path: root/documentation/installing
Commit message (Collapse)AuthorAgeFilesLines
* Scaled images for print edition and fixed errors up to the beginning of ↵Marko Gronroos2016-06-3011-132/+1162
| | | | | | layouts chapter (#19835). Also major revision of Tree, CustomField, and layouts overview. Change-Id: I19f5e9511b83f953ce4707f324d81c2821ebb69d
* Update Eclipse documentation for preferences paneMarkus Koivisto2016-04-252-12/+13
| | | | Change-Id: Ibb1a51b708a7ba4d78f56447d7054ee3c6297193
* Add documentation for Eclipse Notification CenterMarkus Koivisto2016-03-2912-0/+92
| | | | Change-Id: Ie00911096ca93d557a812415f27fe8d54bfd6180
* Fixed some missing images and broken xrefs, as well as problems in the ↵Marko Gronroos2016-03-181-2/+0
| | | | | | getting-started chapter (#19639). Change-Id: Ie8e371c059f70600bafcf781938ef35878f41324
* Reorganized the Getting Started chapter to separate installation and project ↵Marko Gronroos2016-03-1735-0/+17311
creation chapters. #19639 Change-Id: I4aab29b8b9ab23091903016e9cc91850c4ca3b93
: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
import { jQuery } from "../core.js";
import { document } from "../var/document.js";
import { sort } from "../var/sort.js";
import { splice } from "../var/splice.js";
import { slice } from "../var/slice.js";

var hasDuplicate;

// Document order sorting
function sortOrder( a, b ) {

	// Flag for duplicate removal
	if ( a === b ) {
		hasDuplicate = true;
		return 0;
	}

	// Sort on method existence if only one input has compareDocumentPosition
	var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
	if ( compare ) {
		return compare;
	}

	// Calculate position if both inputs belong to the same document
	// Support: IE 11+
	// IE sometimes throws a "Permission denied" error when strict-comparing
	// two documents; shallow comparisons work.
	// eslint-disable-next-line eqeqeq
	compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
		a.compareDocumentPosition( b ) :

		// Otherwise we know they are disconnected
		1;

	// Disconnected nodes
	if ( compare & 1 ) {

		// Choose the first element that is related to the document
		// Support: IE 11+
		// IE sometimes throws a "Permission denied" error when strict-comparing
		// two documents; shallow comparisons work.
		// eslint-disable-next-line eqeqeq
		if ( a == document || a.ownerDocument == document &&
			jQuery.contains( document, a ) ) {
			return -1;
		}

		// Support: IE 11+
		// IE sometimes throws a "Permission denied" error when strict-comparing
		// two documents; shallow comparisons work.
		// eslint-disable-next-line eqeqeq
		if ( b == document || b.ownerDocument == document &&
			jQuery.contains( document, b ) ) {
			return 1;
		}

		// Maintain original order
		return 0;
	}

	return compare & 4 ? -1 : 1;
}

/**
 * Document sorting and removing duplicates
 * @param {ArrayLike} results
 */
jQuery.uniqueSort = function( results ) {
	var elem,
		duplicates = [],
		j = 0,
		i = 0;

	hasDuplicate = false;

	sort.call( results, sortOrder );

	if ( hasDuplicate ) {
		while ( ( elem = results[ i++ ] ) ) {
			if ( elem === results[ i ] ) {
				j = duplicates.push( i );
			}
		}
		while ( j-- ) {
			splice.call( results, duplicates[ j ], 1 );
		}
	}

	return results;
};

jQuery.fn.uniqueSort = function() {
	return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
};