简体   繁体   English

HTML属性中的标签?

[英]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. 我有一个插件,使用户可以根据需要使用title属性在图像上添加标题。 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-". 然后在我的js中,我将替换“ myplugin-”。

Would this lead to any problems in terms of validation? 在验证方面是否会导致任何问题?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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