[pve-devel] [PATCH manager 06/10] jslint: fix _ prefix and 'for in' over an object

Dominik Csapak d.csapak at proxmox.com
Fri Apr 29 12:06:31 CEST 2016


jslint does not like names that begin with _

also it complains when you do not filter
a for in statement with a hasOwnProperty(property) as first
if statement

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Toolkit.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/www/manager6/Toolkit.js b/www/manager6/Toolkit.js
index f05f68b..85f1ed5 100644
--- a/www/manager6/Toolkit.js
+++ b/www/manager6/Toolkit.js
@@ -239,10 +239,12 @@ Ext.define('Ext.ux.IFrame', {
             try {
                 doc = this.getDoc();
                 if (doc) {
+		    /*jslint nomen: true*/
                     Ext.get(doc).un(this._docListeners);
-                    if (destroying) {
+		    /*jslint nomen: false*/
+                    if (destroying && doc.hasOwnProperty) {
                         for (prop in doc) {
-                            if (doc.hasOwnProperty && doc.hasOwnProperty(prop)) {
+                            if (doc.hasOwnProperty(prop)) {
                                 delete doc[prop];
                             }
                         }
@@ -264,6 +266,7 @@ Ext.define('Ext.ux.IFrame', {
                 // the event reaches listeners on elements like the document body. The effected
                 // mechanisms that depend on this bubbling behavior are listed to the right
                 // of the event.
+		/*jslint nomen: true*/
                 Ext.get(doc).on(
                     me._docListeners = {
                         mousedown: fn, // menu dismisal (MenuManager) and Window onMouseDown (toFront)
@@ -274,6 +277,7 @@ Ext.define('Ext.ux.IFrame', {
                         scope: me
                     }
                 );
+		/*jslint nomen: false*/
             } catch(e) {
                 // cannot do this xss
             }
-- 
2.1.4





More information about the pve-devel mailing list