Thanks for your reply FC Basson. You code works, the trouble for me was figuring out all the events to wait for to make sure the layers were loaded and attribution set. The Mapbox layer is used as a basemap in my application and I have a basemap toggle which changes the attribution text when you toggle between basemaps. Here's my hackish solution:
when the mapView is ready
watch the attribution text
if the attribution text equals the Mapbox copyright text
try to update the text to make it html, but this doesn't work
try to update it every 2 milliseconds
if update successful, clear interval
mapView.watch('ready', function(){
var attribution = mapView.ui._components[0];
attribution.widget.viewModel.watch('attributionText', function(evt){
if (evt == '<a href="http://mapbox.com/about/maps" class="mapbox-wordmark" target="_blank">Mapbox</a>© <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors, © <a href="https://www.mapbox.com/map-feedback/" target="_blank"><strong>Improve this map</strong></a>'){
document.getElementsByClassName('esri-attribution__sources')[0].innerHTML = evt; // never works, don't know why
updateAttr = setInterval(function(){
document.getElementsByClassName('esri-attribution__sources')[0].innerHTML = evt;
if (document.getElementsByClassName('esri-attribution__sources')[0].innerText == "Mapbox© OpenStreetMap contributors, © Improve this map"){
clearInterval(updateAttr);
}
}, 2);
}
});
});
Of course this would need to be edited if any operational layers had attribution or copyright text. Not a satisfying solution. This was so easy at 3.x!! Sure there is a better way.