Skip to content

bug: hide caret shim does not properly remove itself #26807

Description

@joewoodhouse

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • v7.x
  • Nightly

Current Behavior

The shim for hiding the caret on scroll (detailed here https://github.com/ionic-team/ionic-framework/wiki/Utilities#hide-caret) does not remove itself properly, leaving an attached event listener on the ion-content object, which means it is never free/released by the GC

Expected Behavior

The shim should properly remove itself from the element

Steps to Reproduce

Setup

  • Add an inside of an element
  • Remove then ion-input and the ion-content

Analysis

Take a snapshot of the heap. You will see a "Detached HTMLElement" in the objects relating to the ion-content object. In the list of retainers you will see the hide-caret shims

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.20.6

Utility:

cordova-res : not installed globally
native-run : 1.7.1

System:

NodeJS : v16.14.2
npm : 8.7.0
OS : macOS

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions