Closed Mte90 closed 3 years ago
Ah, I see, it's because your main
element is not a direct child of body
.
I understand the problem, and I think your change is a good solution.
To make sure everything keeps working, I would like to make sure the tests pass, but after that I will welcome this change!
Seems that the build didn't started.
Weird. I've restarted the build.
Ok this time worked and everything is red.
You mean green, but yeah, it is. 😉
But I'm not entirely convinced yet: I think it would be good to throw an exception when appendEl
is not defined. That's clearly an error, and right now it's failing silently and the developer will have no idea why this isn't working.
Throwing an exception would clearly signal what's going wrong. Do you agree?
Ops yes green, too many things in parallel.
So you want a console.log?
A full-on exception would have my preference:
throw new Error("Unable to add cookie dialog: element does not exist.");
Added but I guess that now the tests suite will alert that there is no dialog.
It's a bit weird how the tests didn't throw the error you were trying to solve in this PR.
I'll have to think about why that is, I don't understand why the test either didn't fail before, or doesn't succeed now.
done
I've published under version 1.0.4
.
I am getting this if I compile the library and using in a page with
main
available.The website is https://glossary.codeat.co That patch let me to use the library with no issues otherwise there was that error. Probably can be improved for the tests.