Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix(jquery): form load issue and other field issues due to jquery upgrade. #17

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions assets/js/public/code-snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@

showTooltip: function( e, msg ) {
$( e ).addClass( 'sui-tooltip' );
$( e ).prop( 'aria-label', msg );
$( e ).prop( 'data-tooltip', msg );
$( e ).attr( 'aria-label', msg );
$( e ).data( 'tooltip', msg );
},

generateUniqueId: function() {
Expand All @@ -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 ) );
}
Expand Down
16 changes: 8 additions & 8 deletions assets/js/public/form-field-required.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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 );
Expand All @@ -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 );
Expand All @@ -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 );
Expand All @@ -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 );
Expand Down
10 changes: 5 additions & 5 deletions assets/js/public/form-field-unique.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const element = $( el );
const form = element.closest( '.forminator-custom-form' );

if ( '' === form.prop( 'data-id' ) ) {
if ( '' === form.data( 'id' ) ) {
return;
}

Expand All @@ -39,7 +39,7 @@
}

if ( dscrp.length ) {
dscrp.prop( 'aria-describedby', getUniqueId );
dscrp.attr( 'aria-describedby', getUniqueId );
}
});
}
Expand All @@ -66,7 +66,7 @@
}

if ( dscrp.length ) {
dscrp.prop( 'aria-describedby', getUniqueId );
dscrp.attr( 'aria-describedby', getUniqueId );
}
});
}
Expand Down Expand Up @@ -141,7 +141,7 @@
}

if ( dscrp.length ) {
dscrp.prop( 'aria-describedby', idUnique );
dscrp.attr( 'aria-describedby', idUnique );
}
});
}
Expand Down Expand Up @@ -170,7 +170,7 @@
}

if ( dscrp.length ) {
dscrp.prop( 'aria-describedby', idUnique );
dscrp.attr( 'aria-describedby', idUnique );
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/public/forms-section-samples.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down
14 changes: 7 additions & 7 deletions assets/js/public/page-accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand All @@ -26,7 +26,7 @@
row.removeAttr( 'aria-hidden' );
} else {
row.hide();
row.prop( 'aria-hidden' );
row.attr( 'aria-hidden' );
}
});
}
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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() {

Expand All @@ -146,7 +146,7 @@

// Hidden field
if ( true === column.data( 'conditional' ) ) {
columnUnwrapped.prop( 'data-conditional', 'true' );
columnUnwrapped.data( 'conditional', 'true' );
}

// Hide column
Expand Down Expand Up @@ -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 ) {

Expand Down
12 changes: 6 additions & 6 deletions assets/js/public/page-polls.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

// Hide response for screen readers
response.removeAttr( 'tabindex' );
response.prop( 'aria-hidden', 'true' );
response.attr( 'aria-hidden', 'true' );

}

Expand Down Expand Up @@ -171,7 +171,7 @@

// Hide poll form
field.hide();
field.prop( 'aria-hidden', 'true' );
field.attr( 'aria-hidden', 'true' );

if ( wrapper.length ) {

Expand Down Expand Up @@ -205,7 +205,7 @@

// Hide "view results" link
link.hide();
link.prop( 'aria-hidden', 'true' );
link.attr( 'aria-hidden', 'true' );

e.preventDefault();

Expand All @@ -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' );

}

Expand Down
8 changes: 4 additions & 4 deletions assets/js/public/page-quizzes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand Down Expand Up @@ -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.';
Expand Down Expand Up @@ -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 );
}

Expand Down
Loading