philipwalton / html-inspector

HTML Inspector is a code quality tool to help you and your team write better markup. It's written in JavaScript and runs in the browser, so testing your HTML has never been easier.
2.32k stars 145 forks source link

Add the ability to exclude DOM elements and subtrees from inspection. #11

Closed philipwalton closed 11 years ago

philipwalton commented 11 years ago

One possible way would be to add a property to the main config object that takes a selector. This would allow you to exclude elements and subtrees the same way:

HTMLInspector.inspect({
  exclude: "#foo, #bar *"
})

If you needed to pass an element instead of a selector (for whatever reason), perhaps something like this would work better:

HTMLInspector.inspect({
  exclude: el1,
  excludeSubTree: el2
})
isimmons commented 11 years ago

First thing I'm looking for in the usage instructions and not finding it.

With modernizer I get a long list of

The class [insert-classname] is used in the HTML but not found in any stylesheet

Would be good to have a simple way to exclude the html tag all together or exclude modernizr classes

philipwalton commented 11 years ago

Yeah, that's the idea with this feature. I'll try to get to it soon.

However, one way of solving the problem today is by prefixing the Modernizr classes (that's why I do anyway). With Modernizr you can prefix all the classes with a namespace, and I've chosen "supports-" to mimic the @supports CSS conditional rules. You could also start the inspection point at body, but that's less ideal. Anyway, a fix is coming soon.

There's also a pull request about this issue that you may want to comment on.