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

Inline <svg> #2

Closed webpro closed 11 years ago

webpro commented 11 years ago

Interesting project!

Just inspected a document that has inline <svg> elements..

  1. It fails in allowedAttributesForElement(), since the element is not present in elementData. This should probably become a rule violation? I see you got that handled by your <il> example, but for me that also raises the exception.
  2. How to deal with inline <svg> elements? They are valid HTML5 (non-namespaced), not sure if this is an exception or if there are more elements not listed.

Btw, I ran this with html-inspector.js on the docs/styleguide/index.html in & after building topcoat.

I'd be happy to submit a PR, but wanted to check with you first.

philipwalton commented 11 years ago

Hey, thanks for catching this!

I've updated the code to temporarily ignore <svg> elements and their children since they're not listed in the document I took the validation data from. Furthermore, as I read that document, <svg> elements aren't really part of HTML per se, they're their own document type.

It also seems like supporting and all its sub-element and attributes would require a bit of work, so I decided to ignore it for now.

I've bumped to version 0.2.0. Let me know if you're still experiencing any of these problems, and thanks again for catching this bug.