From 1bfbe3afe9cc346ad7eed83f4db70481690e4eb3 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 20 Apr 2012 14:37:53 +0000 Subject: [PATCH] Monotone-Parent: ac0d12f89b420e5f1e825cebddb440417e76ce4b Monotone-Revision: 015d6494690201ec056395687392e68803e04210 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-04-20T14:37:53 --- ChangeLog | 3 +++ UI/WebServerResources/HTMLElement.js | 26 +++++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index a683825f2..020963b59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2012-04-20 Wolfgang Sourdeau + * UI/WebServerResources/HTMLElement.js: enhanced both + HTMLCollection and NodeList with the "Enumerable" interface. + * UI/WebServerResources/UIxPreferences.js (displayMailAccount): disable the "fullName" and "email" input fields of the first account only when SOGoMailCustomFromEnabled is NO. diff --git a/UI/WebServerResources/HTMLElement.js b/UI/WebServerResources/HTMLElement.js index 518657123..f7c873b9f 100644 --- a/UI/WebServerResources/HTMLElement.js +++ b/UI/WebServerResources/HTMLElement.js @@ -1,17 +1,21 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: js-mode; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -if (NodeList) { - var _each = NodeList.prototype.forEach; - if (!_each) { - _each = function NodeList_each(iterator, context) { - for (var i = 0, length = this.length >>> 0; i < length; i++) { - if (i in this) iterator.call(context, this[i], i, this); +[HTMLCollection, NodeList].each( + function (contClass) { + if (contClass) { + var _each = contClass.prototype.forEach; + if (!_each) { + _each = function HTMLElement_each(iterator, context) { + for (var i = 0, length = this.length >>> 0; i < length; i++) { + if (i in this) iterator.call(context, this[i], i, this); + } + }; } - }; + contClass.prototype._each = _each; + Object.extend(contClass.prototype, Enumerable); + } } - NodeList.prototype._each = _each; - Object.extend(NodeList.prototype, Enumerable); -} +); /* custom extensions to the DOM api */ Element.addMethods({