Revert "revert CustomElements changes"

This reverts commit 3ca60a8dc8eeead1ec79fb1ec7f7833f9efa99a5.