How to find obsolete HTML tags and attributes

I'm looking for a way for IntelliJ IDEA to show me elements of HTML and JSP pages that are obsolete in HTML 5.  Ideally, I seem to remember a code inspection doing this for me in a prior version of IDEA, but it doesn't seem to be working in version 14.  I did find the "Deprecated HTML tag" inspection, and it is enabled, but nothing is being highlighted in my HTML pages.

Is there an inspection or setting that I'm missing?

Thanks in advance,

Steve Saliman

7 comments
Comment actions Permalink

Run Analyze | Inspect code with "Deprecated HTML tag" inspection.

Feel free to submit a request at http://youtrack.jetbrains.com/issues/WI if it doesn't work as expected or doesn't find any deprecated tags.

0
Comment actions Permalink

I tried running an inspection for deprected HTML tags, but no issues were found, even though I had a "width" attribute in a <td> tag and the "<!DOCTYPE html>" declaration for an HTML 5 document.

I'm not sure that this is a bug yet - I'm still thinking that it is a configuration issue.  The "width" attribute is valid for HTML 4, it is not ignored until HTML 5.  Is there a configuration option somewhere that I need to check to tell Idea that I want to use HTML 5 when checking the code?

0
Comment actions Permalink

I'm not sure why  "<!DOCTYPE html>" declaration in HTML5 should be reported as deprecated - can you point me to the specification, please? As far as I can see from http://www.w3.org/TR/html-markup/syntax.html, "<!DOCTYPE html>" is a normal doctype in HTML 5.
Note that 'deprecated tags' inspection only reports deprecated tags and is not supposed to be used for tracking down deprecated attributes/directives. We consider re-implementing this inspection as it doesn't always return expected results

0
Comment actions Permalink

Sorry for the confusion.  <!DOCTYPE html> is no problem, I think it's the preferred doctype for HTML 5.  What I'm looking for is all the obsolete HTML 4 attributes in an HTML 5 document.  For example, consider the following HTML:

<!DOCTYPE html>
<html>
<head>
  <title>Test page</title>
</head>
<body>
  <table>
    <tr>
      <td width="10px">Some content</td>
    </tr>
  </table>
</body>


In this case, the "width" attribute in the <td> element is deprecated in HTML 5. It won't be reported as an error by the browser, it will just be ignored, causing the page to render differently than intended.  It would be helpful if there was in inspection that lets me know that "width" has been deprecated so that I can inplement it properly with a "style" attribute.  I think Idea does report on deprecated and invalid attributes when the HTML 4 strict schema is used in the doctype, but HTML 5, there's doesn't appear to be a schema anymore, so we'd need another way to tell Idea how to validate HTML.

Steve

0
Comment actions Permalink

I see, thanks for update:) Please feel free to file a request for adding a new inspections for checking deprecated
attributes in HTML 5 to youtrack, https://youtrack.jetbrains.com/issues/WEB


0
Comment actions Permalink

I will, thanks.

One question:  Would I report it against WebStorm, or Intellij Idea?  I'm using Idea...

Steve

0
Comment actions Permalink

Web related issues should be reported at https://youtrack.jetbrains.com/issues/WEB project, it's common for WebStorm, IDEA and other products.

0

Please sign in to leave a comment.