简体   繁体   中英

Tags in HTML attributes?

I have a plugin that enable users to add on a caption to a image if they want to, using the title attribute. I would like to find out, if I allow them to do this :

<img title="I am a <myplugin-a>caption</myplugin-a>" src="imagelink" />

and then in my js, I would do a replace for "myplugin-".

Would this lead to any problems in terms of validation?

这不会导致有效性问题(标题属性中的数据小于等于字符且允许大于字符),但是这意味着如果不应用JS,您的HTML将是毫无意义的(用户可能禁用了JS,一个JS文件)可能无法加载,搜索引擎索引器通常不会执行任何JS等)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM