setup.tooltip = function (elSelector, contentSelector) {
	jUIPromise.then(function () {
		$(elSelector).tooltip({
			content : $(contentSelector).contents()
		});
	});
};

Macro.add('tooltip', {
	skipArgs : false,
	tags:[],
	handler  : function () {
		try {
			const [domTag, styleclass,tooltip] = this.args;
			const contents = this.payload[0].contents;

			setup.tooltipCounter ??= 0;
			setup.tooltipCounter = (setup.tooltipCounter + 1) % 1000000;

			const _tooltip_id = `tooltip_${setup.tooltipCounter}`
			const _tooltip_id_hidden = `tooltip_${setup.tooltipCounter}_hidden`

			const _linkMarkup = `<${domTag} id="${_tooltip_id}" class="${styleclass}" title="">${contents}</${domTag}>`
		

			const tooltipMarkup = `<a id="${_tooltip_id_hidden}" style="display:none">${tooltip}</a><<done>>setup.tooltip("#${_tooltip_id}", '#${_tooltip_id_hidden}')<</done>>`;

			const output = _linkMarkup+tooltipMarkup;
			
			jQuery(this.output).wiki(output);
		}
		catch (ex) {
			return this.error('ERROR in tooltip-widget: ' + ex.message);
		}
	}
});