diff --git a/CHANGELOG.md b/CHANGELOG.md index b0aa75b..c1f57df 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bin/obsohtml.test.js b/bin/obsohtml.test.js index de287bd..b3efe96 100644 --- a/bin/obsohtml.test.js +++ b/bin/obsohtml.test.js @@ -195,4 +195,19 @@ describe('`checkMarkup`', () => { const { elements } = checkMarkup('Hello'); 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 = [ + '', + '', + 'A graphic indicating a border between regions.', + "A graphic indicating a border between regions.", + ]; + for (const html of cases) { + const { attributes } = checkMarkup(html); + assert.deepEqual(attributes, [], `Expected no attributes for: ${html}`); + } + }); }); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index cce439f..7a65646 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsohtml", - "version": "1.10.0", + "version": "1.10.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "obsohtml", - "version": "1.10.0", + "version": "1.10.1", "license": "MIT", "dependencies": { "commander": "^14.0.0" diff --git a/package.json b/package.json index b8ae6a6..5a938d4 100644 --- a/package.json +++ b/package.json @@ -43,5 +43,5 @@ }, "type": "module", "types": "src/index.d.ts", - "version": "1.10.0" + "version": "1.10.1" } \ No newline at end of file diff --git a/src/index.js b/src/index.js index 630fe3d..5d2c45b 100644 --- a/src/index.js +++ b/src/index.js @@ -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'), ]) );