src/js/libs/spiritual-gui.js
function(elm, Spirit) {
		var doc = elm.ownerDocument;
		var win = doc.defaultView;
		var sig = win.gui.$contextid;
		if (elm.spirit) {
			throw new Error(
				"Cannot repossess element with spirit " +
				elm.spirit + " (exorcise first)"
			);
		} else if (!gui.debug || gui.Type.isSpiritConstructor(Spirit)) {
			elm.spirit = new Spirit(elm, doc, win, sig);
		} else {
			throw new Error(
				"Not a spirit constructor (" + gui.Type.of(Spirit) + ")"
			);
		}
		return elm.spirit;
	}
function(elm, Spirit) {
		var doc = elm.ownerDocument;
		var win = doc.defaultView;
		var sig = win.gui.$contextid;
		if (elm.spirit) {
			throw new Error(
				"Cannot repossess element with spirit " +
				elm.spirit + " (exorcise first)"
			);
		} else if (!gui.debug || gui.Type.isSpiritConstructor(Spirit)) {
			elm.spirit = new Spirit(elm, doc, win, sig);
		} else {
			throw new Error(
				"Not a spirit constructor (" + gui.Type.of(Spirit) + ")"
			);
		}
		return elm.spirit;
	}
function ( elm , Spirit ) { var doc = elm . ownerDocument ; var win = doc . defaultView ; var sig = win . gui . $contextid ; if ( elm . spirit ) { throw new Error ( "Cannot repossess element with spirit " + elm . spirit + " (exorcise first)" ) ; } else if ( ! gui . debug || gui . Type . isSpiritConstructor ( Spirit ) ) { elm . spirit = new Spirit ( elm , doc , win , sig ) ; } else { throw new Error ( "Not a spirit constructor (" + gui . Type . of ( Spirit ) + ")" ) ; } return elm . spirit ; }
Associate DOM element to Spirit instance.
@param {Element} elm
@param {function} Spirit constructor
@returns {Spirit}
Associate DOM element to Spirit instance .