
var warnedAbout = {};

// List of warnings already given; public read only
jQuery.migrateWarnings = [];

// Set to true to prevent console output; migrateWarnings still maintained
// jQuery.migrateMute = false;

// Show a message on the console so devs know we're active
if (!jQuery.migrateMute && window.console && window.console.log) {
	window.console.log("JQMIGRATE: Logging is active");
}

// Set to false to disable traces that appear with warnings
if (jQuery.migrateTrace === undefined) {
	jQuery.migrateTrace = true;
}

// Forget any warnings we've already given; public
jQuery.migrateReset = function() {
	warnedAbout = {};
	jQuery.migrateWarnings.length = 0;
};

function migrateWarn(msg) {
	var console = window.console;
	if (!warnedAbout[msg]) {
		warnedAbout[msg] = true;
		jQuery.migrateWarnings.push(msg);
		if (console && console.warn && !jQuery.migrateMute) {
			console.warn("JQMIGRATE: " + msg);
			if (jQuery.migrateTrace && console.trace) {
				console.trace();
			}
		}
	}
}

function migrateWarnProp(obj, prop, value, msg) {
	if (Object.defineProperty) {
		// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
		// allow property to be overwritten in case some other plugin wants it
		try {
			Object.defineProperty(obj, prop, {
				configurable: true,
				enumerable: true,
				get: function() {
					migrateWarn(msg);
					return value;
				},
				set: function(newValue) {
					migrateWarn(msg);
					value = newValue;
				}
			});
			return;
		} catch(err) {
			// IE8 is a dope about Object.defineProperty, can't warn there
		}
	}

	// Non-ES5 (or broken) browser; just set the property
	jQuery._definePropertyBroken = true;
	obj[ prop ] = value;
}

if (document.compatMode === "BackCompat") {
	// jQuery has never supported or tested Quirks Mode
	migrateWarn("jQuery is not compatible with Quirks Mode");
}