render header and footer only once. fixes #788

This commit is contained in:
Danny Coates 2018-03-12 10:15:11 -07:00
parent 94714ecb62
commit 3e6a88d31d
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
3 changed files with 52 additions and 36 deletions

View file

@ -2,7 +2,7 @@ const html = require('choo/html');
const assets = require('../../../common/assets');
module.exports = function(state) {
return html`<footer class="footer">
const footer = html`<footer class="footer">
<div class="legalSection">
<a
href="https://www.mozilla.org"
@ -61,4 +61,11 @@ module.exports = function(state) {
</a>
</div>
</footer>`;
// HACK
// We only want to render this once because we
// toggle the targets of the links with utils/openLinksInNewTab
footer.isSameNode = function(target) {
return target && target.nodeName && target.nodeName === 'FOOTER';
};
return footer;
};