Add switchElementsAlt() to the default switches

Fixes #83.
This commit is contained in:
Behind The Math
2017-12-19 15:56:48 -05:00
parent a7b584c469
commit 0781f820ee
2 changed files with 18 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
/* global _gaq: true, ga: true */
var defaultSwitches = require("../switches")
module.exports = function(options){
this.options = options
this.options.elements = this.options.elements || "a[href], form[action]"
@@ -27,10 +29,10 @@ module.exports = function(options){
// if you set head.outerHTML, a new body tag is appended, so the dom get 2 body
// & it break the switchFallback which replace head & body
if (!this.options.switches.head) {
this.options.switches.head = this.switchElementsAlt
this.options.switches.head = defaultSwitches.switchElementsAlt
}
if (!this.options.switches.body) {
this.options.switches.body = this.switchElementsAlt
this.options.switches.body = defaultSwitches.switchElementsAlt
}
if (typeof options.analytics !== "function") {
options.analytics = function() {}