Description
The specific bug I am encountering is when deleteTraces is called on a plot of 11 or more traces, with an array of integers from [0.... n-1](in order to delete all the Traces on the plot) it leaves several items undeleted, (in my specific case, the traces in the 11-18 slots of the data array.)
I believe this abnormality of the deleteTraces function (not deleting every trace it was requested to delete) is caused by the sort function used in the deleteTraces method (on line 62493 of plotly.js) the sort function seems to use the default behavior of the .sort() function which sorts numbers into this order 0, 1, 10, 11, 12..., 2..., 3..., 4..., 5..., etc. Thus comparing the first number in each integer, then the second then the third. Leaving the numbers out of numerical order. This is a problem, because of the use of the .splice() function, which removes an indicated item in the traces array, and decrements every item placed numerically above it, so as not to leave a hole. This behavior of the .splice() function combined with the previously outlined default behavior of the .sort() function creates this issue where if you want to delete items 0-11, of an 11 item list (let's say) it will delete items 9-2, try to delete item 11 and 10 (failing because there are no items in those positions) and then delete items 0 and 1, leaving item 11 and 10 undeleted.
This issue would be fixed by changing line 62516 (of my version, maybe it’s a little off from changes now) from indicies.sort().reverse(); to indicies.sort(function(a,b){return a-b}).reverse();
I hope this is helpful, and I submitted this issue correctly! Thank you very much!