Can I have attributes on closing tags?

前端 未结 5 1136
温柔的废话
温柔的废话 2020-12-05 06:11

There are many people that mark closing tags like this to help identify the closing tag that goes with an HTML tag:

5条回答
  •  猫巷女王i
    2020-12-05 07:08

    Sorry, but it doesn't work and doesn't validate.

    If you try other attributes in closing tags, then the browser skips the attribute. I tried it in several ways, tested it with ids and classes, and the css and the javascript didn't recognized them in the ending tag. Your best bet is the commenting.

    EDITED

    Or you could make your own html tags.

    You must use hyphenation, and you should avoid

    document.createElement('foo-bar');
    

提交回复
热议问题