Question d’entretien chez Netflix

Enhance the contains function to make it part of the JavaScript system (e.g. HTMLElement.prototype).

Réponse à la question d'entretien

Utilisateur anonyme

14 mars 2012

HTMLElement.prototype.contains = function contains(b) { while ((this != b) && (b != null)) { b = b.getParent(); } return (this == b); }