Write a contains function in javascript
Utilisateur anonyme
HTMLElement.prototype.contains = HTMLElement.prototype.contains || function(child) { var children; var i; var node; if (this == child) { return true; } if (this.hasChildNodes) { for (i = 0, children = this.childNodes; i < children.length; i++) { node = children[i]; // skip for text nodes if (node.nodeType === 1 && (node == child || node.contains(child))) { return true; } } } return false; };