HTML 属性中的标签?
我有一个插件,允许用户根据需要使用 title 属性向图像添加标题。我想知道,如果我允许他们这样做:
<img title="I am a <myplugin-a>caption</myplugin-a>" src="imagelink" />
然后在我的js中,我会替换“myplugin-”。
这会导致验证方面出现任何问题吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它不会导致有效性问题(标题属性中允许小于和大于字符作为数据),但这意味着如果未应用 JS,您的 HTML 将是无意义的(用户可能禁用了 JS,JS 文件可能无法加载,搜索引擎索引器通常不会执行任何 JS 等)。
It wouldn't lead to validity problems (less then and greater than characters are allowed as data in title attributes), but it would mean your HTML would be nonsensical if the JS wasn't applied (users may have JS disabled, a JS file may fail to load, a search engine indexer usually won't execute any JS, etc).