obsohtml 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +11 -3
- package/SECURITY.md +1 -1
- package/bin/obsohtml.test.js +15 -0
- package/package.json +4 -4
- package/src/index.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ As of version 1.10.0, all notable changes to ObsoHTML are documented in this fil
|
|
|
4
4
|
|
|
5
5
|
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).
|
|
6
6
|
|
|
7
|
+
## [1.10.1] - 2026-05-11
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Fixed false positives where obsolete attribute names (e.g., `scrolling`, `background`, `border`) appeared as text inside quoted attribute values (e.g., `content="Infinite scrolling"`)
|
|
12
|
+
|
|
7
13
|
## [1.10.0] - 2026-04-11
|
|
8
14
|
|
|
9
15
|
### Added
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ObsoHTML, the Obsolete HTML Checker
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/obsohtml) [](https://github.com/j9t/obsohtml/actions) [](https://socket.dev/npm/package/obsohtml)
|
|
3
|
+
[](https://www.npmjs.com/package/obsohtml) [](https://github.com/j9t/obsohtml/actions) [](https://socket.dev/npm/package/obsohtml) [](https://github.com/j9t/obsohtml?sponsor=1)
|
|
4
4
|
|
|
5
5
|
ObsoHTML is a Node.js tool designed to scan HTML, PHP, Nunjucks, Twig, JavaScript, and TypeScript files for obsolete and proprietary HTML elements and attributes. It helps you identify and update deprecated HTML code to be sure to use web standards.
|
|
6
6
|
|
|
@@ -60,7 +60,7 @@ const { elements, attributes } = checkMarkup('<center>Hello</center>');
|
|
|
60
60
|
|
|
61
61
|
#### `checkMarkup(html)`
|
|
62
62
|
|
|
63
|
-
Checks an HTML string for obsolete
|
|
63
|
+
Checks an HTML string for obsolete and proprietary elements and attributes.
|
|
64
64
|
|
|
65
65
|
* **Parameter**: `html` (string)—the HTML content to check
|
|
66
66
|
* **Returns**: `{ elements: string[], attributes: string[] }`—arrays of found obsolete element and attribute names
|
|
@@ -85,4 +85,12 @@ This started as an experiment, in which I used AI to produce this little HTML qu
|
|
|
85
85
|
|
|
86
86
|
## Acknowledgments
|
|
87
87
|
|
|
88
|
-
Thanks to [@mattbrundage](https://github.com/mattbrundage), [@FabianBeiner](https://github.com/FabianBeiner), and [@AndrewMac](https://github.com/AndrewMac) for helping to make ObsoHTML better!
|
|
88
|
+
Thanks to [@mattbrundage](https://github.com/mattbrundage), [@FabianBeiner](https://github.com/FabianBeiner), and [@AndrewMac](https://github.com/AndrewMac) for helping to make ObsoHTML better!
|
|
89
|
+
|
|
90
|
+
***
|
|
91
|
+
|
|
92
|
+
You might like some of my other work:
|
|
93
|
+
|
|
94
|
+
* Optimization tools: [HTML Minifier Next](https://github.com/j9t/html-minifier-next) · ObsoHTML · [Image Guard](https://github.com/j9t/image-guard) · [Compressor.js Next](https://github.com/j9t/compressorjs-next) · [.htaccess Punk](https://github.com/j9t/htaccess-punk)
|
|
95
|
+
* Defense tools: [IA Defensa](https://iadefensa.com/solutions/)
|
|
96
|
+
* Resources for quality web development: [Articles](https://meiert.com/topics/development/) · [Books](https://meiert.com/topics/books/) (including [_On Web Development_](https://meiert.com/blog/on-web-development-2/)) · [News](https://frontenddogma.com/) · [Terminology](https://webglossary.info/)
|
package/SECURITY.md
CHANGED
|
@@ -6,4 +6,4 @@ Only the latest and therefore current version of ObsoHTML is supported. It’s a
|
|
|
6
6
|
|
|
7
7
|
## Reporting a Vulnerability
|
|
8
8
|
|
|
9
|
-
To report a vulnerability, please [
|
|
9
|
+
To report a vulnerability, please use [GitHub’s private security advisories](https://github.com/j9t/obsohtml/security/advisories/new) or email info@meiert.com directly. Do not report vulnerabilities via public issues.
|
package/bin/obsohtml.test.js
CHANGED
|
@@ -195,4 +195,19 @@ describe('`checkMarkup`', () => {
|
|
|
195
195
|
const { elements } = checkMarkup('<centers>Hello</centers>');
|
|
196
196
|
assert.deepEqual(elements, []);
|
|
197
197
|
});
|
|
198
|
+
|
|
199
|
+
test('Do not flag an obsolete attribute name appearing inside a quoted attribute value', () => {
|
|
200
|
+
// “scrolling” inside `content="…"`, “background” inside `content="…"`, and
|
|
201
|
+
// “border” inside `alt="…"` are all text—not actual HTML attributes
|
|
202
|
+
const cases = [
|
|
203
|
+
'<meta property="og:title" content="Infinite scrolling on the web">',
|
|
204
|
+
'<meta content="Busyness and Background Noise on Websites">',
|
|
205
|
+
'<img alt="A graphic indicating a border between regions.">',
|
|
206
|
+
"<img alt='A graphic indicating a border between regions.'>",
|
|
207
|
+
];
|
|
208
|
+
for (const html of cases) {
|
|
209
|
+
const { attributes } = checkMarkup(html);
|
|
210
|
+
assert.deepEqual(attributes, [], `Expected no attributes for: ${html}`);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
198
213
|
});
|
package/package.json
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"description": "HTML checker for obsolete and proprietary elements and attributes",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@eslint/js": "^10.0.0",
|
|
12
|
-
"eslint": "^10.
|
|
13
|
-
"globals": "^17.
|
|
14
|
-
"typescript": "^6.0.
|
|
12
|
+
"eslint": "^10.3.0",
|
|
13
|
+
"globals": "^17.6.0",
|
|
14
|
+
"typescript": "^6.0.3"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
},
|
|
44
44
|
"type": "module",
|
|
45
45
|
"types": "src/index.d.ts",
|
|
46
|
-
"version": "1.10.
|
|
46
|
+
"version": "1.10.1"
|
|
47
47
|
}
|
package/src/index.js
CHANGED
|
@@ -17,13 +17,13 @@ const attributeRegexes = new Map(
|
|
|
17
17
|
obsoleteAttributes.map(attribute => [
|
|
18
18
|
attribute,
|
|
19
19
|
// Matches the attribute preceded by whitespace anywhere in a tag, without
|
|
20
|
-
// requiring it to be the last attribute before the closing bracket
|
|
21
|
-
new RegExp(`<[^>]*\\s${attribute}\\b(\\s*=\\s*(?:"[^"]*"|'[^']*'|[^"'\\s>]+))?`, 'i'),
|
|
20
|
+
// requiring it to be the last attribute before the closing bracket
|
|
21
|
+
new RegExp(`<(?:[^>"']|"[^"]*"|'[^']*')*\\s${attribute}\\b(\\s*=\\s*(?:"[^"]*"|'[^']*'|[^"'\\s>]+))?`, 'i'),
|
|
22
22
|
])
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Check an HTML string for obsolete
|
|
26
|
+
* Check an HTML string for obsolete and proprietary elements and attributes.
|
|
27
27
|
*
|
|
28
28
|
* @param {string} html
|
|
29
29
|
* @returns {{ elements: string[], attributes: string[] }}
|