Code style cleanup, remove redundant comments
This commit is contained in:
25
index.js
25
index.js
@@ -1,19 +1,14 @@
|
||||
var clone = require("./lib/clone.js")
|
||||
var executeScripts = require("./lib/execute-scripts.js")
|
||||
|
||||
var forEachEls = require("./lib/foreach-els.js")
|
||||
|
||||
var switches = require("./lib/switches")
|
||||
var newUid = require("./lib/uniqueid.js")
|
||||
|
||||
var noop = require("./lib/util/noop")
|
||||
var contains = require("./lib/util/contains.js")
|
||||
|
||||
var on = require("./lib/events/on.js")
|
||||
// var off = require("./lib/events/on.js")
|
||||
var trigger = require("./lib/events/trigger.js")
|
||||
|
||||
var defaultSwitches = require("./lib/switches")
|
||||
|
||||
var contains = require("./lib/util/contains.js")
|
||||
var noop = require("./lib/util/noop")
|
||||
|
||||
var Pjax = function(options) {
|
||||
this.state = {
|
||||
@@ -22,7 +17,7 @@ var Pjax = function(options) {
|
||||
options: null
|
||||
}
|
||||
|
||||
var parseOptions = require("./lib/proto/parse-options.js");
|
||||
var parseOptions = require("./lib/proto/parse-options.js")
|
||||
parseOptions.call(this,options)
|
||||
this.log("Pjax options", this.options)
|
||||
|
||||
@@ -40,7 +35,7 @@ var Pjax = function(options) {
|
||||
opt.url = st.state.url
|
||||
opt.title = st.state.title
|
||||
opt.history = false
|
||||
opt.requestOptions = {};
|
||||
opt.requestOptions = {}
|
||||
opt.scrollPos = st.state.scrollPos
|
||||
if (st.state.uid < this.lastUid) {
|
||||
opt.backward = true
|
||||
@@ -56,7 +51,7 @@ var Pjax = function(options) {
|
||||
}.bind(this))
|
||||
}
|
||||
|
||||
Pjax.switches = defaultSwitches
|
||||
Pjax.switches = switches
|
||||
|
||||
Pjax.prototype = {
|
||||
log: require("./lib/proto/log.js"),
|
||||
@@ -143,7 +138,7 @@ Pjax.prototype = {
|
||||
// Abort any previous request
|
||||
this.abortRequest(this.request)
|
||||
|
||||
trigger(document, "pjax:send", options);
|
||||
trigger(document, "pjax:send", options)
|
||||
|
||||
// Do the request
|
||||
options.requestOptions.timeout = this.options.timeout
|
||||
@@ -217,7 +212,7 @@ Pjax.prototype = {
|
||||
// http://www.w3.org/html/wg/drafts/html/master/forms.html
|
||||
var autofocusEl = Array.prototype.slice.call(document.querySelectorAll("[autofocus]")).pop()
|
||||
if (autofocusEl && document.activeElement !== autofocusEl) {
|
||||
autofocusEl.focus();
|
||||
autofocusEl.focus()
|
||||
}
|
||||
|
||||
// execute scripts when DOM have been completely updated
|
||||
@@ -285,7 +280,7 @@ Pjax.prototype = {
|
||||
} while (target)
|
||||
}
|
||||
}
|
||||
window.scrollTo(0, curtop);
|
||||
window.scrollTo(0, curtop)
|
||||
}
|
||||
else if (state.options.scrollTo !== false) {
|
||||
// Scroll page to top on new page load
|
||||
@@ -309,7 +304,7 @@ Pjax.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
Pjax.isSupported = require("./lib/is-supported.js");
|
||||
Pjax.isSupported = require("./lib/is-supported.js")
|
||||
|
||||
// arguably could do `if( require("./lib/is-supported.js")()) {` but that might be a little to simple
|
||||
if (Pjax.isSupported()) {
|
||||
|
||||
Reference in New Issue
Block a user