LeaVerou/awesomplete

View on GitHub
index.js

Summary

Maintainability
A
0 mins
Test Coverage
/* global Awesomplete, $:true, $$:true */
$ = Awesomplete.$;
$$ = Awesomplete.$$;

document.addEventListener("DOMContentLoaded", function() {
    var nav = $("nav")
    $$("section > h1").forEach(function (h1) {
        if (h1.parentNode.id) {
            $.create("a", {
                href: "#" + h1.parentNode.id,
                textContent: h1.textContent.replace(/\(.+?\)/g, ""),
                inside: nav
            });
        }
    });
});