Skip to content

Commit

Permalink
favor "data-foundation-validation" over the deprecated "foundation-va…
Browse files Browse the repository at this point in the history
…lidation"

compare tag name always in lower case
  • Loading branch information
stefanseifert committed Nov 28, 2024
1 parent 15d5d81 commit e738786
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

// predefined "responsiveWidths" pattern validator
foundationValidator.register('foundation.validation.validator', {
selector: '[data-validation="wcmio.handler.media.responsiveWidths"]',
selector: '[data-foundation-validation="wcmio.handler.media.responsiveWidths"]',
validate: function(el) {
var value = getValue(el);
var valid = value.length === 0 || pattern.responsiveWidths.test(value);
Expand All @@ -54,10 +54,10 @@

// validates valid media format for asset picker
foundationValidator.register('foundation.validation.validator', {
selector: '[data-validation="wcmio.handler.media.mediaFormat"]',
selector: '[data-foundation-validation="wcmio.handler.media.mediaFormat"]',
validate: function(el) {
var nextSibling = el.nextSibling;
if (nextSibling && nextSibling.tagName === 'coral-alert') {
if (nextSibling && nextSibling.tagName.toLowerCase() === 'coral-alert') {
return nextSibling.textContent;
}
}
Expand Down

0 comments on commit e738786

Please sign in to comment.