我正在使用 CKEditor 插入引用标记(脚注)。我编写了一个 CKEditor 插件,允许用户单击 CKEditor 实例中的按钮并输入新的引用或选择现有的引用。标记是使用 jQuery 构建的:
// see http://www.w3.org/TR/html5/common-idioms.html#footnotes
var $cite = $("<sup>").append($("<a>").attr("href", "#").attr("data-citationid", citationId).html("[" + citationId + "]"));
editor.insertHtml($cite.get(0).outerHTML);
wheredata-citationid
引用数据库中引文的 id。问题是 Chrome (23.0.1271.97 m) 中插入的标记不同。
Firefox (17.0.1) 和 IE (9.0.8112.16421) 插入所需的
<sup><a data-citationid="26" href="#">[26]</a></sup>
但 Chrome 会去除<sup>
标签并插入
<a data-citationid="26" href="#" style="vertical-align: super;">[26]</a>
我的问题是:
- 我可以构建标记以使其始终按需要呈现吗?
- 浏览器或 CKEditor 是否更改了标记?