1

The problem with array defined elements. After clear all data, elements still exist in array, but length of array returns 0 value. When trying to fill array again, we are didn't see, that array is empty.

I was trying to clear array different ways

arr.splice(0, arr.length);

arr.length = 0;

etc...

but array always have old values after last element was removed from array...

here is example

What am I doing wrong?

It happens only latest versions on Chrome browser, in other browsers all is ok.

working on 35.0.1916.153 m, but NOT working on 37.0.2062.94 m.

I've also created a ticket in chromium tracker here.

  • It looks like deleting the array element doesn't remove the `getter` for that element. – Barmar Aug 29 '14 at 09:46
  • @Qantas94Heavy I reproduced it. – Barmar Aug 29 '14 at 09:46
  • Does it need the loop? Can you please reduce the offending code to a minimal example (`defineProperty`+`delete`+`assignment`+`empting`+`length checking` or so, not `watch` and `clear` and `fill` methods), and post that into your question? – Bergi Aug 29 '14 at 11:17
  • @Bergi yes, it need the loop. fill, clear, fill again. – gregory kazman Aug 29 '14 at 11:35
  • have you tried to override it ? like arr = new array(); – Dwza Aug 29 '14 at 11:53
  • @Dwza no, it's bad, i need old link to array. When call arr = [], it just create new array in current scope. but other scopes, where arr using have old links to array. i think this is problem with memory of Chromium, but maybe i'm not right. – gregory kazman Aug 29 '14 at 13:19
  • **UPDATE** I also thought about `Object.observe` method in the latest Chrome, and made a wrapper for my problem see update [here](http://jsfiddle.net/h1mj6729/12/) – gregory kazman Sep 01 '14 at 10:45

0 Answers0