[Pkg-mozext-commits] [requestpolicy] 155/257: [ref] DOMUtils: switch to Module Pattern

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit e6011b565d9a10d19eed37bed4cb0b48c31150c6
Author: Martin Kimmerle <dev at 256k.de>
Date:   Mon Nov 30 23:26:47 2015 +0100

    [ref] DOMUtils: switch to Module Pattern
---
 src/content/lib/utils/dom.jsm | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/content/lib/utils/dom.jsm b/src/content/lib/utils/dom.jsm
index d0919ba..283859c 100644
--- a/src/content/lib/utils/dom.jsm
+++ b/src/content/lib/utils/dom.jsm
@@ -29,22 +29,26 @@ Cu.import("resource://gre/modules/Services.jsm");
 
 let EXPORTED_SYMBOLS = ["DOMUtils"];
 
-var DOMUtils = {};
+var DOMUtils = (function () {
+  let self = {};
 
-/**
- * Function that takes a DOM Element or an Array of DOM elements and removes
- * all their children.
- */
-DOMUtils.removeChildren = function(aElements) {
-  // If aElements is not an Array, put the element in an Array.
-  let elements = Array.isArray(aElements) ? aElements : [aElements];
-  // Note on `isArray` (above):
-  //     using `instanceof` did not work. For details see
-  //     https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
+  /**
+   * Function that takes a DOM Element or an Array of DOM elements and removes
+   * all their children.
+   */
+  self.removeChildren = function (aElements) {
+    // If aElements is not an Array, put the element in an Array.
+    let elements = Array.isArray(aElements) ? aElements : [aElements];
+    // Note on `isArray` (above):
+    //     using `instanceof` did not work. For details see
+    //     https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
 
-  for (let el of elements) {
-    while (el.firstChild) {
-      el.removeChild(el.firstChild);
+    for (let el of elements) {
+      while (el.firstChild) {
+        el.removeChild(el.firstChild);
+      }
     }
-  }
-};
+  };
+
+  return self;
+}());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list