htmlnotepad++shtml

Is the autocomplete tag a valid tag in .shtml file?


I was adding the autocomplete attribute to a few password input fields and I noticed that in notepad++ as my text editor the autocomplete = "off" attribute is valid in various types of files (i.e. html, xsl), but in .shtml files autocomplete = "off" is not recognized as a valid attribute.

By recognized,I mean it is not highlighted in red.

Is autocomplete a valid attribute in a .shtml file?

BTW: You can test this out by creating a new file in notepad ++ and adding this code below:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<input type="password" size="80" maxlength="80" autocomplete="off">

</xsl:stylesheet>

Save as .xsl you will notice that the autocomplete attribute is in red, but if you save the save file as a .shtml file, then autocomplete will not be highlighted in red.


Solution

  • autocomplete is a tag is that is valid if you deliver your html document with a html5 doctype.

    The suffix of a document does not matter here. You can deliver a html document as a plain html document .html/.htm, created by some script .php, or without any suffix https://stackoverflow.com/questions/28634257/is-the-autocomplete-tag-a-valid-tag-in-shtml-file.

    The important part is the Content-Type and which <!DOCTYPE is used.

    The various editors detect the programming language of the document using the suffix and then loading some a matching syntax-highlighter and validator. As those validators/syntax-highlighter might be different for the different suffixes they might have different results. As of that the one use for .shtml might be outdated or might not be able to detect that you want to use html5.