Cleanup & travis (should break)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
/* global HTMLCollection: true */
|
||||
|
||||
module.exports = function(els, fn, context) {
|
||||
if (els instanceof HTMLCollection || els instanceof NodeList || els instanceof Array) {
|
||||
return Array.prototype.forEach.call(els, fn, context)
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function (oThis) {
|
||||
Function.prototype.bind = function(oThis) {
|
||||
if (typeof this !== "function") {
|
||||
// closest thing possible to the ECMAScript 5 internal IsCallable function
|
||||
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable")
|
||||
}
|
||||
|
||||
var aArgs = Array.prototype.slice.call(arguments, 1)
|
||||
var fToBind = this
|
||||
var fNOP = function () {}
|
||||
var fBound = function () {
|
||||
return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)))
|
||||
var that = this
|
||||
var Fnoop = function() {}
|
||||
var fBound = function() {
|
||||
return that.apply(this instanceof Fnoop && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)))
|
||||
}
|
||||
|
||||
fNOP.prototype = this.prototype
|
||||
fBound.prototype = new fNOP()
|
||||
Fnoop.prototype = this.prototype
|
||||
fBound.prototype = new Fnoop()
|
||||
|
||||
return fBound
|
||||
}
|
||||
|
||||
@@ -54,23 +54,21 @@ var linkAction = function(el, event) {
|
||||
}
|
||||
|
||||
module.exports = function(el) {
|
||||
var instance = this
|
||||
var that = this
|
||||
|
||||
on(el, "click", function(event) {
|
||||
linkAction.call(instance, el, event)
|
||||
linkAction.call(that, el, event)
|
||||
})
|
||||
|
||||
on(el, "keyup", function(event) {
|
||||
|
||||
// Don’t break browser special behavior on links (like page in new window)
|
||||
if (event.which > 1 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
||||
el.setAttribute(attrKey, "modifier")
|
||||
return
|
||||
}
|
||||
|
||||
if(event.keyCode == 13) {
|
||||
linkAction.call(instance, el, event)
|
||||
if (event.keyCode == 13) {
|
||||
linkAction.call(that, el, event)
|
||||
}
|
||||
|
||||
}.bind(this))
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ var forEachEls = require("../foreach-els")
|
||||
var parseElement = require("../parse-element")
|
||||
|
||||
module.exports = function(el) {
|
||||
forEachEls(this.getElements(el), parseElement }, this)
|
||||
forEachEls(this.getElements(el), parseElement, this)
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = function(location, callback) {
|
||||
}
|
||||
}
|
||||
|
||||
request.open("GET", location + (!/[?&]/.test(location) ? "?": "&") + (new Date().getTime()), true)
|
||||
request.open("GET", location + (!/[?&]/.test(location) ? "?" : "&") + (new Date().getTime()), true)
|
||||
request.setRequestHeader("X-Requested-With", "XMLHttpRequest")
|
||||
request.send(null)
|
||||
return request
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
var on = require("./lib/events/on.js")
|
||||
// var off = require("./lib/events/on.js")
|
||||
// var trigger = require("./lib/events/trigger.js")
|
||||
|
||||
|
||||
module.exports = {
|
||||
outerHTML: function(oldEl, newEl, options) {
|
||||
outerHTML: function(oldEl, newEl) {
|
||||
oldEl.outerHTML = newEl.outerHTML
|
||||
this.onSwitch()
|
||||
},
|
||||
|
||||
innerHTML: function(oldEl, newEl, options) {
|
||||
innerHTML: function(oldEl, newEl) {
|
||||
oldEl.innerHTML = newEl.innerHTML
|
||||
oldEl.className = newEl.className
|
||||
this.onSwitch()
|
||||
@@ -17,7 +22,7 @@ module.exports = {
|
||||
var fragToAppend = document.createDocumentFragment()
|
||||
// height transition are shitty on safari
|
||||
// so commented for now (until I found something ?)
|
||||
//var relevantHeight = 0
|
||||
// var relevantHeight = 0
|
||||
var animationEventNames = "animationend webkitAnimationEnd MSAnimationEnd oanimationend"
|
||||
var animatedElsNumber = 0
|
||||
var sexyAnimationEnd = function(e) {
|
||||
@@ -50,7 +55,7 @@ module.exports = {
|
||||
|
||||
// this is to trigger some repaint (example: picturefill)
|
||||
this.onSwitch()
|
||||
//Pjax.trigger(window, "scroll")
|
||||
// Pjax.trigger(window, "scroll")
|
||||
}
|
||||
}.bind(this)
|
||||
|
||||
@@ -79,7 +84,7 @@ module.exports = {
|
||||
el.className += " " + switchOptions.classNames.remove + " " + (options.backward ? switchOptions.classNames.backward : switchOptions.classNames.forward)
|
||||
}
|
||||
animatedElsNumber++
|
||||
Pjax.on(el, animationEventNames, sexyAnimationEnd, true)
|
||||
on(el, animationEventNames, sexyAnimationEnd, true)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -97,7 +102,7 @@ module.exports = {
|
||||
elsToAdd.push(el)
|
||||
fragToAppend.appendChild(el)
|
||||
animatedElsNumber++
|
||||
Pjax.on(el, animationEventNames, sexyAnimationEnd, true)
|
||||
on(el, animationEventNames, sexyAnimationEnd, true)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user