Last active
May 31, 2022 16:21
-
-
Save Accudio/3449778ac239f716ddd162fdbce3f1c5 to your computer and use it in GitHub Desktop.
"Check for WCAG 2.0 parsing compliance" by [Steve Faulkner](https://twitter.com/SteveFaulkner) with added support for Alpine and Vue attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var a,b,c,d,e,f,g=0;if(a=["tag seen","Stray end tag","Bad start tag","violates nesting rules","Duplicate ID","first occurrence of ID","Unclosed element","not allowed as child of element","unclosed elements","not allowed on element","unquoted attribute value","Duplicate attribute"].join("|"),b=document.getElementById("results"),!b)return void alert("No results container found.");for(c=b.getElementsByTagName("li"),f=0;f<c.length;f++)d=c[f],""!==d.className%26%26(e=(void 0===d.innerText%3Fd.textContent:d.innerText)+"",resultHtml=d.innerHTML,null===e.match(a)%3F(d.style.display="none",d.className+=" steveNoLike",g++):-1!==e.indexOf("not allowed on element")%26%26(-1!==resultHtml.indexOf("<code>ng-")||-1!==resultHtml.indexOf("<code>x-")||-1!==resultHtml.indexOf("<code>ax-")||-1!==resultHtml.indexOf("<code>v-")||-1!==resultHtml.indexOf("<code>:")||-1!==resultHtml.indexOf("<code>%40"))%26%26(d.style.display="none",d.className+=" steveNoLike",g++));alert("Complete. "+g+" items removed.")})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var removeFramework = true | |
var filterStrings = [ | |
'tag seen', | |
'Stray end tag', | |
'Bad start tag', | |
'violates nesting rules', | |
'Duplicate ID', | |
'first occurrence of ID', | |
'Unclosed element', | |
'not allowed as child of element', | |
'unclosed elements', | |
'not allowed on element', | |
'unquoted attribute value', | |
'Duplicate attribute' | |
] | |
var filterRE, | |
root, | |
results, | |
result, | |
resultText, | |
i, | |
cnt = 0 | |
filterRE = filterStrings.join('|') | |
root = document.getElementById('results') | |
if (!root) { | |
alert('No results container found.') | |
return | |
} | |
results = root.getElementsByTagName('li') | |
for (i = 0; i < results.length; i++) { | |
result = results[i] | |
if (result.className !== '') { | |
resultText = | |
(result.innerText !== undefined | |
? result.innerText | |
: result.textContent) + '' | |
resultHtml = result.innerHTML | |
if (resultText.match(filterRE) === null) { | |
result.style.display = 'none' | |
result.className = result.className + ' steveNoLike' | |
cnt++ | |
} else if (removeFramework == true) { | |
if (resultText.indexOf('not allowed on element') !== -1) { | |
if ( | |
resultHtml.indexOf('<code>ng-') !== -1 || | |
resultHtml.indexOf('<code>x-') !== -1 || | |
resultHtml.indexOf('<code>ax-') !== -1 || | |
resultHtml.indexOf('<code>v-') !== -1 || | |
resultHtml.indexOf('<code>:') !== -1 || | |
resultHtml.indexOf('<code>@') !== -1 | |
) { | |
result.style.display = 'none' | |
result.className = result.className + ' steveNoLike' | |
cnt++ | |
} | |
} | |
} | |
} | |
} | |
alert('Complete. ' + cnt + ' items removed.') | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment