/* My jQuery "polyfill" */
class JElement {
  constructor(element) {
    this.element = element;
  }
  removeClass(className) {
    if (!this.element) {
      return;
    }
    this.element.classList.remove(className);
  }
  hasClass(className) {
    if (!this.element) {
      return;
    }
    this.element.classList.contains(className);
  }
  remove() {
    if (!this.element) {
      return;
    }
    this.element.parentNode.removeChild(this.element);
  }
  is(arg) {
    if (!this.element) {
      return false;
    }
    if (arg === ':visible') {
      return this.element.offsetWidth === 0 && this.element.offsetHeight === 0;
    }
    return false;
  }
  on(eventName, cb) {
    if (!this.element) {
      return;
    }
    this.element.addEventListener(eventName, cb);
  }
  html(content) {
    if (!this.element) {
      return;
    }
    this.element.innerHTML = content;
  }
}
const $ = selector => {
  if (selector === window) {
    return new JElement(window);
  }
  const ele = window.document.querySelector(selector);
  return new JElement(ele);
};
export default $;