mutationObserver property

MutationObserver? mutationObserver
getter/setter pair

Implementation

late web.MutationObserver? mutationObserver = web.MutationObserver(
  ((JSArray<web.MutationRecord> entries, web.MutationObserver observer) {
    if (web.document.getElementById('payment-element') != null) {
      mutationObserver?.disconnect();
      element = elements!.createPayment(elementOptions())
        ..mount('#payment-element'.toJS)
        ..onBlur(requestBlur)
        ..onFocus(requestFocus)
        ..onChange(onCardChanged);
      mutationObserver = web.MutationObserver(
          (JSArray<web.MutationRecord> entries,
              web.MutationObserver observer) {
        final stripeElements =
            web.document.getElementsByClassName('__PrivateStripeElement');
        if (stripeElements.length != 0) {
          mutationObserver?.disconnect();
          final element = stripeElements.item(0) as web.HTMLElement;
          resizeObserver.observe(element);
        }
      }.toJS);
      mutationObserver!.observe(
        web.document,
        web.MutationObserverInit(childList: true, subtree: true),
      );
    }
  }.toJS),
);