Skip to content

Commit

Permalink
improve logging for invalid attr value
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Feb 7, 2024
1 parent 6d12f81 commit 4fbdfc2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/scriptlets/set-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
setAttributeBySelector,
observeDOMChanges,
nativeIsNaN,
convertTypeToString,
// following helpers should be imported and injected
// because they are used by helpers above
defaultAttributeSetter,
Expand Down Expand Up @@ -132,7 +133,7 @@ export function setAttr(source, selector, attr, value = '') {
|| allowedValues.includes(value.toLowerCase());

if (!shouldCopyValue && !isValidValue) {
logMessage(source, 'Illegal attribute value provided');
logMessage(source, `Invalid attribute value provided: '${convertTypeToString(value)}'`);
return;
}

Expand Down Expand Up @@ -168,6 +169,7 @@ setAttr.injections = [
setAttributeBySelector,
observeDOMChanges,
nativeIsNaN,
convertTypeToString,
// following helpers should be imported and injected
// because they are used by helpers above
defaultAttributeSetter,
Expand Down

0 comments on commit 4fbdfc2

Please sign in to comment.