Skip to content

Commit f704765

Browse files
committed
Merge branch 'release/2.5.3'
2 parents 43c941c + ccab465 commit f704765

File tree

16 files changed

+202
-69
lines changed

16 files changed

+202
-69
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
node_js:
2-
- "0.10"
2+
- "4.1.2"
33
script: node node_modules/intern/runner.js config=tests/intern
44
language: node_js
55
install:

CHANGELOG

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Version 2.5.3 (2015-11-10)
2+
--------------------------
3+
Bumped Node version to 4.1.2 in .travis.yml (#420)
4+
Bumped Intern version to 3.0.6 (#370)
5+
Bumped version of temporary to 0.0.8 (#425)
6+
Bumped grunt-yui-compressor to 0.4.0 (#424)
7+
Bumped grunt-browserify to 3.28.1 (#427)
8+
Fixed jstimezonedetect version at 1.0.5 (#429)
9+
Removed Browserify from devDependencies (#428)
10+
Made extraction of DOM element classes compatible with IE9 (#418)
11+
Stopped dereferencing undefined nodes when setting up form tracking (#423)
12+
113
Version 2.5.2 (2015-08-13)
214
--------------------------
315
Prevented the tracker from setting cookies on initialization if "useCookies" is disabled (#403)

examples/ads/async.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
3838
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
3939
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
4040
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
41-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.2/sp.js","adTracker"));
41+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.3/sp.js","adTracker"));
4242

4343
window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
4444
'encodeBase64': false
@@ -110,7 +110,7 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
110110
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
111111
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
112112
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
113-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.2/sp.js","adTracker"));
113+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.3/sp.js","adTracker"));
114114

115115
window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
116116
'encodeBase64': false
@@ -141,7 +141,7 @@ <h1>Asynchronous ad tracking examples for snowplow.js</h1>
141141
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
142142
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
143143
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
144-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.2/sp.js","adTracker"));
144+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.3/sp.js","adTracker"));
145145

146146
window.adTracker('newTracker', rnd, 'd3rkrsqld9gmqf.cloudfront.net', {
147147
'encodeBase64': false

examples/web/async-large.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
2424
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
2525
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
26-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.2/sp.js","snowplow_1"));
26+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.3/sp.js","snowplow_1"));
2727

2828
window.snowplow_1('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
2929
encodeBase64: false, // Default is true
@@ -83,7 +83,7 @@
8383
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
8484
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
8585
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
86-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.2/sp.js","snowplow_2"));
86+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.3/sp.js","snowplow_2"));
8787

8888
window.snowplow_2('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
8989
encodeBase64: false, // Default is true

examples/web/async-medium.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
2525
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
2626
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
27-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.2/sp.js","new_name_here"));
27+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.3/sp.js","new_name_here"));
2828

2929
window.new_name_here('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', {
3030
encodeBase64: false,

examples/web/async-small.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
2424
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
2525
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
26-
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.2/sp.js","snowplow"));
26+
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.3/sp.js","snowplow"));
2727

2828
window.snowplow('newTracker', 'cf', 'd3rkrsqld9gmqf.cloudfront.net', { // Initialise a tracker
2929
encodeBase64: false, // Default is true

examples/web/sync.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<!-- Snowplow starts plowing -->
2121
<script type="text/javascript">
22-
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/2.5.2/sp.js';
22+
var spSrc = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/2.5.3/sp.js';
2323
document.write(unescape("%3Cscript src='" + spSrc + "' type='text/javascript'%3E%3C/script%3E"));
2424
</script>
2525
<script type="text/javascript">

npm-shrinkwrap.json

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
{
22
"name": "snowplow-tracker",
3-
"version": "2.5.2",
3+
"version": "2.5.3",
44
"devDependencies": {
55
"JSON": "~1.0.0",
66
"browser-cookie-lite": "~0.3.1",
7-
"browserify": "~3.28.1",
87
"grunt": "~0.4.2",
9-
"grunt-browserify": "~1.3.0",
8+
"grunt-browserify": "~4.0.1",
109
"grunt-cloudfront": "^0.2.0",
1110
"grunt-contrib-concat": "~0.3.0",
1211
"grunt-lodash": "~0.3.0",
1312
"grunt-s3": "~0.2.0-alpha.3",
14-
"grunt-yui-compressor": "git://github.com/snowplow/grunt-yui-compressor.git#feature/issue-8",
15-
"intern": "~1.5.0",
16-
"jstimezonedetect": "~1.0.5",
13+
"grunt-yui-compressor": "git://github.com/snowplow/grunt-yui-compressor.git#0.4.0",
14+
"intern": "^3.0.6",
15+
"jstimezonedetect": "1.0.5",
1716
"lodash": "^3.1.0",
1817
"lodash-cli": "^2.4.2",
1918
"murmurhash": "0.0.2",

src/js/forms.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ object.getFormTrackingManager = function (core, trackerId, contextAdder) {
7474
* Identifies the parent form in which an element is contained
7575
*/
7676
function getParentFormName(elt) {
77-
while (elt && elt.nodeName.toUpperCase() !== 'HTML' && elt.nodeName.toUpperCase() !== 'FORM') {
77+
while (elt && elt.nodeName && elt.nodeName.toUpperCase() !== 'HTML' && elt.nodeName.toUpperCase() !== 'FORM') {
7878
elt = elt.parentNode;
7979
}
80-
if (elt.nodeName.toUpperCase() === 'FORM') {
80+
if (elt && elt.nodeName && elt.nodeName.toUpperCase() === 'FORM') {
8181
return getFormElementName(elt);
8282
}
8383
}
@@ -122,9 +122,9 @@ object.getFormTrackingManager = function (core, trackerId, contextAdder) {
122122
function getFormChangeListener(context) {
123123
return function (e) {
124124
var elt = e.target;
125-
var type = elt.nodeName.toUpperCase() === 'INPUT' ? elt.type : null;
125+
var type = (elt.nodeName && elt.nodeName.toUpperCase() === 'INPUT') ? elt.type : null;
126126
var value = (elt.type === 'checkbox' && !elt.checked) ? null : elt.value;
127-
core.trackFormChange(getParentFormName(elt), getFormElementName(elt), elt.nodeName, type, lodash.map(elt.classList), value, contextAdder(context));
127+
core.trackFormChange(getParentFormName(elt), getFormElementName(elt), elt.nodeName, type, helpers.getCssClasses(elt), value, contextAdder(context));
128128
};
129129
}
130130

@@ -135,7 +135,7 @@ object.getFormTrackingManager = function (core, trackerId, contextAdder) {
135135
return function (e) {
136136
var elt = e.target;
137137
var innerElements = getInnerFormElements(elt);
138-
core.trackFormSubmission(getFormElementName(elt), lodash.map(elt.classList), innerElements, contextAdder(context));
138+
core.trackFormSubmission(getFormElementName(elt), helpers.getCssClasses(elt), innerElements, contextAdder(context));
139139
};
140140
}
141141

src/js/lib/helpers.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,18 @@
158158
}
159159
};
160160

161+
/**
162+
* List the classes of a DOM element without using elt.classList (for compatibility with IE 9)
163+
*/
164+
object.getCssClasses = function (elt) {
165+
return elt.className.match(/\S+/g);
166+
};
167+
161168
/*
162169
* Check whether an element has at least one class from a given list
163170
*/
164171
function checkClass(elt, classList) {
165-
var classes = lodash.map(elt.classList),
172+
var classes = object.getCssClasses(elt),
166173
i;
167174

168175
for (i = 0; i < classes.length; i++) {

src/js/links.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ object.getLinkTrackingManager = function (core, trackerId, contextAdder) {
9191
if (!scriptProtocol.test(sourceHref)) {
9292

9393
elementId = sourceElement.id;
94-
elementClasses = lodash.map(sourceElement.classList);
94+
elementClasses = helpers.getCssClasses(sourceElement);
9595
elementTarget = sourceElement.target;
9696
elementContent = linkTrackingContent ? sourceElement.innerHTML : null;
9797

@@ -155,7 +155,7 @@ object.getLinkTrackingManager = function (core, trackerId, contextAdder) {
155155
* Used to determine whether clicks on that link should be tracked
156156
*/
157157
function checkLink(linkElement, specifiedClasses) {
158-
var linkClasses = lodash.map(linkElement.classList),
158+
var linkClasses = helpers.getCssClasses(linkElement),
159159
i;
160160

161161
for (i = 0; i < linkClasses.length; i++) {

0 commit comments

Comments
 (0)