Browse Source

Enable `forin` and `freeze` rules.

pull/379/head
XhmikosR 11 years ago
parent
commit
df5aa2c722
  1. 2
      js/.jshintrc
  2. 32
      js/push.js

2
js/.jshintrc

@ -7,6 +7,8 @@
"eqeqeq" : true, "eqeqeq" : true,
"eqnull" : true, "eqnull" : true,
"expr" : true, "expr" : true,
"forin" : true,
"freeze" : true,
"indent" : 2, "indent" : 2,
"laxbreak" : true, "laxbreak" : true,
"nonbsp" : true, "nonbsp" : true,

32
js/push.js

@ -177,11 +177,13 @@
if (transitionFromObj.transition) { if (transitionFromObj.transition) {
activeObj = extendWithDom(activeObj, '.content', activeDom.cloneNode(true)); activeObj = extendWithDom(activeObj, '.content', activeDom.cloneNode(true));
for (key in bars) { for (key in bars) {
barElement = document.querySelector(bars[key]); if (bars.hasOwnProperty(key)) {
if (activeObj[key]) { barElement = document.querySelector(bars[key]);
swapContent(activeObj[key], barElement); if (activeObj[key]) {
} else if (barElement) { swapContent(activeObj[key], barElement);
barElement.parentNode.removeChild(barElement); } else if (barElement) {
barElement.parentNode.removeChild(barElement);
}
} }
} }
} }
@ -208,7 +210,9 @@
options.container = options.container || options.transition ? document.querySelector('.content') : document.body; options.container = options.container || options.transition ? document.querySelector('.content') : document.body;
for (key in bars) { for (key in bars) {
options[key] = options[key] || document.querySelector(bars[key]); if (bars.hasOwnProperty(key)) {
options[key] = options[key] || document.querySelector(bars[key]);
}
} }
if (xhr && xhr.readyState < 4) { if (xhr && xhr.readyState < 4) {
@ -269,11 +273,13 @@
if (options.transition) { if (options.transition) {
for (key in bars) { for (key in bars) {
barElement = document.querySelector(bars[key]); if (bars.hasOwnProperty(key)) {
if (data[key]) { barElement = document.querySelector(bars[key]);
swapContent(data[key], barElement); if (data[key]) {
} else if (barElement) { swapContent(data[key], barElement);
barElement.parentNode.removeChild(barElement); } else if (barElement) {
barElement.parentNode.removeChild(barElement);
}
} }
} }
} }
@ -408,7 +414,9 @@
var result = {}; var result = {};
for (i in obj) { for (i in obj) {
result[i] = obj[i]; if (obj.hasOwnProperty(i)) {
result[i] = obj[i];
}
} }
Object.keys(bars).forEach(function (key) { Object.keys(bars).forEach(function (key) {

Loading…
Cancel
Save