Code cleanup
This commit is contained in:
committed by
Robin North
parent
57aed828ac
commit
6fb509a021
@@ -1,5 +1,5 @@
|
||||
module.exports = function(obj) {
|
||||
if (null === obj || "object" != typeof obj) {
|
||||
if (null === obj || "object" !== typeof obj) {
|
||||
return obj
|
||||
}
|
||||
var copy = obj.constructor()
|
||||
|
||||
@@ -13,12 +13,12 @@ module.exports = function(el) {
|
||||
|
||||
script.type = "text/javascript"
|
||||
|
||||
if (src != "") {
|
||||
if (src !== "") {
|
||||
script.src = src;
|
||||
script.async = false; // force synchronous loading of peripheral js
|
||||
}
|
||||
|
||||
if (code != "") {
|
||||
if (code !== "") {
|
||||
try {
|
||||
script.appendChild(document.createTextNode(code))
|
||||
}
|
||||
@@ -31,7 +31,7 @@ module.exports = function(el) {
|
||||
// execute
|
||||
parent.appendChild(script);
|
||||
// avoid pollution only in head or body tags
|
||||
if (["head","body"].indexOf(parent.tagName.toLowerCase()) > 0) {
|
||||
if (["head", "body"].indexOf(parent.tagName.toLowerCase()) > 0) {
|
||||
parent.removeChild(script)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ var formAction = function(el, event) {
|
||||
// Initialize requestOptions
|
||||
options.requestOptions = {
|
||||
requestUrl: el.getAttribute("action") || window.location.href,
|
||||
requestMethod: el.getAttribute("method") || "GET",
|
||||
requestMethod: el.getAttribute("method") || "GET"
|
||||
}
|
||||
|
||||
// create a testable virtual link of the form action
|
||||
@@ -93,7 +93,7 @@ module.exports = function(el) {
|
||||
}
|
||||
|
||||
|
||||
if (event.keyCode == 13) {
|
||||
if (event.keyCode === 13) {
|
||||
formAction.call(that, el, event)
|
||||
}
|
||||
}.bind(this))
|
||||
|
||||
@@ -91,7 +91,7 @@ module.exports = function(el) {
|
||||
return
|
||||
}
|
||||
|
||||
if (event.keyCode == 13) {
|
||||
if (event.keyCode === 13) {
|
||||
linkAction.call(that, el, event)
|
||||
}
|
||||
}.bind(this))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
var defaultSwitches = require("../switches")
|
||||
|
||||
module.exports = function(options) {
|
||||
options = options || {}
|
||||
options.elements = options.elements || "a[href], form[action]"
|
||||
options.selectors = options.selectors || ["title", ".js-Pjax"]
|
||||
options.switches = options.switches || {}
|
||||
|
||||
@@ -35,7 +35,7 @@ module.exports = function(location, options, callback) {
|
||||
request.setRequestHeader("X-PJAX", "true")
|
||||
|
||||
// Add the request payload if available
|
||||
if (options.requestPayloadString != undefined && options.requestPayloadString != "") {
|
||||
if (options.requestPayloadString !== undefined && options.requestPayloadString !== "") {
|
||||
// Send the proper header information along with the request
|
||||
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ module.exports = {
|
||||
var animationEventNames = "animationend webkitAnimationEnd MSAnimationEnd oanimationend"
|
||||
var animatedElsNumber = 0
|
||||
var sexyAnimationEnd = function(e) {
|
||||
if (e.target != e.currentTarget) {
|
||||
if (e.target !== e.currentTarget) {
|
||||
// end triggered by an animation on a child
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user