I've written this code in Firefox JS extension
var results = gBrowser.contentDocument.getElementsByClassName("b-serp-item__title-link");
alert(results.length);
var countToDelete = results.length - 10;
alert(countToDelete);
if (countToDelete > 0)
{
for (var i = 0; i < countToDelete; i++);
{
alert("I prepare");
results.shift();
alert("I done");
}
}
alert("succ");
And I've got this output
results.length=12 countToDelete=2 (I prepare)
and... that's all There is a problem at results.shift(); I looked in Firefox Error Console and I found this
"results.shift is not a function"
Why? Is shift a js function? When I try to run this code in firefox console I've got this error again
What's the matter?
My version of Firefox is 4. Tested url is http://yandex.ru/yandsearch?text=%D0%BE%D0%B1%D0%BE%D0%B9%D0%BD%D1%8B%D0%B9+%D0%BA%D0%BB%D0%B5%D0%B9+%D0%BA%D1%83%D0%BF%D0%B8%D1%82%D1%8C&lr=37