Hack to use jQuery AMD widgets and Dojo together


		<!-- temporary redefine define.amd object  (Dojo AMD loader) -->
		<xp:script clientSide="true" type="text/javascript">
			<xp:this.contents><![CDATA[${javascript:"if (typeof define === 'function' && define.amd) {if(define.amd.vendor =='dojotoolkit.org'){define._amd = define.amd;delete define.amd;}}";}]]></xp:this.contents>

		<!-- load jquery AMD enabled widgets -->
		<xp:script src="/select2.js" clientSide="true"></xp:script>

		<!-- restore define.amd object (Dojo AMD loader) -->
		<xp:script clientSide="true">
			<xp:this.contents><![CDATA[${javascript:"if (typeof define === 'function' && define._amd) {define.amd = define._amd; delete define._amd;}"}]]></xp:this.contents>

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...