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({