Skip to content

Commit

Permalink
[Fix] no-invalid-html-attribute: avoid breaking syntax from #3174
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 17, 2022
1 parent 2445dbb commit 5f49f51
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/rules/no-invalid-html-attribute.js
Expand Up @@ -306,9 +306,12 @@ function checkLiteralValueNode(context, attributeName, node, parentNode, parentN
if (allowedPairsForAttribute) {
const pairAttributeParts = splitIntoRangedParts(node, /(?=(\b\S+\s*\S+))/g);
for (const pairPart of pairAttributeParts) {
for (const [pairing, siblings] of allowedPairsForAttribute) {
for (const allowedPair of allowedPairsForAttribute) {
const pairing = allowedPair[0];
const siblings = allowedPair[1];
const attributes = pairPart.reportingValue.split('\u0020');
const [firstValue, secondValue] = attributes;
const firstValue = attributes[0];
const secondValue = attributes[1];
if (firstValue === pairing) {
const lastValue = attributes[attributes.length - 1]; // in case of multiple white spaces
if (!siblings.has(lastValue)) {
Expand All @@ -319,7 +322,7 @@ function checkLiteralValueNode(context, attributeName, node, parentNode, parentN
data: {
reportingValue: firstValue,
secondValue,
missingValue: [...siblings].join(', '),
missingValue: Array.from(siblings).join(', '),
},
});
}
Expand Down

0 comments on commit 5f49f51

Please sign in to comment.