HTMLElement.prototype.contains = function (oEl) { if (oEl == this) return true; if (oEl == null) return false; return this.contains(oEl.parentNode); HTMLElement.prototype.__defineGetter__("parentElement", function () { if (this.parentNode == this.ownerDocument) return null; return this.parentNode; });