# idlharness.js API ## Introduction ## `idlharness.js` automatically generates browser tests for WebIDL interfaces, using the testharness.js framework. To use, first include the following: ```html ``` Then you'll need some type of IDLs. Here's some script that can be run on a spec written in HTML, which will grab all the elements with `class="idl"`, concatenate them, and replace the body so you can copy-paste: ```js var s = ""; [].forEach.call(document.getElementsByClassName("idl"), function(idl) { //https://www.w3.org/Bugs/Public/show_bug.cgi?id=14914 if (!idl.classList.contains("extract")) { if (s !== "") { s += "\n\n"; } s += idl.textContent.replace(/ +$/mg, ""); } }); document.body.innerHTML = '
';
document.body.firstChild.textContent = s;
```

Once you have that, put it in your script somehow.  The easiest way is to
embed it literally in an HTML file with `