commit 0f542ed24f07af918057d28a9cdd508920bc5bec
parent 2adcf93362fa055872b57009aeeeaae49493c323
Author: Sheng <webmaster0115@gmail.com>
Date: Sat, 29 Sep 2018 13:24:41 +0800
Use private variable data instead of proto.data
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js
@@ -6,12 +6,12 @@ var wssh = {};
(function() {
// For FormData without getter and setter
- var proto = FormData.prototype;
- proto.data = {};
+ var proto = FormData.prototype,
+ data = {};
if (!proto.get) {
proto.get = function (name) {
- if (!proto.data[name]) {
+ if (data[name] === undefined) {
var input = document.querySelector('input[name="' + name + '"]'),
value;
if (input) {
@@ -20,16 +20,16 @@ var wssh = {};
} else {
value = input.value;
}
- proto.data[name] = value;
+ data[name] = value;
}
}
- return proto.data[name];
+ return data[name];
};
}
if (!proto.set) {
proto.set = function (name, value) {
- proto.data[name] = value;
+ data[name] = value;
};
}
}());