A design pattern that elegantly handles the registration of new components such that DOM upgrades are automatically performed on document load, as well as making it super easy to handle upgrades of elements that may be added after initial page load.
Have you seen https://github.com/uzairfarooq/arrive? Bootstrap-material supports it, which makes using it on SPAs real nice. When new pages get rendered into the DOM, absolutely nothing needs to be done in javascript. Seems to me your upgradeElement() could be implemented using only the first element argument, and it could discover what to do based on the css classes already present on the element. Then something like arrive() could be used to automatically materialize any component added to the DOM by a SPA without any additional code.