Custom attributes - Yea or nay?

前端 未结 14 1916
南旧
南旧 2020-11-22 03:02

Recently I have been reading more and more about people using custom attributes in their HTML tags, mainly for the purpose of embedding some extra bits of data for use in ja

14条回答
  •  没有蜡笔的小新
    2020-11-22 03:40

    I see no problem in using existing XHTML features without breaking anything or extending your namespace. Let's take a look at a small example:

    Hi!

    How to add additional information to some_content without additional attributes? What about adding another tag like the following?

    Hi!

    It keeps the relation via a well defined id/extension "_extended" of your choice and by its position in the hierarchy. I often use this approach together with jQuery and without actually using Ajax like techniques.

提交回复
热议问题