Remove usage of deprecated APIs

Could `view.element` be used here?