perf-ui.js (lodash-4.0.0) | : | perf-ui.js (lodash-4.17.21) | ||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURICompon ent(build[1]); | var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURICompon ent(build[1]); | |||
/** The other library to load. */ | /** The other library to load. */ | |||
var other = (other = /other=([^&]+)/.exec(location.search)) && decodeURICompon ent(other[1]); | var other = (other = /other=([^&]+)/.exec(location.search)) && decodeURICompon ent(other[1]); | |||
/** The `ui` object. */ | /** The `ui` object. */ | |||
var ui = {}; | var ui = {}; | |||
/*--------------------------------------------------------------------------*/ | /*--------------------------------------------------------------------------*/ | |||
/** | ||||
* Registers an event listener on an element. | ||||
* | ||||
* @private | ||||
* @param {Element} element The element. | ||||
* @param {string} eventName The name of the event. | ||||
* @param {Function} handler The event handler. | ||||
* @returns {Element} The element. | ||||
*/ | ||||
function addListener(element, eventName, handler) { | ||||
if (typeof element.addEventListener != 'undefined') { | ||||
element.addEventListener(eventName, handler, false); | ||||
} else if (typeof element.attachEvent != 'undefined') { | ||||
element.attachEvent('on' + eventName, handler); | ||||
} | ||||
} | ||||
/*--------------------------------------------------------------------------*/ | ||||
// Initialize controls. | // Initialize controls. | |||
addListener(window, 'load', function() { | addEventListener('load', function() { | |||
function eventHandler(event) { | function eventHandler(event) { | |||
var buildIndex = buildList.selectedIndex, | var buildIndex = buildList.selectedIndex, | |||
otherIndex = otherList.selectedIndex, | otherIndex = otherList.selectedIndex, | |||
search = location.search.replace(/^\?|&?(?:build|other)=[^&]*&?/g, '') ; | search = location.search.replace(/^\?|&?(?:build|other)=[^&]*&?/g, '') ; | |||
if (event.stopPropagation) { | if (event.stopPropagation) { | |||
event.stopPropagation(); | event.stopPropagation(); | |||
} else { | } else { | |||
event.cancelBubble = true; | event.cancelBubble = true; | |||
} | } | |||
skipping to change at line 61 | skipping to change at line 42 | |||
(search ? search + '&' : '') + | (search ? search + '&' : '') + | |||
'build=' + (buildIndex < 0 ? build : buildList[buildIndex].value) + '&' + | 'build=' + (buildIndex < 0 ? build : buildList[buildIndex].value) + '&' + | |||
'other=' + (otherIndex < 0 ? other : otherList[otherIndex].value); | 'other=' + (otherIndex < 0 ? other : otherList[otherIndex].value); | |||
} | } | |||
var span1 = document.createElement('span'); | var span1 = document.createElement('span'); | |||
span1.style.cssText = 'float:right'; | span1.style.cssText = 'float:right'; | |||
span1.innerHTML = | span1.innerHTML = | |||
'<label for="perf-build">Build: </label>' + | '<label for="perf-build">Build: </label>' + | |||
'<select id="perf-build">' + | '<select id="perf-build">' + | |||
'<option value="lodash">lodash</option>' + | '<option value="lodash">lodash (production)</option>' + | |||
'</select>'; | '</select>'; | |||
var span2 = document.createElement('span'); | var span2 = document.createElement('span'); | |||
span2.style.cssText = 'float:right'; | span2.style.cssText = 'float:right'; | |||
span2.innerHTML = | span2.innerHTML = | |||
'<label for="perf-other">Other Library: </label>' + | '<label for="perf-other">Other Library: </label>' + | |||
'<select id="perf-other">' + | '<select id="perf-other">' + | |||
'<option value="underscore-dev">Underscore (development)</option>' + | '<option value="underscore-dev">Underscore (development)</option>' + | |||
'<option value="underscore">Underscore (production)</option>' + | '<option value="underscore">Underscore (production)</option>' + | |||
'<option value="lodash">lodash</option>' + | '<option value="lodash">lodash</option>' + | |||
skipping to change at line 99 | skipping to change at line 80 | |||
otherList.selectedIndex = (function() { | otherList.selectedIndex = (function() { | |||
switch (other) { | switch (other) { | |||
case 'underscore-dev': return 0; | case 'underscore-dev': return 0; | |||
case 'lodash': return 2; | case 'lodash': return 2; | |||
case 'underscore': | case 'underscore': | |||
case null: return 1; | case null: return 1; | |||
} | } | |||
return -1; | return -1; | |||
}()); | }()); | |||
addListener(buildList, 'change', eventHandler); | buildList.addEventListener('change', eventHandler); | |||
addListener(otherList, 'change', eventHandler); | otherList.addEventListener('change', eventHandler); | |||
}); | }); | |||
// The lodash build file path. | // The lodash build file path. | |||
ui.buildPath = (function() { | ui.buildPath = (function() { | |||
var result; | var result; | |||
switch (build) { | switch (build) { | |||
case null: build = 'lodash'; | case null: build = 'lodash'; | |||
case 'lodash': result = 'dist/lodash.min.js'; break; | case 'lodash': result = 'dist/lodash.min.js'; break; | |||
default: return build; | default: return build; | |||
} | } | |||
End of changes. 4 change blocks. | ||||
23 lines changed or deleted | 4 lines changed or added |