Maksim  Savitskiy Maksim Savitskiy - 1 year ago 77
Javascript Question

Unregister Material Disign Lite component in Backbone view

I'm using MDL with Backbone.
How can i unregister components before removing view that contains any MDL component.

To register components i'm using

function from MDL. But without
appears memory leak.

I can't get MDL components that associated with current view to unregister them =(


I found solution of this problem. I just add this code in remove method of all my Backbone views:

var components = this.el.querySelectorAll('[data-upgraded]'); 
if (components.length > 0) {

This code find all upgraded elements in view and downgrade them.