custom attributes in a script tag

前端 未结 4 641
说谎
说谎 2021-01-18 08:43

Can I use a custom attribute in a script tag such as:



        
4条回答
  •  暖寄归人
    2021-01-18 09:21

    Yes, you can do this. Browsers are required to ignore attributes they don't recognize in any tag (to allow for graceful degradation when a document uses new features with an old browser). However, it would be better to use a dataset tag, since these are explicitly reserved for users, so they don't conflict with future HTML changes.

    
    
                                     
                  
提交回复
热议问题