image: allow overriding css background-image when value is empty (#521)

This commit is contained in:
jean-emmanuel 2019-04-25 09:20:01 +02:00
parent 5a80023c89
commit bd939a735f
2 changed files with 7 additions and 1 deletions

View file

@ -79,7 +79,12 @@ module.exports = class Image extends Widget {
if (!parser.protocol.match(/http|data/)) url = url.replace(':', '_:_')
url = url.replace(/\\/g, '\\\\')
this.widget.style.setProperty('background-image', `url("${url}${cache_query}")`)
if (url) {
this.widget.style.setProperty('background-image', `url("${url}${cache_query}")`)
} else {
this.widget.style.setProperty('background-image', '')
}
if (options.sync) this.changed(options)