// on définit le "indexOf" pour et NodeList.prototype.indexOf = HTMLCollection.prototype.indexOf = function(searchedElement){ for( var i = 0 ; i < this.length ; i++ ) // on parcours la collection // si on trouve l'élement, on retourne son rang if( this[i] == searchedElement ) return i; // si on a rien trouvé, on retourne -1 return -1; };