Get document.html and document.body only when we need them

This commit is contained in:
Will Bamberg
2017-04-28 11:08:34 -07:00
parent 06cac5f7a6
commit 62d95d240c

View File

@@ -1,9 +1,8 @@
var html = document.querySelector('html');
var body = document.querySelector('body');
browser.runtime.onMessage.addListener(updateBg);
function updateBg(request, sender, sendResponse) {
var html = document.querySelector('html');
var body = document.querySelector('body');
if (request.image) {
html.style.backgroundImage = 'url(' + request.image + ')';
body.style.backgroundImage = 'url(' + request.image + ')';