dobarkod / cookie-banner

JavaScript based cookie-info banner for complying with EU cookie law
MIT License
425 stars 85 forks source link

Empty linkmsg causes error #64

Closed akmur closed 6 years ago

akmur commented 6 years ago

Hello,

I have noticed that an empty linkmsg value causes a javascript error. I know how to get it fixed, do you want me to fix it or is this on purpose perhaps?

I was thinking that even better would be to add a "showLinkmsg" property so that if it is set to no, the link will simply not show.

Let me know,

Alex

zytzagoo commented 6 years ago

Indeed. The error is caused due to https://github.com/dobarkod/cookie-banner/blob/master/src/cookiebanner.js#L456 expecting the a element to exist.

An easy fix might be to just simply check if el_a exists (is not undefined) before doing things to it?

I'd like to avoid adding another option if simply setting linkmsg to an empty string achieves what users expect from it? How do others feel about it?

zytzagoo commented 6 years ago

Fixed by 66d6b607. Will go out in the next release at some point... or do you need it asap?

zytzagoo commented 6 years ago

Gonna close the issue, feel free to reopen if some further action is needed. And thanks a lot for the bug report!

akmur commented 6 years ago

No I fixed it myself already but thanks a lot :)