Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions nprogress.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@

if (n === 1) {
// Fade out
css(progress, {
transition: 'none',
opacity: 1
css(progress, {
transition: 'none',
opacity: 1
});
progress.offsetWidth; /* Repaint */

setTimeout(function() {
css(progress, {
transition: 'all ' + speed + 'ms linear',
opacity: 0
css(progress, {
transition: 'all ' + speed + 'ms linear',
opacity: 0
});
setTimeout(function() {
NProgress.remove();
Expand Down Expand Up @@ -220,7 +220,7 @@
if (NProgress.isRendered()) return document.getElementById('nprogress');

addClass(document.documentElement, 'nprogress-busy');

var progress = document.createElement('div');
progress.id = 'nprogress';
progress.innerHTML = Settings.template;
Expand All @@ -229,7 +229,7 @@
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
parent = document.querySelector(Settings.parent),
spinner;

css(bar, {
transition: 'all 0 linear',
transform: 'translate3d(' + perc + '%,0,0)'
Expand Down Expand Up @@ -340,7 +340,7 @@

var queue = (function() {
var pending = [];

function next() {
var fn = pending.shift();
if (fn) {
Expand All @@ -355,10 +355,10 @@
})();

/**
* (Internal) Applies css properties to an element, similar to the jQuery
* (Internal) Applies css properties to an element, similar to the jQuery
* css method.
*
* While this helper does assist with vendor prefixed property names, it
* While this helper does assist with vendor prefixed property names, it
* does not perform any manipulation of values prior to setting styles.
*/

Expand Down Expand Up @@ -399,7 +399,7 @@

return function(element, properties) {
var args = arguments,
prop,
prop,
value;

if (args.length == 2) {
Expand Down Expand Up @@ -430,7 +430,7 @@
var oldList = classList(element),
newList = oldList + name;

if (hasClass(oldList, name)) return;
if (hasClass(oldList, name)) return;

// Trim the opening space.
element.className = newList.substring(1);
Expand All @@ -454,13 +454,13 @@
}

/**
* (Internal) Gets a space separated list of the class names on the element.
* The list is wrapped with a single space on each end to facilitate finding
* (Internal) Gets a space separated list of the class names on the element.
* The list is wrapped with a single space on each end to facilitate finding
* matches within the list.
*/

function classList(element) {
return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' ');
}

/**
Expand All @@ -473,4 +473,3 @@

return NProgress;
});