From afccd22b780ca0a185ac50746e21786e24b95884 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Wed, 23 Feb 2022 23:31:57 +0530 Subject: [PATCH 1/4] fix(jquery): issue regarding jquery prop --- assets/js/public/code-snippet.js | 4 +- assets/js/public/form-field-unique.js | 2 +- assets/js/public/forms-section-samples.js | 2 +- assets/js/public/page-accessibility.js | 6 +- assets/js/public/page-quizzes.js | 8 +- assets/js/select2.full.js | 60 ++++----- library/js/authentication.js | 2 +- library/js/form-load.js | 6 +- library/js/select2.full.js | 156 +++++++++++----------- library/js/select2.js | 2 +- 10 files changed, 124 insertions(+), 124 deletions(-) diff --git a/assets/js/public/code-snippet.js b/assets/js/public/code-snippet.js index 49cfc086..16064ab3 100644 --- a/assets/js/public/code-snippet.js +++ b/assets/js/public/code-snippet.js @@ -76,7 +76,7 @@ showTooltip: function( e, msg ) { $( e ).addClass( 'sui-tooltip' ); $( e ).prop( 'aria-label', msg ); - $( e ).prop( 'data-tooltip', msg ); + $( e ).data( 'tooltip', msg ); }, generateUniqueId: function() { @@ -102,7 +102,7 @@ $.fn[ pluginName ] = function( options ) { return this.each( function() { - // instance of SUICodeSnippet can be called with $(element).data('SUICodeSnippet') + // instance of SUICodeSnippet can be called with $(element).data( 'SUICodeSnippet') if ( ! $.data( this, pluginName ) ) { $.data( this, pluginName, new SUICodeSnippet( this, options ) ); } diff --git a/assets/js/public/form-field-unique.js b/assets/js/public/form-field-unique.js index 69437340..1ff8b6ab 100644 --- a/assets/js/public/form-field-unique.js +++ b/assets/js/public/form-field-unique.js @@ -12,7 +12,7 @@ const element = $( el ); const form = element.closest( '.forminator-custom-form' ); - if ( '' === form.prop( 'data-id' ) ) { + if ( '' === form.data( 'id' ) ) { return; } diff --git a/assets/js/public/forms-section-samples.js b/assets/js/public/forms-section-samples.js index 4656dc69..30573369 100644 --- a/assets/js/public/forms-section-samples.js +++ b/assets/js/public/forms-section-samples.js @@ -36,7 +36,7 @@ const column = $( this ); const field = column.data( 'field' ); - if ( column.prop( 'data-field' ) && '' !== column.prop( 'data-field' ) ) { + if ( column.data( 'field' ) && '' !== column.data( 'field' ) ) { column.load( 'templates/form-elements/field-' + field + '.html', function() { diff --git a/assets/js/public/page-accessibility.js b/assets/js/public/page-accessibility.js index 7b33ea85..65bdc2a8 100644 --- a/assets/js/public/page-accessibility.js +++ b/assets/js/public/page-accessibility.js @@ -126,7 +126,7 @@ const colDiv = $( this ); const colField = colDiv.data( 'field' ); - if ( colDiv.prop( 'data-field' ) && '' !== colDiv.prop( 'data-field' ) ) { + if ( colDiv.data( 'field' ) && '' !== colDiv.data( 'field' ) ) { colDiv.load( 'templates/form-elements/field-' + colField + '.html', function() { @@ -146,7 +146,7 @@ // Hidden field if ( true === column.data( 'conditional' ) ) { - columnUnwrapped.prop( 'data-conditional', 'true' ); + columnUnwrapped.data( 'conditional', 'true' ); } // Hide column @@ -177,7 +177,7 @@ FUI.multiSelectStates( multiselect ); // Load "Material" design wrappers - if ( 'material' === column.closest( '.forminator-custom-form' ).prop( 'data-design' ) ) { + if ( 'material' === column.closest( '.forminator-custom-form' ).data( 'design' ) ) { if ( input.length ) { diff --git a/assets/js/public/page-quizzes.js b/assets/js/public/page-quizzes.js index a7135ad5..f328042a 100644 --- a/assets/js/public/page-quizzes.js +++ b/assets/js/public/page-quizzes.js @@ -105,7 +105,7 @@ let resultText = 'You selected a wrong answer.'; - if ( answer.val() === question.prop( 'data-correct-answer' ) ) { + if ( answer.val() === question.data( 'correct-answer' ) ) { icon = 'check'; validate = 'correct'; resultText = 'Right! You selected the correct answer.'; @@ -150,7 +150,7 @@ answer.prop( 'checked', true ); answers.prop( 'disabled', true ); - if ( answer.val() === question.prop( 'data-correct-answer' ) ) { + if ( answer.val() === question.data( 'correct-answer' ) ) { icon = 'check'; validate = 'correct'; resultText = 'Right! You selected the correct answer.'; @@ -200,11 +200,11 @@ form = $( this ); - if ( typeof undefined !== typeof form.prop( 'data-quiz' ) && 'knowledge' === form.prop( 'data-quiz' ) ) { + if ( typeof undefined !== typeof form.data( 'quiz' ) && 'knowledge' === form.data( 'quiz' ) ) { SHOWCASE.demoKnowledge( this ); } - if ( typeof undefined !== typeof form.prop( 'data-quiz' ) && 'nowrong' === form.prop( 'data-quiz' ) ) { + if ( typeof undefined !== typeof form.data( 'quiz' ) && 'nowrong' === form.data( 'quiz' ) ) { SHOWCASE.demoNoWrong( this ); } diff --git a/assets/js/select2.full.js b/assets/js/select2.full.js index ca79ae6f..6f58202a 100644 --- a/assets/js/select2.full.js +++ b/assets/js/select2.full.js @@ -1102,7 +1102,7 @@ return; } - var data = $highlighted.data('data'); + var data = $highlighted.data( 'data'); if ($highlighted.prop('aria-selected') == 'true') { self.trigger('close', {}); @@ -1214,7 +1214,7 @@ function (evt) { var $this = $(this); - var data = $this.data('data'); + var data = $this.data( 'data'); if ($this.prop('aria-selected') === 'true') { if (self.options.get('multiple')) { @@ -1237,7 +1237,7 @@ this.$results.on('mouseenter', '.select2-results__option[aria-selected]', function (evt) { - var data = $(this).data('data'); + var data = $(this).data( 'data'); self.getHighlightedResults() .removeClass('select2-results__option--highlighted'); @@ -1352,8 +1352,8 @@ this._tabindex = 0; - if (this.$element.data('old-tabindex') != null) { - this._tabindex = this.$element.data('old-tabindex'); + if (this.$element.data( 'old-tabindex') != null) { + this._tabindex = this.$element.data( 'old-tabindex'); } else if (this.$element.prop('tabindex') != null) { this._tabindex = this.$element.prop('tabindex'); } @@ -1461,7 +1461,7 @@ return; } - var $element = $this.data('element'); + var $element = $this.data( 'element'); // FUI-SELECT2 renamed function to FUIselect2 $element.FUIselect2('close'); @@ -1636,7 +1636,7 @@ var $remove = $(this); var $selection = $remove.parent(); - var data = $selection.data('data'); + var data = $selection.data( 'data'); self.trigger('unselect', { originalEvent: evt, @@ -1687,7 +1687,7 @@ $selection.append(formatted); $selection.prop('title', selection.title || selection.text); - $selection.data('data', selection); + $selection.data( 'data', selection); $selections.push($selection); } @@ -1795,7 +1795,7 @@ evt.stopPropagation(); - var data = $clear.data('data'); + var data = $clear.data( 'data'); for (var d = 0; d < data.length; d++) { var unselectData = { @@ -1840,7 +1840,7 @@ '×' + '' ); - $remove.data('data', data); + $remove.data( 'data', data); this.$selection.find('.select2-selection__rendered').prepend($remove); }; @@ -1931,7 +1931,7 @@ .prev('.select2-selection__choice'); if ($previousChoice.length > 0) { - var item = $previousChoice.data('data'); + var item = $previousChoice.data( 'data'); self.searchRemoveChoice(item); @@ -3599,7 +3599,7 @@ if (tag != null) { var $option = self.option(tag); - $option.prop('data-select2-tag', true); + $option.data( 'select2-tag', true); self.addOptions([$option]); @@ -3684,7 +3684,7 @@ // If an existing option wasn't found for it, create the option if (!$existingOptions.length) { var $option = self.option(item); - $option.prop('data-select2-tag', true); + $option.data( 'select2-tag', true); self._removeOldTags(); self.addOptions([$option]); @@ -4230,14 +4230,14 @@ var $watchers = this.$container.parents().filter(Utils.hasScroll); $watchers.each(function () { - $(this).data('select2-scroll-position', { + $(this).data( 'select2-scroll-position', { x: $(this).scrollLeft(), y: $(this).scrollTop() }); }); $watchers.on(scrollEvent, function (ev) { - var position = $(this).data('select2-scroll-position'); + var position = $(this).data( 'select2-scroll-position'); $(this).scrollTop(position.y); }); @@ -4434,7 +4434,7 @@ return; } - var data = $highlightedResults.data('data'); + var data = $highlightedResults.data( 'data'); // Don't re-select already selected resulte if ( @@ -5048,7 +5048,7 @@ $e.prop('disabled', this.options.disabled); $e.prop('multiple', this.options.multiple); - if ($e.data('select2Tags')) { + if ($e.data( 'select2Tags')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-select2-tags` attribute has been changed to ' + @@ -5057,11 +5057,11 @@ ); } - $e.data('data', $e.data('select2Tags')); - $e.data('tags', true); + $e.data( 'data', $e.data( 'select2Tags')); + $e.data( 'tags', true); } - if ($e.data('ajaxUrl')) { + if ($e.data( 'ajaxUrl')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-ajax-url` attribute has been changed to ' + @@ -5070,8 +5070,8 @@ ); } - $e.prop('ajax--url', $e.data('ajaxUrl')); - $e.data('ajax--url', $e.data('ajaxUrl')); + $e.prop('ajax--url', $e.data( 'ajaxUrl')); + $e.data( 'ajax--url', $e.data( 'ajaxUrl')); } var dataset = {}; @@ -5121,8 +5121,8 @@ './keys' ], function ($, Options, Utils, KEYS) { var Select2 = function ($element, options) { - if ($element.data('select2') != null) { - $element.data('select2').destroy(); + if ($element.data( 'select2') != null) { + $element.data( 'select2').destroy(); } this.$element = $element; @@ -5138,7 +5138,7 @@ // Set up the tabindex var tabindex = $element.prop('tabindex') || 0; - $element.data('old-tabindex', tabindex); + $element.data( 'old-tabindex', tabindex); $element.prop('tabindex', '-1'); // Set up containers and adapters @@ -5199,7 +5199,7 @@ // Synchronize any monitored attributes this._syncAttributes(); - $element.data('select2', this); + $element.data( 'select2', this); }; Utils.Extend(Select2, Utils.Observable); @@ -5688,7 +5688,7 @@ this._syncS = null; this.$element.off('.select2'); - this.$element.prop('tabindex', this.$element.data('old-tabindex')); + this.$element.prop('tabindex', this.$element.data( 'old-tabindex')); this.$element.removeClass('select2-hidden-accessible'); this.$element.prop('aria-hidden', 'false'); @@ -5719,7 +5719,7 @@ this.$container.addClass('select2-container--' + this.options.get('theme')); - $container.data('element', this.$element); + $container.data( 'element', this.$element); return $container; }; @@ -6472,7 +6472,7 @@ var args = Array.prototype.slice.call(arguments, 1); this.each(function () { - var instance = $(this).data('select2'); + var instance = $(this).data( 'select2'); if (instance == null && window.console && console.error) { console.error( @@ -6535,7 +6535,7 @@ var args = Array.prototype.slice.call(arguments, 1); this.each(function () { - var instance = $(this).data('select2'); + var instance = $(this).data( 'select2'); if (instance == null && window.console && console.error) { console.error( diff --git a/library/js/authentication.js b/library/js/authentication.js index 222f94c6..601b3fef 100644 --- a/library/js/authentication.js +++ b/library/js/authentication.js @@ -274,7 +274,7 @@ } else { this.backdropNode = document.createElement( 'div' ); this.backdropNode.className = backdropClass; - this.backdropNode.prop( 'data-markup', 'new' ); + this.backdropNode.data( 'markup', 'new' ); this.dialogNode.parentNode.insertBefore( this.backdropNode, this.dialogNodev ); this.backdropNode.appendChild( this.dialogNode ); } diff --git a/library/js/form-load.js b/library/js/form-load.js index 9f8b1322..b48a4eb1 100644 --- a/library/js/form-load.js +++ b/library/js/form-load.js @@ -30,7 +30,7 @@ function formId() { - const attrId = form.prop( 'data-id' ); + const attrId = form.data( 'id' ); const dataId = form.data( 'id' ); if ( attrId.length && '' !== attrId ) { @@ -40,7 +40,7 @@ function formDesign() { - const attrDesign = form.prop( 'data-design' ); + const attrDesign = form.data( 'design' ); const dataDesign = form.data( 'design' ); if ( attrDesign && '' !== attrDesign ) { @@ -52,7 +52,7 @@ function formGrid() { - const attrGrid = form.prop( 'data-grid' ); + const attrGrid = form.data( 'grid' ); const dataGrid = form.data( 'grid' ); // Reset diff --git a/library/js/select2.full.js b/library/js/select2.full.js index 5952c1d0..ec07ee82 100644 --- a/library/js/select2.full.js +++ b/library/js/select2.full.js @@ -783,7 +783,7 @@ '-' + Utils.generateChars(4); } - element.setAttribute('data-select2-id', select2Id); + element.data( 'select2-id', select2Id); return select2Id; }; @@ -847,7 +847,7 @@ var replacements = destinationClasses.concat(sourceClasses); - dest.setAttribute('class', replacements.join(' ')); + dest.prop('class', replacements.join(' ')); }; return Utils; @@ -873,7 +873,7 @@ ); if (this.options.get('multiple')) { - $results.attr('aria-multiselectable', 'true'); + $results.prop('aria-multiselectable', 'true'); } this.$results = $results; @@ -993,10 +993,10 @@ if ((item.element != null && item.element.selected) || (item.element == null && selectedIds.indexOf(id) > -1)) { this.classList.add('select2-results__option--selected'); - $option.attr('aria-selected', 'true'); + $option.prop('aria-selected', 'true'); } else { this.classList.remove('select2-results__option--selected'); - $option.attr('aria-selected', 'false'); + $option.prop('aria-selected', 'false'); } }); @@ -1067,7 +1067,7 @@ for (var attr in attrs) { var val = attrs[attr]; - option.setAttribute(attr, val); + option.prop(attr, val); } if (data.children) { @@ -1111,7 +1111,7 @@ var id = container.id + '-results'; - this.$results.attr('id', id); + this.$results.prop('id', id); container.on('results:all', function (params) { self.clear(); @@ -1162,8 +1162,8 @@ container.on('open', function () { // When the dropdown is open, aria-expended="true" - self.$results.attr('aria-expanded', 'true'); - self.$results.attr('aria-hidden', 'false'); + self.$results.prop('aria-expanded', 'true'); + self.$results.prop('aria-hidden', 'false'); self.setClasses(); self.ensureHighlightVisible(); @@ -1171,8 +1171,8 @@ container.on('close', function () { // When the dropdown is closed, aria-expended="false" - self.$results.attr('aria-expanded', 'false'); - self.$results.attr('aria-hidden', 'true'); + self.$results.prop('aria-expanded', 'false'); + self.$results.prop('aria-hidden', 'true'); self.$results.removeAttr('aria-activedescendant'); }); @@ -1271,7 +1271,7 @@ container.on('results:focus', function (params) { params.element[0].classList.add('select2-results__option--highlighted'); - params.element[0].setAttribute('aria-selected', 'true'); + params.element[0].prop('aria-selected', 'true'); }); container.on('results:message', function (params) { @@ -1334,7 +1334,7 @@ self.getHighlightedResults() .removeClass('select2-results__option--highlighted') - .attr('aria-selected', 'false'); + .prop('aria-selected', 'false'); self.trigger('results:focus', { data: data, @@ -1448,13 +1448,13 @@ if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); - } else if (this.$element.attr('tabindex') != null) { - this._tabindex = this.$element.attr('tabindex'); + } else if (this.$element.prop('tabindex') != null) { + this._tabindex = this.$element.prop('tabindex'); } - $selection.attr('title', this.$element.attr('title')); - $selection.attr('tabindex', this._tabindex); - $selection.attr('aria-disabled', 'false'); + $selection.prop('title', this.$element.prop('title')); + $selection.prop('tabindex', this._tabindex); + $selection.prop('aria-disabled', 'false'); this.$selection = $selection; @@ -1485,7 +1485,7 @@ }); container.on('results:focus', function (params) { - self.$selection.attr('aria-activedescendant', params.data._resultId); + self.$selection.prop('aria-activedescendant', params.data._resultId); }); container.on('selection:update', function (params) { @@ -1494,15 +1494,15 @@ container.on('open', function () { // When the dropdown is open, aria-expanded="true" - self.$selection.attr('aria-expanded', 'true'); - self.$selection.attr('aria-owns', resultsId); + self.$selection.prop('aria-expanded', 'true'); + self.$selection.prop('aria-owns', resultsId); self._attachCloseHandler(container); }); container.on('close', function () { // When the dropdown is closed, aria-expanded="false" - self.$selection.attr('aria-expanded', 'false'); + self.$selection.prop('aria-expanded', 'false'); self.$selection.removeAttr('aria-activedescendant'); self.$selection.removeAttr('aria-owns'); @@ -1512,13 +1512,13 @@ }); container.on('enable', function () { - self.$selection.attr('tabindex', self._tabindex); - self.$selection.attr('aria-disabled', 'false'); + self.$selection.prop('tabindex', self._tabindex); + self.$selection.prop('aria-disabled', 'false'); }); container.on('disable', function () { - self.$selection.attr('tabindex', '-1'); - self.$selection.attr('aria-disabled', 'true'); + self.$selection.prop('tabindex', '-1'); + self.$selection.prop('aria-disabled', 'true'); }); }; @@ -1640,11 +1640,11 @@ var id = container.id + '-container'; this.$selection.find('.select2-selection__rendered') - .attr('id', id) - .attr('role', 'textbox') - .attr('aria-readonly', 'true'); - this.$selection.attr('aria-labelledby', id); - this.$selection.attr('aria-controls', id); + .prop('id', id) + .prop('role', 'textbox') + .prop('aria-readonly', 'true'); + this.$selection.prop('aria-labelledby', id); + this.$selection.prop('aria-controls', id); this.$selection.on('mousedown', function (evt) { // Only respond to left clicks @@ -1711,7 +1711,7 @@ var title = selection.title || selection.text; if (title) { - $rendered.attr('title', title); + $rendered.prop('title', title); } else { $rendered.removeAttr('title'); } @@ -1749,7 +1749,7 @@ MultipleSelection.__super__.bind.apply(this, arguments); var id = container.id + '-container'; - this.$selection.find('.select2-selection__rendered').attr('id', id); + this.$selection.find('.select2-selection__rendered').prop('id', id); this.$selection.on('click', function (evt) { self.trigger('toggle', { @@ -1829,7 +1829,7 @@ var $selections = []; var selectionIdPrefix = this.$selection.find('.select2-selection__rendered') - .attr('id') + '-choice-'; + .prop('id') + '-choice-'; for (var d = 0; d < data.length; d++) { var selection = data[d]; @@ -1847,21 +1847,21 @@ $selection.find('.select2-selection__choice__display') .append(formatted) - .attr('id', selectionId); + .prop('id', selectionId); var title = selection.title || selection.text; if (title) { - $selection.attr('title', title); + $selection.prop('title', title); } var removeItem = this.options.get('translations').get('removeItem'); var $remove = $selection.find('.select2-selection__choice__remove'); - $remove.attr('title', removeItem()); - $remove.attr('aria-label', removeItem()); - $remove.attr('aria-describedby', selectionId); + $remove.prop('title', removeItem()); + $remove.prop('aria-label', removeItem()); + $remove.prop('aria-describedby', selectionId); Utils.StoreData($selection[0], 'data', selection); @@ -1907,7 +1907,7 @@ placeholder.text || $placeholder.text(); - this.$selection.find('.select2-selection__rendered').attr( + this.$selection.find('.select2-selection__rendered').prop( 'title', placeholderTitle ); @@ -2038,7 +2038,7 @@ } var selectionId = this.$selection.find('.select2-selection__rendered') - .attr('id'); + .prop('id'); var removeAll = this.options.get('translations').get('removeAllItems'); @@ -2047,9 +2047,9 @@ '' + '' ); - $remove.attr('title', removeAll()); - $remove.attr('aria-label', removeAll()); - $remove.attr('aria-describedby', selectionId); + $remove.prop('title', removeAll()); + $remove.prop('aria-label', removeAll()); + $remove.prop('aria-describedby', selectionId); Utils.StoreData($remove[0], 'data', data); this.$selection.prepend($remove); @@ -2084,7 +2084,7 @@ this.$search = $search.find('textarea'); this.$search.prop('autocomplete', this.options.get('autocomplete')); - this.$search.attr('aria-label', searchLabel()); + this.$search.prop('aria-label', searchLabel()); var $rendered = decorated.call(this); @@ -2102,10 +2102,10 @@ decorated.call(this, container, $container); - self.$search.attr('aria-describedby', selectionId); + self.$search.prop('aria-describedby', selectionId); container.on('open', function () { - self.$search.attr('aria-controls', resultsId); + self.$search.prop('aria-controls', resultsId); self.$search.trigger('focus'); }); @@ -2133,7 +2133,7 @@ container.on('results:focus', function (params) { if (params.data._resultId) { - self.$search.attr('aria-activedescendant', params.data._resultId); + self.$search.prop('aria-activedescendant', params.data._resultId); } else { self.$search.removeAttr('aria-activedescendant'); } @@ -2241,18 +2241,18 @@ * @private */ Search.prototype._transferTabIndex = function (decorated) { - this.$search.attr('tabindex', this.$selection.attr('tabindex')); - this.$selection.attr('tabindex', '-1'); + this.$search.prop('tabindex', this.$selection.prop('tabindex')); + this.$selection.prop('tabindex', '-1'); }; Search.prototype.createPlaceholder = function (decorated, placeholder) { - this.$search.attr('placeholder', placeholder.text); + this.$search.prop('placeholder', placeholder.text); }; Search.prototype.update = function (decorated, data) { var searchHadFocus = this.$search[0] == document.activeElement; - this.$search.attr('placeholder', ''); + this.$search.prop('placeholder', ''); decorated.call(this, data); @@ -2290,7 +2290,7 @@ var width = '100%'; - if (this.$search.attr('placeholder') === '') { + if (this.$search.prop('placeholder') === '') { var minimumWidth = this.$search.val().length + 1; width = (minimumWidth * 0.75) + 'em'; @@ -3871,7 +3871,7 @@ if (tag != null) { var $option = self.option(tag); - $option.attr('data-select2-tag', 'true'); + $option.data( 'select2-tag', 'true'); self.addOptions([$option]); @@ -3958,7 +3958,7 @@ // If an existing option wasn't found for it, create the option if (!$existingOptions.length) { var $option = self.option(item); - $option.attr('data-select2-tag', true); + $option.data( 'select2-tag', true); self._removeOldTags(); self.addOptions([$option]); @@ -4178,7 +4178,7 @@ '' ); - $dropdown.attr('dir', this.options.get('dir')); + $dropdown.prop('dir', this.options.get('dir')); this.$dropdown = $dropdown; @@ -4222,7 +4222,7 @@ this.$search = $search.find('input'); this.$search.prop('autocomplete', this.options.get('autocomplete')); - this.$search.attr('aria-label', searchLabel()); + this.$search.prop('aria-label', searchLabel()); $rendered.prepend($search); @@ -4255,8 +4255,8 @@ }); container.on('open', function () { - self.$search.attr('tabindex', 0); - self.$search.attr('aria-controls', resultsId); + self.$search.prop('tabindex', 0); + self.$search.prop('aria-controls', resultsId); self.$search.trigger('focus'); @@ -4266,7 +4266,7 @@ }); container.on('close', function () { - self.$search.attr('tabindex', -1); + self.$search.prop('tabindex', -1); self.$search.removeAttr('aria-controls'); self.$search.removeAttr('aria-activedescendant'); @@ -4294,7 +4294,7 @@ container.on('results:focus', function (params) { if (params.data._resultId) { - self.$search.attr('aria-activedescendant', params.data._resultId); + self.$search.prop('aria-activedescendant', params.data._resultId); } else { self.$search.removeAttr('aria-activedescendant'); } @@ -4497,7 +4497,7 @@ AttachBody.prototype.position = function (decorated, $dropdown, $container) { // Clone all of the container classes - $dropdown.attr('class', $container.attr('class')); + $dropdown.prop('class', $container.prop('class')); // Custom FUIselect2 dropdown. @edited $dropdown.removeClass('select2'); @@ -5468,7 +5468,7 @@ ); } - $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); + $e.prop('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); } @@ -5479,8 +5479,8 @@ } // Pre-load all of the attributes which are prefixed with `data-` - for (var attr = 0; attr < $e[0].attributes.length; attr++) { - var attributeName = $e[0].attributes[attr].name; + for (var attr = 0; attr < $e[0].propibutes.length; attr++) { + var attributeName = $e[0].propibutes[attr].name; var prefix = 'data-'; if (attributeName.substr(0, prefix.length) == prefix) { @@ -5559,9 +5559,9 @@ // Set up the tabindex - var tabindex = $element.attr('tabindex') || 0; + var tabindex = $element.prop('tabindex') || 0; Utils.StoreData($element[0], 'old-tabindex', tabindex); - $element.attr('tabindex', '-1'); + $element.prop('tabindex', '-1'); // Set up containers and adapters @@ -5616,7 +5616,7 @@ // Hide the original select $element[0].classList.add('select2-hidden-accessible'); - $element.attr('aria-hidden', 'true'); + $element.prop('aria-hidden', 'true'); // Hide the original select with FUI. @edited $element.addClass( 'forminator-screen-reader-only' ); @@ -5626,8 +5626,8 @@ Utils.StoreData($element[0], 'select2', this); - // Ensure backwards compatibility with $element.data('select2'). - $element.data('select2', this); + // Ensure backwards compatibility with $element.data( 'select2'). + $element.data( 'select2', this); }; Utils.Extend(Select2, Utils.Observable); @@ -5635,10 +5635,10 @@ Select2.prototype._generateId = function ($element) { var id = ''; - if ($element.attr('id') != null) { - id = $element.attr('id'); - } else if ($element.attr('name') != null) { - id = $element.attr('name') + '-' + Utils.generateChars(2); + if ($element.prop('id') != null) { + id = $element.prop('id'); + } else if ($element.prop('name') != null) { + id = $element.prop('name') + '-' + Utils.generateChars(2); } else { id = Utils.generateChars(4); } @@ -5683,7 +5683,7 @@ } if (method == 'style') { - var style = $element.attr('style'); + var style = $element.prop('style'); if (typeof(style) !== 'string') { return null; @@ -6104,14 +6104,14 @@ this._syncS = null; this.$element.off('.select2'); - this.$element.attr('tabindex', + this.$element.prop('tabindex', Utils.GetData(this.$element[0], 'old-tabindex')); // Remove FUI screen reader class. @edited this.$element.removeClass( 'forminator-screen-reader-only' ); this.$element[0].classList.remove('select2-hidden-accessible'); - this.$element.attr('aria-hidden', 'false'); + this.$element.prop('aria-hidden', 'false'); Utils.RemoveData(this.$element[0]); this.$element.removeData('select2'); @@ -6134,7 +6134,7 @@ '' ); - $container.attr('dir', this.options.get('dir')); + $container.prop('dir', this.options.get('dir')); this.$container = $container; diff --git a/library/js/select2.js b/library/js/select2.js index 78a86c44..8345c64c 100644 --- a/library/js/select2.js +++ b/library/js/select2.js @@ -58,7 +58,7 @@ $language = 'en'; } - if ( 'true' === $select.prop( 'data-search' ) ) { + if ( 'true' === $select.data( 'search' ) ) { $hasSearch = 0; } From 85a9f8ef7e9ace81f61b71d5eae79fc21a353e62 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Thu, 24 Feb 2022 11:03:47 +0530 Subject: [PATCH 2/4] update select2 --- library/js/select2.full.js | 156 ++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/library/js/select2.full.js b/library/js/select2.full.js index ec07ee82..5952c1d0 100644 --- a/library/js/select2.full.js +++ b/library/js/select2.full.js @@ -783,7 +783,7 @@ '-' + Utils.generateChars(4); } - element.data( 'select2-id', select2Id); + element.setAttribute('data-select2-id', select2Id); return select2Id; }; @@ -847,7 +847,7 @@ var replacements = destinationClasses.concat(sourceClasses); - dest.prop('class', replacements.join(' ')); + dest.setAttribute('class', replacements.join(' ')); }; return Utils; @@ -873,7 +873,7 @@ ); if (this.options.get('multiple')) { - $results.prop('aria-multiselectable', 'true'); + $results.attr('aria-multiselectable', 'true'); } this.$results = $results; @@ -993,10 +993,10 @@ if ((item.element != null && item.element.selected) || (item.element == null && selectedIds.indexOf(id) > -1)) { this.classList.add('select2-results__option--selected'); - $option.prop('aria-selected', 'true'); + $option.attr('aria-selected', 'true'); } else { this.classList.remove('select2-results__option--selected'); - $option.prop('aria-selected', 'false'); + $option.attr('aria-selected', 'false'); } }); @@ -1067,7 +1067,7 @@ for (var attr in attrs) { var val = attrs[attr]; - option.prop(attr, val); + option.setAttribute(attr, val); } if (data.children) { @@ -1111,7 +1111,7 @@ var id = container.id + '-results'; - this.$results.prop('id', id); + this.$results.attr('id', id); container.on('results:all', function (params) { self.clear(); @@ -1162,8 +1162,8 @@ container.on('open', function () { // When the dropdown is open, aria-expended="true" - self.$results.prop('aria-expanded', 'true'); - self.$results.prop('aria-hidden', 'false'); + self.$results.attr('aria-expanded', 'true'); + self.$results.attr('aria-hidden', 'false'); self.setClasses(); self.ensureHighlightVisible(); @@ -1171,8 +1171,8 @@ container.on('close', function () { // When the dropdown is closed, aria-expended="false" - self.$results.prop('aria-expanded', 'false'); - self.$results.prop('aria-hidden', 'true'); + self.$results.attr('aria-expanded', 'false'); + self.$results.attr('aria-hidden', 'true'); self.$results.removeAttr('aria-activedescendant'); }); @@ -1271,7 +1271,7 @@ container.on('results:focus', function (params) { params.element[0].classList.add('select2-results__option--highlighted'); - params.element[0].prop('aria-selected', 'true'); + params.element[0].setAttribute('aria-selected', 'true'); }); container.on('results:message', function (params) { @@ -1334,7 +1334,7 @@ self.getHighlightedResults() .removeClass('select2-results__option--highlighted') - .prop('aria-selected', 'false'); + .attr('aria-selected', 'false'); self.trigger('results:focus', { data: data, @@ -1448,13 +1448,13 @@ if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); - } else if (this.$element.prop('tabindex') != null) { - this._tabindex = this.$element.prop('tabindex'); + } else if (this.$element.attr('tabindex') != null) { + this._tabindex = this.$element.attr('tabindex'); } - $selection.prop('title', this.$element.prop('title')); - $selection.prop('tabindex', this._tabindex); - $selection.prop('aria-disabled', 'false'); + $selection.attr('title', this.$element.attr('title')); + $selection.attr('tabindex', this._tabindex); + $selection.attr('aria-disabled', 'false'); this.$selection = $selection; @@ -1485,7 +1485,7 @@ }); container.on('results:focus', function (params) { - self.$selection.prop('aria-activedescendant', params.data._resultId); + self.$selection.attr('aria-activedescendant', params.data._resultId); }); container.on('selection:update', function (params) { @@ -1494,15 +1494,15 @@ container.on('open', function () { // When the dropdown is open, aria-expanded="true" - self.$selection.prop('aria-expanded', 'true'); - self.$selection.prop('aria-owns', resultsId); + self.$selection.attr('aria-expanded', 'true'); + self.$selection.attr('aria-owns', resultsId); self._attachCloseHandler(container); }); container.on('close', function () { // When the dropdown is closed, aria-expanded="false" - self.$selection.prop('aria-expanded', 'false'); + self.$selection.attr('aria-expanded', 'false'); self.$selection.removeAttr('aria-activedescendant'); self.$selection.removeAttr('aria-owns'); @@ -1512,13 +1512,13 @@ }); container.on('enable', function () { - self.$selection.prop('tabindex', self._tabindex); - self.$selection.prop('aria-disabled', 'false'); + self.$selection.attr('tabindex', self._tabindex); + self.$selection.attr('aria-disabled', 'false'); }); container.on('disable', function () { - self.$selection.prop('tabindex', '-1'); - self.$selection.prop('aria-disabled', 'true'); + self.$selection.attr('tabindex', '-1'); + self.$selection.attr('aria-disabled', 'true'); }); }; @@ -1640,11 +1640,11 @@ var id = container.id + '-container'; this.$selection.find('.select2-selection__rendered') - .prop('id', id) - .prop('role', 'textbox') - .prop('aria-readonly', 'true'); - this.$selection.prop('aria-labelledby', id); - this.$selection.prop('aria-controls', id); + .attr('id', id) + .attr('role', 'textbox') + .attr('aria-readonly', 'true'); + this.$selection.attr('aria-labelledby', id); + this.$selection.attr('aria-controls', id); this.$selection.on('mousedown', function (evt) { // Only respond to left clicks @@ -1711,7 +1711,7 @@ var title = selection.title || selection.text; if (title) { - $rendered.prop('title', title); + $rendered.attr('title', title); } else { $rendered.removeAttr('title'); } @@ -1749,7 +1749,7 @@ MultipleSelection.__super__.bind.apply(this, arguments); var id = container.id + '-container'; - this.$selection.find('.select2-selection__rendered').prop('id', id); + this.$selection.find('.select2-selection__rendered').attr('id', id); this.$selection.on('click', function (evt) { self.trigger('toggle', { @@ -1829,7 +1829,7 @@ var $selections = []; var selectionIdPrefix = this.$selection.find('.select2-selection__rendered') - .prop('id') + '-choice-'; + .attr('id') + '-choice-'; for (var d = 0; d < data.length; d++) { var selection = data[d]; @@ -1847,21 +1847,21 @@ $selection.find('.select2-selection__choice__display') .append(formatted) - .prop('id', selectionId); + .attr('id', selectionId); var title = selection.title || selection.text; if (title) { - $selection.prop('title', title); + $selection.attr('title', title); } var removeItem = this.options.get('translations').get('removeItem'); var $remove = $selection.find('.select2-selection__choice__remove'); - $remove.prop('title', removeItem()); - $remove.prop('aria-label', removeItem()); - $remove.prop('aria-describedby', selectionId); + $remove.attr('title', removeItem()); + $remove.attr('aria-label', removeItem()); + $remove.attr('aria-describedby', selectionId); Utils.StoreData($selection[0], 'data', selection); @@ -1907,7 +1907,7 @@ placeholder.text || $placeholder.text(); - this.$selection.find('.select2-selection__rendered').prop( + this.$selection.find('.select2-selection__rendered').attr( 'title', placeholderTitle ); @@ -2038,7 +2038,7 @@ } var selectionId = this.$selection.find('.select2-selection__rendered') - .prop('id'); + .attr('id'); var removeAll = this.options.get('translations').get('removeAllItems'); @@ -2047,9 +2047,9 @@ '' + '' ); - $remove.prop('title', removeAll()); - $remove.prop('aria-label', removeAll()); - $remove.prop('aria-describedby', selectionId); + $remove.attr('title', removeAll()); + $remove.attr('aria-label', removeAll()); + $remove.attr('aria-describedby', selectionId); Utils.StoreData($remove[0], 'data', data); this.$selection.prepend($remove); @@ -2084,7 +2084,7 @@ this.$search = $search.find('textarea'); this.$search.prop('autocomplete', this.options.get('autocomplete')); - this.$search.prop('aria-label', searchLabel()); + this.$search.attr('aria-label', searchLabel()); var $rendered = decorated.call(this); @@ -2102,10 +2102,10 @@ decorated.call(this, container, $container); - self.$search.prop('aria-describedby', selectionId); + self.$search.attr('aria-describedby', selectionId); container.on('open', function () { - self.$search.prop('aria-controls', resultsId); + self.$search.attr('aria-controls', resultsId); self.$search.trigger('focus'); }); @@ -2133,7 +2133,7 @@ container.on('results:focus', function (params) { if (params.data._resultId) { - self.$search.prop('aria-activedescendant', params.data._resultId); + self.$search.attr('aria-activedescendant', params.data._resultId); } else { self.$search.removeAttr('aria-activedescendant'); } @@ -2241,18 +2241,18 @@ * @private */ Search.prototype._transferTabIndex = function (decorated) { - this.$search.prop('tabindex', this.$selection.prop('tabindex')); - this.$selection.prop('tabindex', '-1'); + this.$search.attr('tabindex', this.$selection.attr('tabindex')); + this.$selection.attr('tabindex', '-1'); }; Search.prototype.createPlaceholder = function (decorated, placeholder) { - this.$search.prop('placeholder', placeholder.text); + this.$search.attr('placeholder', placeholder.text); }; Search.prototype.update = function (decorated, data) { var searchHadFocus = this.$search[0] == document.activeElement; - this.$search.prop('placeholder', ''); + this.$search.attr('placeholder', ''); decorated.call(this, data); @@ -2290,7 +2290,7 @@ var width = '100%'; - if (this.$search.prop('placeholder') === '') { + if (this.$search.attr('placeholder') === '') { var minimumWidth = this.$search.val().length + 1; width = (minimumWidth * 0.75) + 'em'; @@ -3871,7 +3871,7 @@ if (tag != null) { var $option = self.option(tag); - $option.data( 'select2-tag', 'true'); + $option.attr('data-select2-tag', 'true'); self.addOptions([$option]); @@ -3958,7 +3958,7 @@ // If an existing option wasn't found for it, create the option if (!$existingOptions.length) { var $option = self.option(item); - $option.data( 'select2-tag', true); + $option.attr('data-select2-tag', true); self._removeOldTags(); self.addOptions([$option]); @@ -4178,7 +4178,7 @@ '' ); - $dropdown.prop('dir', this.options.get('dir')); + $dropdown.attr('dir', this.options.get('dir')); this.$dropdown = $dropdown; @@ -4222,7 +4222,7 @@ this.$search = $search.find('input'); this.$search.prop('autocomplete', this.options.get('autocomplete')); - this.$search.prop('aria-label', searchLabel()); + this.$search.attr('aria-label', searchLabel()); $rendered.prepend($search); @@ -4255,8 +4255,8 @@ }); container.on('open', function () { - self.$search.prop('tabindex', 0); - self.$search.prop('aria-controls', resultsId); + self.$search.attr('tabindex', 0); + self.$search.attr('aria-controls', resultsId); self.$search.trigger('focus'); @@ -4266,7 +4266,7 @@ }); container.on('close', function () { - self.$search.prop('tabindex', -1); + self.$search.attr('tabindex', -1); self.$search.removeAttr('aria-controls'); self.$search.removeAttr('aria-activedescendant'); @@ -4294,7 +4294,7 @@ container.on('results:focus', function (params) { if (params.data._resultId) { - self.$search.prop('aria-activedescendant', params.data._resultId); + self.$search.attr('aria-activedescendant', params.data._resultId); } else { self.$search.removeAttr('aria-activedescendant'); } @@ -4497,7 +4497,7 @@ AttachBody.prototype.position = function (decorated, $dropdown, $container) { // Clone all of the container classes - $dropdown.prop('class', $container.prop('class')); + $dropdown.attr('class', $container.attr('class')); // Custom FUIselect2 dropdown. @edited $dropdown.removeClass('select2'); @@ -5468,7 +5468,7 @@ ); } - $e.prop('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); + $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); } @@ -5479,8 +5479,8 @@ } // Pre-load all of the attributes which are prefixed with `data-` - for (var attr = 0; attr < $e[0].propibutes.length; attr++) { - var attributeName = $e[0].propibutes[attr].name; + for (var attr = 0; attr < $e[0].attributes.length; attr++) { + var attributeName = $e[0].attributes[attr].name; var prefix = 'data-'; if (attributeName.substr(0, prefix.length) == prefix) { @@ -5559,9 +5559,9 @@ // Set up the tabindex - var tabindex = $element.prop('tabindex') || 0; + var tabindex = $element.attr('tabindex') || 0; Utils.StoreData($element[0], 'old-tabindex', tabindex); - $element.prop('tabindex', '-1'); + $element.attr('tabindex', '-1'); // Set up containers and adapters @@ -5616,7 +5616,7 @@ // Hide the original select $element[0].classList.add('select2-hidden-accessible'); - $element.prop('aria-hidden', 'true'); + $element.attr('aria-hidden', 'true'); // Hide the original select with FUI. @edited $element.addClass( 'forminator-screen-reader-only' ); @@ -5626,8 +5626,8 @@ Utils.StoreData($element[0], 'select2', this); - // Ensure backwards compatibility with $element.data( 'select2'). - $element.data( 'select2', this); + // Ensure backwards compatibility with $element.data('select2'). + $element.data('select2', this); }; Utils.Extend(Select2, Utils.Observable); @@ -5635,10 +5635,10 @@ Select2.prototype._generateId = function ($element) { var id = ''; - if ($element.prop('id') != null) { - id = $element.prop('id'); - } else if ($element.prop('name') != null) { - id = $element.prop('name') + '-' + Utils.generateChars(2); + if ($element.attr('id') != null) { + id = $element.attr('id'); + } else if ($element.attr('name') != null) { + id = $element.attr('name') + '-' + Utils.generateChars(2); } else { id = Utils.generateChars(4); } @@ -5683,7 +5683,7 @@ } if (method == 'style') { - var style = $element.prop('style'); + var style = $element.attr('style'); if (typeof(style) !== 'string') { return null; @@ -6104,14 +6104,14 @@ this._syncS = null; this.$element.off('.select2'); - this.$element.prop('tabindex', + this.$element.attr('tabindex', Utils.GetData(this.$element[0], 'old-tabindex')); // Remove FUI screen reader class. @edited this.$element.removeClass( 'forminator-screen-reader-only' ); this.$element[0].classList.remove('select2-hidden-accessible'); - this.$element.prop('aria-hidden', 'false'); + this.$element.attr('aria-hidden', 'false'); Utils.RemoveData(this.$element[0]); this.$element.removeData('select2'); @@ -6134,7 +6134,7 @@ '' ); - $container.prop('dir', this.options.get('dir')); + $container.attr('dir', this.options.get('dir')); this.$container = $container; From 85ab0a23062288006b230146a5b303fe4b94ce84 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Thu, 24 Feb 2022 19:59:00 +0530 Subject: [PATCH 3/4] fix --- assets/js/select2.full.js | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/assets/js/select2.full.js b/assets/js/select2.full.js index 6f58202a..ca79ae6f 100644 --- a/assets/js/select2.full.js +++ b/assets/js/select2.full.js @@ -1102,7 +1102,7 @@ return; } - var data = $highlighted.data( 'data'); + var data = $highlighted.data('data'); if ($highlighted.prop('aria-selected') == 'true') { self.trigger('close', {}); @@ -1214,7 +1214,7 @@ function (evt) { var $this = $(this); - var data = $this.data( 'data'); + var data = $this.data('data'); if ($this.prop('aria-selected') === 'true') { if (self.options.get('multiple')) { @@ -1237,7 +1237,7 @@ this.$results.on('mouseenter', '.select2-results__option[aria-selected]', function (evt) { - var data = $(this).data( 'data'); + var data = $(this).data('data'); self.getHighlightedResults() .removeClass('select2-results__option--highlighted'); @@ -1352,8 +1352,8 @@ this._tabindex = 0; - if (this.$element.data( 'old-tabindex') != null) { - this._tabindex = this.$element.data( 'old-tabindex'); + if (this.$element.data('old-tabindex') != null) { + this._tabindex = this.$element.data('old-tabindex'); } else if (this.$element.prop('tabindex') != null) { this._tabindex = this.$element.prop('tabindex'); } @@ -1461,7 +1461,7 @@ return; } - var $element = $this.data( 'element'); + var $element = $this.data('element'); // FUI-SELECT2 renamed function to FUIselect2 $element.FUIselect2('close'); @@ -1636,7 +1636,7 @@ var $remove = $(this); var $selection = $remove.parent(); - var data = $selection.data( 'data'); + var data = $selection.data('data'); self.trigger('unselect', { originalEvent: evt, @@ -1687,7 +1687,7 @@ $selection.append(formatted); $selection.prop('title', selection.title || selection.text); - $selection.data( 'data', selection); + $selection.data('data', selection); $selections.push($selection); } @@ -1795,7 +1795,7 @@ evt.stopPropagation(); - var data = $clear.data( 'data'); + var data = $clear.data('data'); for (var d = 0; d < data.length; d++) { var unselectData = { @@ -1840,7 +1840,7 @@ '×' + '' ); - $remove.data( 'data', data); + $remove.data('data', data); this.$selection.find('.select2-selection__rendered').prepend($remove); }; @@ -1931,7 +1931,7 @@ .prev('.select2-selection__choice'); if ($previousChoice.length > 0) { - var item = $previousChoice.data( 'data'); + var item = $previousChoice.data('data'); self.searchRemoveChoice(item); @@ -3599,7 +3599,7 @@ if (tag != null) { var $option = self.option(tag); - $option.data( 'select2-tag', true); + $option.prop('data-select2-tag', true); self.addOptions([$option]); @@ -3684,7 +3684,7 @@ // If an existing option wasn't found for it, create the option if (!$existingOptions.length) { var $option = self.option(item); - $option.data( 'select2-tag', true); + $option.prop('data-select2-tag', true); self._removeOldTags(); self.addOptions([$option]); @@ -4230,14 +4230,14 @@ var $watchers = this.$container.parents().filter(Utils.hasScroll); $watchers.each(function () { - $(this).data( 'select2-scroll-position', { + $(this).data('select2-scroll-position', { x: $(this).scrollLeft(), y: $(this).scrollTop() }); }); $watchers.on(scrollEvent, function (ev) { - var position = $(this).data( 'select2-scroll-position'); + var position = $(this).data('select2-scroll-position'); $(this).scrollTop(position.y); }); @@ -4434,7 +4434,7 @@ return; } - var data = $highlightedResults.data( 'data'); + var data = $highlightedResults.data('data'); // Don't re-select already selected resulte if ( @@ -5048,7 +5048,7 @@ $e.prop('disabled', this.options.disabled); $e.prop('multiple', this.options.multiple); - if ($e.data( 'select2Tags')) { + if ($e.data('select2Tags')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-select2-tags` attribute has been changed to ' + @@ -5057,11 +5057,11 @@ ); } - $e.data( 'data', $e.data( 'select2Tags')); - $e.data( 'tags', true); + $e.data('data', $e.data('select2Tags')); + $e.data('tags', true); } - if ($e.data( 'ajaxUrl')) { + if ($e.data('ajaxUrl')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-ajax-url` attribute has been changed to ' + @@ -5070,8 +5070,8 @@ ); } - $e.prop('ajax--url', $e.data( 'ajaxUrl')); - $e.data( 'ajax--url', $e.data( 'ajaxUrl')); + $e.prop('ajax--url', $e.data('ajaxUrl')); + $e.data('ajax--url', $e.data('ajaxUrl')); } var dataset = {}; @@ -5121,8 +5121,8 @@ './keys' ], function ($, Options, Utils, KEYS) { var Select2 = function ($element, options) { - if ($element.data( 'select2') != null) { - $element.data( 'select2').destroy(); + if ($element.data('select2') != null) { + $element.data('select2').destroy(); } this.$element = $element; @@ -5138,7 +5138,7 @@ // Set up the tabindex var tabindex = $element.prop('tabindex') || 0; - $element.data( 'old-tabindex', tabindex); + $element.data('old-tabindex', tabindex); $element.prop('tabindex', '-1'); // Set up containers and adapters @@ -5199,7 +5199,7 @@ // Synchronize any monitored attributes this._syncAttributes(); - $element.data( 'select2', this); + $element.data('select2', this); }; Utils.Extend(Select2, Utils.Observable); @@ -5688,7 +5688,7 @@ this._syncS = null; this.$element.off('.select2'); - this.$element.prop('tabindex', this.$element.data( 'old-tabindex')); + this.$element.prop('tabindex', this.$element.data('old-tabindex')); this.$element.removeClass('select2-hidden-accessible'); this.$element.prop('aria-hidden', 'false'); @@ -5719,7 +5719,7 @@ this.$container.addClass('select2-container--' + this.options.get('theme')); - $container.data( 'element', this.$element); + $container.data('element', this.$element); return $container; }; @@ -6472,7 +6472,7 @@ var args = Array.prototype.slice.call(arguments, 1); this.each(function () { - var instance = $(this).data( 'select2'); + var instance = $(this).data('select2'); if (instance == null && window.console && console.error) { console.error( @@ -6535,7 +6535,7 @@ var args = Array.prototype.slice.call(arguments, 1); this.each(function () { - var instance = $(this).data( 'select2'); + var instance = $(this).data('select2'); if (instance == null && window.console && console.error) { console.error( From 2ff8d58f0e4aee1830bc76c74f01e69f46749a81 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Fri, 25 Feb 2022 13:24:01 +0530 Subject: [PATCH 4/4] fixed aria set attribute --- assets/js/public/code-snippet.js | 2 +- assets/js/public/form-field-required.js | 16 ++++++------ assets/js/public/form-field-unique.js | 8 +++--- assets/js/public/page-accessibility.js | 8 +++--- assets/js/public/page-polls.js | 12 ++++----- assets/js/select2.full.js | 34 ++++++++++++------------- library/js/form-load.js | 2 +- library/js/form-simulation.js | 2 +- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/assets/js/public/code-snippet.js b/assets/js/public/code-snippet.js index 16064ab3..c33a31e7 100644 --- a/assets/js/public/code-snippet.js +++ b/assets/js/public/code-snippet.js @@ -75,7 +75,7 @@ showTooltip: function( e, msg ) { $( e ).addClass( 'sui-tooltip' ); - $( e ).prop( 'aria-label', msg ); + $( e ).attr( 'aria-label', msg ); $( e ).data( 'tooltip', msg ); }, diff --git a/assets/js/public/form-field-required.js b/assets/js/public/form-field-required.js index 92868779..3ce87ed9 100644 --- a/assets/js/public/form-field-required.js +++ b/assets/js/public/form-field-required.js @@ -27,7 +27,7 @@ const label = field.find( '.forminator-label' ); const text = label.text(); - $( this ).prop( 'aria-required', 'true' ); + $( this ).attr( 'aria-required', 'true' ); if ( label.length ) { label.html( text + ' ' + required ); @@ -49,7 +49,7 @@ const label = field.find( '.forminator-label' ); const text = label.text(); - $( this ).prop( 'aria-required', 'true' ); + $( this ).attr( 'aria-required', 'true' ); if ( label.length ) { label.html( text + ' ' + required ); @@ -69,13 +69,13 @@ const text = label.text(); radio.each( function() { - $( this ).find( 'input' ).prop( 'aria-required', 'true' ); + $( this ).find( 'input' ).attr( 'aria-required', 'true' ); }); if ( radio.length ) { field.addClass( 'forminator-is_required' ); - field.prop( 'aria-required', 'true' ); + field.attr( 'aria-required', 'true' ); if ( label.length ) { label.html( text + ' ' + required ); @@ -92,13 +92,13 @@ const text = label.text(); checkbox.each( function() { - $( this ).find( 'input' ).prop( 'aria-required', 'true' ); + $( this ).find( 'input' ).attr( 'aria-required', 'true' ); }); if ( checkbox.length ) { field.addClass( 'forminator-is_required' ); - field.prop( 'aria-required', 'true' ); + field.attr( 'aria-required', 'true' ); if ( label.length ) { label.html( text + ' ' + required ); @@ -118,11 +118,11 @@ if ( mutliselect.length ) { checkbox.each( function() { - $( this ).find( 'input' ).prop( 'aria-required', 'true' ); + $( this ).find( 'input' ).attr( 'aria-required', 'true' ); }); field.addClass( 'forminator-is_required' ); - field.prop( 'aria-required', 'true' ); + field.attr( 'aria-required', 'true' ); if ( label.length ) { label.html( text + ' ' + required ); diff --git a/assets/js/public/form-field-unique.js b/assets/js/public/form-field-unique.js index 1ff8b6ab..6726b4c0 100644 --- a/assets/js/public/form-field-unique.js +++ b/assets/js/public/form-field-unique.js @@ -39,7 +39,7 @@ } if ( dscrp.length ) { - dscrp.prop( 'aria-describedby', getUniqueId ); + dscrp.attr( 'aria-describedby', getUniqueId ); } }); } @@ -66,7 +66,7 @@ } if ( dscrp.length ) { - dscrp.prop( 'aria-describedby', getUniqueId ); + dscrp.attr( 'aria-describedby', getUniqueId ); } }); } @@ -141,7 +141,7 @@ } if ( dscrp.length ) { - dscrp.prop( 'aria-describedby', idUnique ); + dscrp.attr( 'aria-describedby', idUnique ); } }); } @@ -170,7 +170,7 @@ } if ( dscrp.length ) { - dscrp.prop( 'aria-describedby', idUnique ); + dscrp.attr( 'aria-describedby', idUnique ); } }); } diff --git a/assets/js/public/page-accessibility.js b/assets/js/public/page-accessibility.js index 65bdc2a8..e9ab62e6 100644 --- a/assets/js/public/page-accessibility.js +++ b/assets/js/public/page-accessibility.js @@ -17,7 +17,7 @@ if ( true === column.data( 'conditional' ) ) { row.hide(); - row.prop( 'aria-hidden', 'true' ); + row.attr( 'aria-hidden', 'true' ); checkbox.on( 'click', function() { @@ -26,7 +26,7 @@ row.removeAttr( 'aria-hidden' ); } else { row.hide(); - row.prop( 'aria-hidden' ); + row.attr( 'aria-hidden' ); } }); } @@ -61,7 +61,7 @@ if ( content.find( '> li' ).length === nextPage.data( 'step' ) ) { $( this ).prop( 'disabled', true ); - $( this ).prop( 'aria-hidden', true ); + $( this ).attr( 'aria-hidden', true ); } e.preventDefault(); @@ -87,7 +87,7 @@ if ( 1 === prevPage.data( 'step' ) ) { $( this ).prop( 'disabled', true ); - $( this ).prop( 'aria-hidden', true ); + $( this ).attr( 'aria-hidden', true ); } e.preventDefault(); diff --git a/assets/js/public/page-polls.js b/assets/js/public/page-polls.js index 5fcd4bdb..4c039660 100644 --- a/assets/js/public/page-polls.js +++ b/assets/js/public/page-polls.js @@ -40,7 +40,7 @@ // Hide response for screen readers response.removeAttr( 'tabindex' ); - response.prop( 'aria-hidden', 'true' ); + response.attr( 'aria-hidden', 'true' ); } @@ -171,7 +171,7 @@ // Hide poll form field.hide(); - field.prop( 'aria-hidden', 'true' ); + field.attr( 'aria-hidden', 'true' ); if ( wrapper.length ) { @@ -205,7 +205,7 @@ // Hide "view results" link link.hide(); - link.prop( 'aria-hidden', 'true' ); + link.attr( 'aria-hidden', 'true' ); e.preventDefault(); @@ -229,17 +229,17 @@ // Hide chart wrapper.removeClass( 'forminator-show' ); wrapper.removeAttr( 'tabindex' ); - wrapper.prop( 'aria-hidden', 'true' ); + wrapper.attr( 'aria-hidden', 'true' ); chart.removeClass( 'forminator-show' ); - chart.prop( 'aria-hidden', 'true' ); + chart.attr( 'aria-hidden', 'true' ); } else { // Hide chart chart.removeClass( 'forminator-show' ); chart.removeAttr( 'tabindex' ); - chart.prop( 'aria-hidden', 'true' ); + chart.attr( 'aria-hidden', 'true' ); } diff --git a/assets/js/select2.full.js b/assets/js/select2.full.js index ca79ae6f..d3a70c33 100644 --- a/assets/js/select2.full.js +++ b/assets/js/select2.full.js @@ -799,7 +799,7 @@ ); if (this.options.get('multiple')) { - $results.prop('aria-multiselectable', 'true'); + $results.attr('aria-multiselectable', 'true'); } this.$results = $results; @@ -918,9 +918,9 @@ if ((item.element != null && item.element.selected) || (item.element == null && $.inArray(id, selectedIds) > -1)) { - $option.prop('aria-selected', 'true'); + $option.attr('aria-selected', 'true'); } else { - $option.prop('aria-selected', 'false'); + $option.attr('aria-selected', 'false'); } }); @@ -1071,8 +1071,8 @@ container.on('open', function () { // When the dropdown is open, aria-expended="true" - self.$results.prop('aria-expanded', 'true'); - self.$results.prop('aria-hidden', 'false'); + self.$results.attr('aria-expanded', 'true'); + self.$results.attr('aria-hidden', 'false'); self.setClasses(); self.ensureHighlightVisible(); @@ -1080,8 +1080,8 @@ container.on('close', function () { // When the dropdown is closed, aria-expended="false" - self.$results.prop('aria-expanded', 'false'); - self.$results.prop('aria-hidden', 'true'); + self.$results.attr('aria-expanded', 'false'); + self.$results.attr('aria-hidden', 'true'); self.$results.removeAttr('aria-activedescendant'); }); @@ -1104,7 +1104,7 @@ var data = $highlighted.data('data'); - if ($highlighted.prop('aria-selected') == 'true') { + if ($highlighted.attr('aria-selected') == 'true') { self.trigger('close', {}); } else { self.trigger('select', { @@ -1216,7 +1216,7 @@ var data = $this.data('data'); - if ($this.prop('aria-selected') === 'true') { + if ($this.attr('aria-selected') === 'true') { if (self.options.get('multiple')) { self.trigger('unselect', { originalEvent: evt, @@ -1391,7 +1391,7 @@ }); container.on('results:focus', function (params) { - self.$selection.prop('aria-activedescendant', params.data._resultId); + self.$selection.attr('aria-activedescendant', params.data._resultId); }); container.on('selection:update', function (params) { @@ -1400,15 +1400,15 @@ container.on('open', function () { // When the dropdown is open, aria-expanded="true" - self.$selection.prop('aria-expanded', 'true'); - self.$selection.prop('aria-owns', resultsId); + self.$selection.attr('aria-expanded', 'true'); + self.$selection.attr('aria-owns', resultsId); self._attachCloseHandler(container); }); container.on('close', function () { // When the dropdown is closed, aria-expanded="false" - self.$selection.prop('aria-expanded', 'false'); + self.$selection.attr('aria-expanded', 'false'); self.$selection.removeAttr('aria-activedescendant'); self.$selection.removeAttr('aria-owns'); @@ -1525,7 +1525,7 @@ var id = container.id + '-container'; this.$selection.find('.select2-selection__rendered').prop('id', id); - this.$selection.prop('aria-labelledby', id); + this.$selection.attr('aria-labelledby', id); this.$selection.on('mousedown', function (evt) { // Only respond to left clicks @@ -1906,7 +1906,7 @@ }); container.on('results:focus', function (params) { - self.$search.prop('aria-activedescendant', params.id); + self.$search.attr('aria-activedescendant', params.id); }); this.$selection.on('focusin', '.select2-search--inline', function (evt) { @@ -5194,7 +5194,7 @@ // Hide the original select $element.addClass('select2-hidden-accessible'); - $element.prop('aria-hidden', 'true'); + $element.attr('aria-hidden', 'true'); // Synchronize any monitored attributes this._syncAttributes(); @@ -5691,7 +5691,7 @@ this.$element.prop('tabindex', this.$element.data('old-tabindex')); this.$element.removeClass('select2-hidden-accessible'); - this.$element.prop('aria-hidden', 'false'); + this.$element.attr('aria-hidden', 'false'); this.$element.removeData('select2'); this.dataAdapter.destroy(); diff --git a/library/js/form-load.js b/library/js/form-load.js index b48a4eb1..53c31010 100644 --- a/library/js/form-load.js +++ b/library/js/form-load.js @@ -24,7 +24,7 @@ // Make sure response message // is not accessible by screen readers - message.prop( 'aria-hidden', 'true' ); + message.attr( 'aria-hidden', 'true' ); } diff --git a/library/js/form-simulation.js b/library/js/form-simulation.js index effb8de6..30b09767 100644 --- a/library/js/form-simulation.js +++ b/library/js/form-simulation.js @@ -35,7 +35,7 @@ response.removeClass( 'forminator-success' ); // Hide response for screen readers - response.prop( 'aria-hidden', 'true' ); + response.attr( 'aria-hidden', 'true' ); response.removeAttr( 'tabindex' ); // Remove error class from fields