This commit is contained in:
David Remer 2020-04-06 11:16:18 +03:00
parent 7fd57b9393
commit 005a55c213
62 changed files with 905 additions and 751 deletions

View file

@ -1,21 +1,25 @@
class ErrorHandler {
constructor() {
constructor()
{
this.wrapper = document.querySelector('.woocommerce-notices-wrapper');
}
message(text) {
message(text)
{
this.wrapper.classList.add('woocommerce-error');
this.wrapper.innerText = this.sanitize(text);
}
sanitize(text) {
sanitize(text)
{
const textarea = document.createElement('textarea');
textarea.innerHTML = text;
return textarea.value;
}
clear() {
clear()
{
if (! this.wrapper.classList.contains('woocommerce-error')) {
return;
}