HTML_CodeSniffer icon indicating copy to clipboard operation
HTML_CodeSniffer copied to clipboard

Ability to exclude HTML from getting sniffed

Open avfall98 opened this issue 9 years ago • 2 comments

It would be good to be able to put in HTML markup that makes the HTML Sniffer skip certain code.

Prime example is the Twitter Iframe embed: https://publish.twitter.com/?url=https%3A%2F%2Ftwitter.com%2FTwitterDev%2Ftimelines%2F539487832448843776#

HTML Code Sniffer actually sniffs this code even though it's within an iframe tag, because the HTML within it is accessible by JS because it's not a traditional iframe implementation.

It would be good to be able to specify an attribute on a HTML tag which tells the sniffer to not sniff any code within that tag, for example:

avfall98 avatar Sep 01 '16 00:09 avfall98

This is partially solved with recent changes to the way HTML code sniffer will exclude aria-hidden=true and role=presentation and all of the descendent elements (this can be used as an interim method for excluding something for those needing a quick fix).

Longer term I think there may need to be some solution for marking these elements to be ignored without relying on those aria and role attributes since they also come with alternate meanings to accessibility APIs. Perhaps a data- attribute?

ironikart avatar Sep 05 '16 22:09 ironikart

Yea a data- attribute is what I suggested but the editor stripped my tags out.

Something like div data-htmlcs-nosniff="true"

avfall98 avatar Sep 05 '16 22:09 avfall98