Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ As of version 1.10.0, all notable changes to ObsoHTML are documented in this fil

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.10.1] - 2026-05-11

### Fixed

- Fixed false positives where obsolete attribute names (e.g., `scrolling`, `background`, `border`) appeared as text inside quoted attribute values (e.g., `content="Infinite scrolling"`)

## [1.10.0] - 2026-04-11

### Added
Expand Down
14 changes: 14 additions & 0 deletions bin/obsohtml.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,18 @@ describe('`checkMarkup`', () => {
const { elements } = checkMarkup('<centers>Hello</centers>');
assert.deepEqual(elements, []);
});

test('Do not flag an obsolete attribute name appearing inside a quoted attribute value', () => {
// “scrolling” inside `content="…"`, “background” inside `content="…"`, and
// “border” inside `alt="…"` are all text—not actual HTML attributes
const cases = [
'<meta property="og:title" content="Infinite scrolling on the web">',
'<meta content="Busyness and Background Noise on Websites">',
'<img alt="A graphic indicating a border between regions.">',
];
Comment thread
coderabbitai[bot] marked this conversation as resolved.
for (const html of cases) {
const { attributes } = checkMarkup(html);
assert.deepEqual(attributes, [], `Expected no attributes for: ${html}`);
}
});
});
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
},
"type": "module",
"types": "src/index.d.ts",
"version": "1.10.0"
"version": "1.10.1"
}
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const attributeRegexes = new Map(
obsoleteAttributes.map(attribute => [
attribute,
// Matches the attribute preceded by whitespace anywhere in a tag, without
// requiring it to be the last attribute before the closing bracket.
new RegExp(`<[^>]*\\s${attribute}\\b(\\s*=\\s*(?:"[^"]*"|'[^']*'|[^"'\\s>]+))?`, 'i'),
// requiring it to be the last attribute before the closing bracket
new RegExp(`<(?:[^>"']|"[^"]*"|'[^']*')*\\s${attribute}\\b(\\s*=\\s*(?:"[^"]*"|'[^']*'|[^"'\\s>]+))?`, 'i'),
])
);

Expand Down
Loading