//region Import jQuery itself import $ from 'jquery'; //endregion import Utils from 'utils'; window.$ = $; // Ensure $ is available everywhere window.jQuery = $; // Ensure global “jQuery” property available: necessary to use bootstrap event in jQuery.on ? (function ($) { //region .data const jqueryDataOrig = $.fn.data; /** * Get a DOM "data" value * * @param {string} key The "data" key * @param {any} defaultValue The default value * * @return {any} The "data" value */ $.fn.data = function (key, defaultValue = undefined) { const value = jqueryDataOrig.apply(this, [key]); if (Utils.isUndefined(value)) { return defaultValue; } return value; }; //endregion //region .matchTag /** * Check if a jQuery element is one of the tags * * @param {string} tag The tag to check * @param {string} extraTags Extra tags to check * * @return {boolean} True if the element is one of the tags */ $.fn.matchTag = function (tag, ...extraTags) { extraTags.push(tag); extraTags = extraTags.map((tag) => tag.toUpperCase()); return $.inArray(this.prop('tagName').toUpperCase(), extraTags) !== -1; }; //endregion })($);