-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-deprecated.js
More file actions
21 lines (21 loc) · 1.04 KB
/
check-deprecated.js
File metadata and controls
21 lines (21 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* Finds deprecated tags (HTML elements) and print them on the console.
This helps students to make sure that they don't insert or paste a
deprecated element to their pages. This script is not a replacement
for HTML validators but a little helper that avoids issues while
coding without having to constantly validating their pages.
*/
;(() =>{
let elements = document.querySelectorAll('*');
const deprecatedList = "acronym big center content dir font frame frameset image marquee menuitem nobr noembed noframes param plaintext rb rtc strike tt xmp".split(" ");
let found = [];
elements.forEach((elem) => {
const tag = elem.tagName.toLowerCase();
if(deprecatedList.includes(tag)) {
found.push(`<${tag}>, https://developer.mozilla.org/en-US/docs/Web/HTML/Element/${tag}`);
}
});
console.log(`${found.length} deprecated element${found.length !== 0 ? '' : 's'} found.`);
if(found.length) {
console.log(found);
}
})();