Skip to content

Commit

Permalink
fix(core/webidl-index): don't clone IDs into idl-index (closes #1119)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres committed Mar 1, 2017
1 parent 1b0217d commit 700edc6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/core/webidl-index.js
Expand Up @@ -54,6 +54,10 @@ export function run(conf, doc, cb) {
collector.appendChild(elem);
return collector;
}, pre);
// Remove duplicate IDs
Array
.from(pre.querySelectorAll("*[id]"))
.forEach(elem => elem.removeAttribute("id"));
virtualSummary.appendChild(pre);
idlIndexSec.appendChild(virtualSummary);
cb();
Expand Down
24 changes: 23 additions & 1 deletion tests/spec/core/idl-index-spec.js
@@ -1,6 +1,6 @@
"use strict";
describe("Core — IDL Index", () => {
afterAll( done => {
afterAll(done => {
flushIframes();
done();
});
Expand Down Expand Up @@ -64,4 +64,26 @@ interface Bar {
expect(doc.querySelectorAll("#idl-index > h2").length).toEqual(1);
}).then(done);
});
it("doesn't include ids in the cloned indexed", done => {
const body = `
${makeDefaultBody()}
<pre class=idl>
interface Test {
};
</pre>
<section id="idl-index">
<h2>PASS</h2>
<p>Custom paragraph.</p>
</section>
`;
var ops = {
config: makeBasicConfig(),
body,
};
makeRSDoc(ops, function(doc) {
const pre = doc.querySelector("#idl-index pre");
expect(pre.querySelectorAll("*[id]").length).toEqual(0);
}).then(done);
});
});

0 comments on commit 700edc6

Please sign in to comment.