From 321bec0d0cdf7947cb700bf77eeb1e3947016fe8 Mon Sep 17 00:00:00 2001
From: Samuel Mortenson
Date: Wed, 22 Jul 2015 12:55:44 -0700
Subject: [PATCH 01/28] Updated cssKeyframeRegex to support css that includes
the keyword "keyframes" in another context.
---
css.js | 6 +++---
css.min.js | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/css.js b/css.js
index b35458f..c2fea0f 100755
--- a/css.js
+++ b/css.js
@@ -9,7 +9,7 @@
this.cssRegex = new RegExp('([\\s\\S]*?){([\\s\\S]*?)}', 'gi');
this.cssMediaQueryRegex = '((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})';
- this.cssKeyframeRegex = '((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})';
+ this.cssKeyframeRegex = '((@(-webkit-)?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})';
this.combinedCSSRegex = '((\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})'; //to match css & media queries together
this.cssCommentsRegex = '(\\/\\*[\\s\\S]*?\\*\\/)';
this.cssImportStatementRegex = new RegExp('@import .*?;', 'gi');
@@ -289,7 +289,7 @@
returns the changed(new,removed,updated) values on css1 parameter, on same structure
if two css objects are the same, then returns false
-
+
if a css directive exists in css1 and css2, and its value is different, it is included in diff
if a css directive exists in css1 and not css2, it is then included in diff
if a css directive exists in css2 but not css1, then it is deleted in css1, it would be included in diff but will be marked as type='DELETED'
@@ -649,7 +649,7 @@
var __el = document.getElementById( id );
if(__el){
- __el.parentNode.removeChild( __el );
+ __el.parentNode.removeChild( __el );
}
var head = document.head || document.getElementsByTagName('head')[0],
diff --git a/css.min.js b/css.min.js
index 3478253..fc10f7d 100644
--- a/css.min.js
+++ b/css.min.js
@@ -1,2 +1,2 @@
-/*! css.js 16-01-2015 */
-!function(){"use strict";var a=function(){this.cssImportStatements=[],this.cssKeyframeStatements=[],this.cssRegex=new RegExp("([\\s\\S]*?){([\\s\\S]*?)}","gi"),this.cssMediaQueryRegex="((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.cssKeyframeRegex="((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.combinedCSSRegex="((\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",this.cssCommentsRegex="(\\/\\*[\\s\\S]*?\\*\\/)",this.cssImportStatementRegex=new RegExp("@import .*?;","gi")};a.prototype.stripComments=function(a){var b=new RegExp(this.cssCommentsRegex,"gi");return a.replace(b,"")},a.prototype.parseCSS=function(a){if(void 0===a)return[];for(var b=[];;){var c=this.cssImportStatementRegex.exec(a);if(null===c)break;this.cssImportStatements.push(c[0]),b.push({selector:"@imports",type:"imports",styles:c[0]})}a=a.replace(this.cssImportStatementRegex,"");for(var d,e=new RegExp(this.cssKeyframeRegex,"gi");;){if(d=e.exec(a),null===d)break;b.push({selector:"@keyframes",type:"keyframes",styles:d[0]})}a=a.replace(e,"");for(var f=new RegExp(this.combinedCSSRegex,"gi");;){if(d=f.exec(a),null===d)break;var g="";g=void 0===d[2]?d[5].split("\r\n").join("\n").trim():d[2].split("\r\n").join("\n").trim();var h=new RegExp(this.cssCommentsRegex,"gi"),i=h.exec(g);if(null!==i&&(g=g.replace(h,"").trim()),-1!==g.indexOf("@media")){var j={selector:g,type:"media",subStyles:this.parseCSS(d[3]+"\n}")};null!==i&&(j.comments=i[0]),b.push(j)}else{var k=this.parseRules(d[6]),l={selector:g,rules:k};"@font-face"===g&&(l.type="font-face"),null!==i&&(l.comments=i[0]),b.push(l)}}return b},a.prototype.parseRules=function(a){a=a.split("\r\n").join("\n");var b=[];a=a.split(";");for(var c=0;c0&&b.push({directive:"",value:d,defective:!0})}return b},a.prototype.findCorrespondingRule=function(a,b,c){void 0===c&&(c=!1);for(var d=!1,e=0;e-1;f--)if(a[f].selector===b.selector){d=a[f];break}if(d===!1)a.push(b);else if("media"!==b.type)for(var g=0;gc;c++)b+=" ";return b},a.prototype.applyNamespacing=function(a,b){var c=a,d="."+this.cssPreviewNamespace;void 0!==b&&(d=b),"string"==typeof a&&(c=this.parseCSS(a));for(var e=0;e-1||f.selector.indexOf("keyframes")>-1||f.selector.indexOf("@import")>-1||f.selector.indexOf(".form-all")>-1||f.selector.indexOf("#stage")>-1))if("media"!==f.type){for(var g=f.selector.split(","),h=[],i=0;i0&&b.push({directive:"",value:d,defective:!0})}return b},b.prototype.findCorrespondingRule=function(a,b,c){void 0===c&&(c=!1);for(var d=!1,e=0;e-1;f--)if(a[f].selector===b.selector){d=a[f];break}if(d===!1)a.push(b);else if("media"!==b.type)for(var g=0;gc;c++)b+=" ";return b},b.prototype.applyNamespacing=function(a,b){var c=a,d="."+this.cssPreviewNamespace;void 0!==b&&(d=b),"string"==typeof a&&(c=this.parseCSS(a));for(var e=0;e-1||f.selector.indexOf("keyframes")>-1||f.selector.indexOf("@import")>-1||f.selector.indexOf(".form-all")>-1||f.selector.indexOf("#stage")>-1))if("media"!==f.type){for(var g=f.selector.split(","),h=[],i=0;i
Date: Mon, 24 Aug 2015 17:16:43 +0100
Subject: [PATCH 02/28] Removed unused $ parameter from outer closure and
injected global context to allow for it to run server side
---
README.md | 16 ++++++++++++++++
css.js | 6 +++---
css.min.js | 4 ++--
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index c3728e6..5fe945b 100755
--- a/README.md
+++ b/README.md
@@ -35,6 +35,8 @@ And to execute unit tests and produce css.min.js, execute
How To Use
======
+On the browser
+------
Simply parse css string, and log the output
@@ -52,4 +54,18 @@ Simply parse css string, and log the output
```
+On the server
+------
+
+```
+ var cssString = ' .someSelector { margin:40px 10px; padding:5px}';
+ //require parser constructor
+ var cssjs = require("./css.js");
+ //initialize parser object
+ var parser = new cssjs.cssjs();
+ //parse css string
+ var parsed = parser.parseCSS(cssString);
+
+ console.log(parsed);
+```
diff --git a/css.js b/css.js
index b35458f..0318ef8 100755
--- a/css.js
+++ b/css.js
@@ -1,6 +1,6 @@
/* jshint unused:false */
/* global base64_decode, CSSWizardView, window, console, jQuery */
-(function($) {
+(function(global) {
'use strict';
var fi = function() {
@@ -667,6 +667,6 @@
}
};
- window.cssjs = fi;
+ global.cssjs = fi;
-})();
\ No newline at end of file
+})(this);
\ No newline at end of file
diff --git a/css.min.js b/css.min.js
index 3478253..2cbdac8 100644
--- a/css.min.js
+++ b/css.min.js
@@ -1,2 +1,2 @@
-/*! css.js 16-01-2015 */
-!function(){"use strict";var a=function(){this.cssImportStatements=[],this.cssKeyframeStatements=[],this.cssRegex=new RegExp("([\\s\\S]*?){([\\s\\S]*?)}","gi"),this.cssMediaQueryRegex="((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.cssKeyframeRegex="((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.combinedCSSRegex="((\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",this.cssCommentsRegex="(\\/\\*[\\s\\S]*?\\*\\/)",this.cssImportStatementRegex=new RegExp("@import .*?;","gi")};a.prototype.stripComments=function(a){var b=new RegExp(this.cssCommentsRegex,"gi");return a.replace(b,"")},a.prototype.parseCSS=function(a){if(void 0===a)return[];for(var b=[];;){var c=this.cssImportStatementRegex.exec(a);if(null===c)break;this.cssImportStatements.push(c[0]),b.push({selector:"@imports",type:"imports",styles:c[0]})}a=a.replace(this.cssImportStatementRegex,"");for(var d,e=new RegExp(this.cssKeyframeRegex,"gi");;){if(d=e.exec(a),null===d)break;b.push({selector:"@keyframes",type:"keyframes",styles:d[0]})}a=a.replace(e,"");for(var f=new RegExp(this.combinedCSSRegex,"gi");;){if(d=f.exec(a),null===d)break;var g="";g=void 0===d[2]?d[5].split("\r\n").join("\n").trim():d[2].split("\r\n").join("\n").trim();var h=new RegExp(this.cssCommentsRegex,"gi"),i=h.exec(g);if(null!==i&&(g=g.replace(h,"").trim()),-1!==g.indexOf("@media")){var j={selector:g,type:"media",subStyles:this.parseCSS(d[3]+"\n}")};null!==i&&(j.comments=i[0]),b.push(j)}else{var k=this.parseRules(d[6]),l={selector:g,rules:k};"@font-face"===g&&(l.type="font-face"),null!==i&&(l.comments=i[0]),b.push(l)}}return b},a.prototype.parseRules=function(a){a=a.split("\r\n").join("\n");var b=[];a=a.split(";");for(var c=0;c0&&b.push({directive:"",value:d,defective:!0})}return b},a.prototype.findCorrespondingRule=function(a,b,c){void 0===c&&(c=!1);for(var d=!1,e=0;e-1;f--)if(a[f].selector===b.selector){d=a[f];break}if(d===!1)a.push(b);else if("media"!==b.type)for(var g=0;gc;c++)b+=" ";return b},a.prototype.applyNamespacing=function(a,b){var c=a,d="."+this.cssPreviewNamespace;void 0!==b&&(d=b),"string"==typeof a&&(c=this.parseCSS(a));for(var e=0;e-1||f.selector.indexOf("keyframes")>-1||f.selector.indexOf("@import")>-1||f.selector.indexOf(".form-all")>-1||f.selector.indexOf("#stage")>-1))if("media"!==f.type){for(var g=f.selector.split(","),h=[],i=0;i0&&b.push({directive:"",value:d,defective:!0})}return b},b.prototype.findCorrespondingRule=function(a,b,c){void 0===c&&(c=!1);for(var d=!1,e=0;e-1;f--)if(a[f].selector===b.selector){d=a[f];break}if(d===!1)a.push(b);else if("media"!==b.type)for(var g=0;gc;c++)b+=" ";return b},b.prototype.applyNamespacing=function(a,b){var c=a,d="."+this.cssPreviewNamespace;void 0!==b&&(d=b),"string"==typeof a&&(c=this.parseCSS(a));for(var e=0;e-1||f.selector.indexOf("keyframes")>-1||f.selector.indexOf("@import")>-1||f.selector.indexOf(".form-all")>-1||f.selector.indexOf("#stage")>-1))if("media"!==f.type){for(var g=f.selector.split(","),h=[],i=0;i
Date: Mon, 9 Nov 2015 19:40:17 +0200
Subject: [PATCH 03/28] Typo fixes. More consistent style.
---
css.js | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/css.js b/css.js
index b35458f..b36bffe 100755
--- a/css.js
+++ b/css.js
@@ -116,7 +116,7 @@
}
css.push(cssObject);
} else {
- //we have standart css
+ //we have standard css
var rules = this.parseRules(arr[6]);
var style = {
selector: selector,
@@ -368,7 +368,7 @@
}
for (i = 0; i < cssObjectArray.length; i++) {
var cobj = cssObjectArray[i];
- if (cobj.type === 'media' || (cobj.type === 'keyframes')) {
+ if (cobj.type === 'media' || (cobj.type === 'keyframes')) {
continue;
}
cobj.rules = this.compactRules(cobj.rules);
@@ -377,7 +377,7 @@
/*
inserts new css objects into a bigger css object
- with same selectors groupped together
+ with same selectors grouped together
@param cssObjectArray, array of bigger css object to be pushed into
@param minimalObject, single css object
@@ -439,7 +439,7 @@
@param rules, array of rules
- @returns rules array, compacted by deleting all unneccessary rules
+ @returns rules array, compacted by deleting all unnecessary rules
*/
fi.prototype.compactRules = function(rules) {
var newRules = [];
@@ -520,7 +520,7 @@
continue;
}
if (rules[i].defective === undefined) {
- ret += this.getSpaces(depth) + rules[i].directive + ' : ' + rules[i].value + ';\n';
+ ret += this.getSpaces(depth) + rules[i].directive + ': ' + rules[i].value + ';\n';
} else {
ret += this.getSpaces(depth) + rules[i].value + ';\n';
}
@@ -630,7 +630,7 @@
format = false;
}
- if (this.testMode === false && format!=='nonamespace') {
+ if (this.testMode === false && format !== 'nonamespace') {
//apply namespacing classes
css = this.applyNamespacing(css);
}
@@ -647,9 +647,9 @@
return this.testMode('create style #' + id, css); //if test mode, just pass result to callback
}
- var __el = document.getElementById( id );
- if(__el){
- __el.parentNode.removeChild( __el );
+ var __el = document.getElementById(id);
+ if (__el) {
+ __el.parentNode.removeChild(__el);
}
var head = document.head || document.getElementsByTagName('head')[0],
From 90378d6bc5990fcfd7ef3f34b1c35cde523d01b9 Mon Sep 17 00:00:00 2001
From: Braam Genis
Date: Mon, 9 Nov 2015 19:48:44 +0200
Subject: [PATCH 04/28] Use strict equality.
---
css.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/css.js b/css.js
index b36bffe..2b12c6d 100755
--- a/css.js
+++ b/css.js
@@ -174,7 +174,7 @@
});
} else {
//if there is no ':', but what if it was mis splitted value which starts with base64
- if (line.trim().substr(0, 7) == 'base64,') { //hack :)
+ if (line.trim().substr(0, 7) === 'base64,') { //hack :)
ret[ret.length - 1].value += line.trim();
} else {
//add rule, even if it is defective
@@ -201,7 +201,7 @@
}
var ret = false;
for (var i = 0; i < rules.length; i++) {
- if (rules[i].directive == directive) {
+ if (rules[i].directive === directive) {
ret = rules[i];
if (value === rules[i].value) {
break;
@@ -419,7 +419,7 @@
var oldRule = this.findCorrespondingRule(cssObject.rules, rule.directive);
if (oldRule === false) {
cssObject.rules.push(rule);
- } else if (rule.type == 'DELETED') {
+ } else if (rule.type === 'DELETED') {
oldRule.type = 'DELETED';
} else {
//rule found just update value
@@ -465,7 +465,7 @@
}
//append imports
for (var i = 0; i < cssBase.length; i++) {
- if (cssBase[i].type == 'imports') {
+ if (cssBase[i].type === 'imports') {
ret += cssBase[i].styles + '\n\n';
}
}
@@ -479,7 +479,7 @@
comments = tmp.comments + '\n';
}
- if (tmp.type == 'media') { //also put media queries to output
+ if (tmp.type === 'media') { //also put media queries to output
ret += comments + tmp.selector + '{\n';
ret += this.getCSSForEditor(tmp.subStyles, depth + 1);
ret += '}\n\n';
@@ -492,7 +492,7 @@
//append keyFrames
for (i = 0; i < cssBase.length; i++) {
- if (cssBase[i].type == 'keyframes') {
+ if (cssBase[i].type === 'keyframes') {
ret += cssBase[i].styles + '\n\n';
}
}
@@ -503,7 +503,7 @@
fi.prototype.getImports = function(cssObjectArray) {
var imps = [];
for (var i = 0; i < cssObjectArray.length; i++) {
- if (cssObjectArray[i].type == 'imports') {
+ if (cssObjectArray[i].type === 'imports') {
imps.push(cssObjectArray[i].styles);
}
}
@@ -635,7 +635,7 @@
css = this.applyNamespacing(css);
}
- if (typeof css != 'string') {
+ if (typeof css !== 'string') {
css = this.getCSSForEditor(css);
}
//apply formatting for css
From 92c57ec6abffb9c173af7f8e559b77b33d92d60e Mon Sep 17 00:00:00 2001
From: Braam Genis
Date: Mon, 9 Nov 2015 19:52:02 +0200
Subject: [PATCH 05/28] Remove multiple consecutive line breaks.
---
css.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/css.js b/css.js
index 2b12c6d..d638563 100755
--- a/css.js
+++ b/css.js
@@ -103,6 +103,9 @@
selector = selector.replace(commentsRegex, '').trim();
}
+ // Never have more than a single line break in a row
+ selector = selector.replace(/\n+/, "\n");
+
//determine the type
if (selector.indexOf('@media') !== -1) {
//we have a media query
From 7a65e1425cfb52d6c79ad92f3e4bbb1eedf1f248 Mon Sep 17 00:00:00 2001
From: Braam Genis
Date: Mon, 9 Nov 2015 19:53:53 +0200
Subject: [PATCH 06/28] Don't overwrite media queries sub styles. Rather just
append them.
---
css.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/css.js b/css.js
index d638563..4245829 100755
--- a/css.js
+++ b/css.js
@@ -431,7 +431,7 @@
}
}
} else {
- cssObject.subStyles = minimalObject.subStyles; //TODO, make this intelligent too
+ cssObject.subStyles = cssObject.subStyles.concat(minimalObject.subStyles); //TODO, make this intelligent too
}
}
From e25e6cf57f76d810e19afde7308fb64d4f226732 Mon Sep 17 00:00:00 2001
From: Braam Genis
Date: Mon, 9 Nov 2015 19:55:26 +0200
Subject: [PATCH 07/28] Combined CSS regex matches optional comments before
media query.
---
css.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/css.js b/css.js
index 4245829..a06de27 100755
--- a/css.js
+++ b/css.js
@@ -10,7 +10,7 @@
this.cssRegex = new RegExp('([\\s\\S]*?){([\\s\\S]*?)}', 'gi');
this.cssMediaQueryRegex = '((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})';
this.cssKeyframeRegex = '((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})';
- this.combinedCSSRegex = '((\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})'; //to match css & media queries together
+ this.combinedCSSRegex = '((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})'; //to match css & media queries together
this.cssCommentsRegex = '(\\/\\*[\\s\\S]*?\\*\\/)';
this.cssImportStatementRegex = new RegExp('@import .*?;', 'gi');
};
From 63e6e9408c5485b47c66ac7f33e8f68d2958dbc1 Mon Sep 17 00:00:00 2001
From: Braam Genis
Date: Tue, 10 Nov 2015 18:17:47 +0200
Subject: [PATCH 08/28] Added test case for media query with comment above.
---
tests/cssParsing.test.js | 4 ++++
tests/data.js | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/tests/cssParsing.test.js b/tests/cssParsing.test.js
index 843c318..9e0f73f 100755
--- a/tests/cssParsing.test.js
+++ b/tests/cssParsing.test.js
@@ -89,6 +89,10 @@ QUnit.test('Advanced CSS Parsing(support for media queries)', function(assert) {
expected = $.parseJSON(testData.advCSS5.output);
parsed = fullInspector.parseCSS(testData.advCSS5.input);
assert.deepEqual(parsed, expected, 'Simple @font-face with multiline value containing css');
+
+ expected = $.parseJSON(testData.advCSS6.output);
+ parsed = fullInspector.parseCSS(testData.advCSS6.input);
+ assert.deepEqual(parsed, expected, 'Media query with a comment above it.');
});
/*
diff --git a/tests/data.js b/tests/data.js
index 353db96..54f1abb 100755
--- a/tests/data.js
+++ b/tests/data.js
@@ -42,6 +42,10 @@ var testData = {
advCSS5: {
input: '@font-face {\nfont-family: myFirstFont;\nsrc: url(sansation_light.woff) format(woff)\nurl(sansation_light.otf) format(opentype);\n}',
output: '[{"selector":"@font-face","type":"font-face","rules":[{"directive":"font-family","value":"myFirstFont"},{"directive":"src","value":"url(sansation_light.woff) format(woff)\\nurl(sansation_light.otf) format(opentype)" }] }]'
+ },
+ advCSS6: {
+ input: '/*--------------------------------------------------------------\nA big comment\n--------------------------------------------------------------*/@media screen and (min-width: 780px) {\n .supernova {\n background-color: #fafafa;\n }\n}',
+ output: '[{"comments": "/*--------------------------------------------------------------\\nA big comment\\n--------------------------------------------------------------*/","selector":"@media screen and (min-width: 780px)","type":"media","subStyles":[{"selector":".supernova","rules":[{"directive":"background-color","value":"#fafafa"}]}]}]'
}
};
From 136f885c4d3e2c7bc65377f151b3334d471658e5 Mon Sep 17 00:00:00 2001
From: Braam Genis
Date: Tue, 10 Nov 2015 17:58:07 +0200
Subject: [PATCH 09/28] Added test case for intelligent push on media query
object containing existing sub style.
---
tests/cssParsing.test.js | 10 ++++++++--
tests/data.js | 5 +++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/cssParsing.test.js b/tests/cssParsing.test.js
index 9e0f73f..e312b5f 100755
--- a/tests/cssParsing.test.js
+++ b/tests/cssParsing.test.js
@@ -150,12 +150,18 @@ QUnit.test('Intelligent CSS Push Tests', function(assert) {
var styles = $.parseJSON(cssIntelligentPushData.pushBasic.styles);
var newStyle = $.parseJSON(cssIntelligentPushData.pushBasic.newStyle);
fullInspector.intelligentCSSPush(styles, newStyle);
- var expected = $.parseJSON(cssIntelligentPushData.pushBasic.result)
+ var expected = $.parseJSON(cssIntelligentPushData.pushBasic.result);
assert.deepEqual(styles, expected, 'Push CSS into empty CSS object');
styles = $.parseJSON(cssIntelligentPushData.pushBasic2.styles);
newStyle = $.parseJSON(cssIntelligentPushData.pushBasic2.newStyle);
fullInspector.intelligentCSSPush(styles, newStyle);
- expected = $.parseJSON(cssIntelligentPushData.pushBasic2.result)
+ expected = $.parseJSON(cssIntelligentPushData.pushBasic2.result);
assert.deepEqual(styles, expected, 'Push CSS containing a new css directive to an existing CSS object');
+
+ styles = $.parseJSON(cssIntelligentPushData.pushBasic3.styles);
+ newStyle = $.parseJSON(cssIntelligentPushData.pushBasic3.newStyle);
+ fullInspector.intelligentCSSPush(styles, newStyle);
+ expected = $.parseJSON(cssIntelligentPushData.pushBasic3.result);
+ assert.deepEqual(styles, expected, 'Push media query CSS containing a new css directive to an existing media query CSS object');
});
\ No newline at end of file
diff --git a/tests/data.js b/tests/data.js
index 54f1abb..52b4342 100755
--- a/tests/data.js
+++ b/tests/data.js
@@ -74,6 +74,11 @@ var cssIntelligentPushData = {
styles: '[{"selector":".first","rules":[{"directive":"color","value":"blue"},{"directive":"margin","value":"10px"}]},{"selector":".second","rules":[{"directive":"color","value":"red"},{"directive":"margin","value":"20px"}]}]',
newStyle: '{"selector":".first","rules":[{"directive":"padding","value":"5px"}]}',
result: '[{"selector":".first","rules":[{"directive":"color","value":"blue"},{"directive":"margin","value":"10px"},{"directive":"padding","value":"5px"}]},{"selector":".second","rules":[{"directive":"color","value":"red"},{"directive":"margin","value":"20px"}]}]'
+ },
+ pushBasic3: {
+ styles: '[{"selector":"@media screen and (min-width: 780px)","type":"media","subStyles":[{"selector":".supernova","rules":[{"directive":"background-color","value":"#fafafa"}]}]}]',
+ newStyle: '{"selector":"@media screen and (min-width: 780px)","type":"media","subStyles":[{"selector":".supernova","rules":[{"directive":"background-color","value":"#bada55"}]}]}',
+ result: '[{"selector":"@media screen and (min-width: 780px)","type":"media","subStyles":[{"selector":".supernova","rules":[{"directive":"background-color","value":"#fafafa"}]},{"selector":".supernova","rules":[{"directive":"background-color","value":"#bada55"}]}]}]'
}
};
From 97ddeb9f2feaac0e8d39907831517cfd4a004f32 Mon Sep 17 00:00:00 2001
From: Kemal Dag
Date: Mon, 30 Nov 2015 12:45:18 +0200
Subject: [PATCH 10/28] Add npm test script
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 6ee0e5a..8b0b19d 100755
--- a/package.json
+++ b/package.json
@@ -15,7 +15,7 @@
"grunt-contrib-uglify": "^0.7.0"
},
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "test": "grunt"
},
"repository": {
"type": "git",
From 98704cc49e1da588fbec31e1f8d33a7815b73926 Mon Sep 17 00:00:00 2001
From: Kemal Dag
Date: Mon, 30 Nov 2015 12:47:37 +0200
Subject: [PATCH 11/28] Add .travis.yml file
---
.travis.yml | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 .travis.yml
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..6fcadf4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - "4.2.1"
\ No newline at end of file
From 406ba89210f4cb9068678928319ec3aa0d607703 Mon Sep 17 00:00:00 2001
From: Kemal Dag
Date: Mon, 30 Nov 2015 12:49:29 +0200
Subject: [PATCH 12/28] Add global npm dependencies to travis.yml
---
.travis.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 6fcadf4..b9a894a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,4 @@
language: node_js
node_js:
- - "4.2.1"
\ No newline at end of file
+ - "4.2.1"
+before_install: npm install -g grunt-cli bower
\ No newline at end of file
From 023d10a815cbd4d779b504ccdfc142a62f9cf511 Mon Sep 17 00:00:00 2001
From: Kemal Dag
Date: Mon, 30 Nov 2015 12:51:13 +0200
Subject: [PATCH 13/28] Travis: do a bower install before testing
---
.travis.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index b9a894a..787fb70 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,5 @@
language: node_js
node_js:
- "4.2.1"
-before_install: npm install -g grunt-cli bower
\ No newline at end of file
+before_install: npm install -g grunt-cli bower
+before_script: bower install
\ No newline at end of file
From fd07cd3a68779435e202d4573aa1fac2d49a694a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kemal=20Da=C4=9F?=
Date: Mon, 30 Nov 2015 14:16:30 +0200
Subject: [PATCH 14/28] Add travis badge
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5fe945b..892952c 100755
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-css.js
+css.js [](https://travis-ci.org/jotform/css.js)
======
A lightweight, battle tested, fast, css parser in JavaScript
From 1664623ed031c15e6a159494fa5a1105cdbe52d7 Mon Sep 17 00:00:00 2001
From: Thomas Reggi
Date: Fri, 4 Dec 2015 23:31:50 -0500
Subject: [PATCH 15/28] fix main & add grunt-cli dep
---
package.json | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index 8b0b19d..94f3e29 100755
--- a/package.json
+++ b/package.json
@@ -1,14 +1,15 @@
{
"name": "css.js",
"version": "1.0.0",
- "description": "css.js ======",
- "main": "Gruntfile.js",
+ "description": "A lightweight, battle tested, fast, CSS parser in JavaScript.",
+ "main": "css.js",
"directories": {
"test": "tests"
},
"dependencies": {},
"devDependencies": {
"grunt": "^0.4.5",
+ "grunt-cli": "^0.1.13",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-qunit": "^0.5.2",
From 6e2149882c01505559a9e3550fd4e236a7fa476e Mon Sep 17 00:00:00 2001
From: Kemal DAG
Date: Tue, 19 Apr 2016 17:14:20 +0300
Subject: [PATCH 16/28] Ditch bower, migrate jQuery dependency into npm and
link qunit statically
---
bower.json | 29 -
css.min.js | 2 +-
ext/qunit-1.21.1.css | 305 +++
ext/qunit-1.23.1.js | 4334 +++++++++++++++++++++++++++++++++++++++++
package.json | 4 +-
tests/cssParsing.html | 6 +-
6 files changed, 4646 insertions(+), 34 deletions(-)
delete mode 100755 bower.json
create mode 100644 ext/qunit-1.21.1.css
create mode 100644 ext/qunit-1.23.1.js
mode change 100755 => 100644 package.json
diff --git a/bower.json b/bower.json
deleted file mode 100755
index 5dda10a..0000000
--- a/bower.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "css.js",
- "main": "css.js",
- "version": "0.0.1",
- "homepage": "https://github.com/cettox/css.js",
- "authors": [
- "Kemal DAG "
- ],
- "description": "A lightweight, fast, stable css parser and utility library",
- "keywords": [
- "css",
- "css",
- "parser",
- "css",
- "utility"
- ],
- "license": "MIT",
- "ignore": [
- "**/.*",
- "node_modules",
- "bower_components",
- "test",
- "tests"
- ],
- "dependencies": {
- "jquery": "~2.1.3",
- "qunit": "~1.16.0"
- }
-}
diff --git a/css.min.js b/css.min.js
index 8a2fdaf..b0e02da 100644
--- a/css.min.js
+++ b/css.min.js
@@ -1,2 +1,2 @@
-/*! css.js 30-11-2015 */
+/*! css.js 19-04-2016 */
!function(a){"use strict";var b=function(){this.cssImportStatements=[],this.cssKeyframeStatements=[],this.cssRegex=new RegExp("([\\s\\S]*?){([\\s\\S]*?)}","gi"),this.cssMediaQueryRegex="((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.cssKeyframeRegex="((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.combinedCSSRegex="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",this.cssCommentsRegex="(\\/\\*[\\s\\S]*?\\*\\/)",this.cssImportStatementRegex=new RegExp("@import .*?;","gi")};b.prototype.stripComments=function(a){var b=new RegExp(this.cssCommentsRegex,"gi");return a.replace(b,"")},b.prototype.parseCSS=function(a){if(void 0===a)return[];for(var b=[];;){var c=this.cssImportStatementRegex.exec(a);if(null===c)break;this.cssImportStatements.push(c[0]),b.push({selector:"@imports",type:"imports",styles:c[0]})}a=a.replace(this.cssImportStatementRegex,"");for(var d,e=new RegExp(this.cssKeyframeRegex,"gi");;){if(d=e.exec(a),null===d)break;b.push({selector:"@keyframes",type:"keyframes",styles:d[0]})}a=a.replace(e,"");for(var f=new RegExp(this.combinedCSSRegex,"gi");;){if(d=f.exec(a),null===d)break;var g="";g=void 0===d[2]?d[5].split("\r\n").join("\n").trim():d[2].split("\r\n").join("\n").trim();var h=new RegExp(this.cssCommentsRegex,"gi"),i=h.exec(g);if(null!==i&&(g=g.replace(h,"").trim()),g=g.replace(/\n+/,"\n"),-1!==g.indexOf("@media")){var j={selector:g,type:"media",subStyles:this.parseCSS(d[3]+"\n}")};null!==i&&(j.comments=i[0]),b.push(j)}else{var k=this.parseRules(d[6]),l={selector:g,rules:k};"@font-face"===g&&(l.type="font-face"),null!==i&&(l.comments=i[0]),b.push(l)}}return b},b.prototype.parseRules=function(a){a=a.split("\r\n").join("\n");var b=[];a=a.split(";");for(var c=0;c0&&b.push({directive:"",value:d,defective:!0})}return b},b.prototype.findCorrespondingRule=function(a,b,c){void 0===c&&(c=!1);for(var d=!1,e=0;e-1;f--)if(a[f].selector===b.selector){d=a[f];break}if(d===!1)a.push(b);else if("media"!==b.type)for(var g=0;gc;c++)b+=" ";return b},b.prototype.applyNamespacing=function(a,b){var c=a,d="."+this.cssPreviewNamespace;void 0!==b&&(d=b),"string"==typeof a&&(c=this.parseCSS(a));for(var e=0;e-1||f.selector.indexOf("keyframes")>-1||f.selector.indexOf("@import")>-1||f.selector.indexOf(".form-all")>-1||f.selector.indexOf("#stage")>-1))if("media"!==f.type){for(var g=f.selector.split(","),h=[],i=0;i li {
+ display: none;
+}
+
+#qunit-tests li.running,
+#qunit-tests li.pass,
+#qunit-tests li.fail,
+#qunit-tests li.skipped {
+ display: list-item;
+}
+
+#qunit-tests.hidepass {
+ position: relative;
+}
+
+#qunit-tests.hidepass li.running,
+#qunit-tests.hidepass li.pass {
+ visibility: hidden;
+ position: absolute;
+ width: 0;
+ height: 0;
+ padding: 0;
+ border: 0;
+ margin: 0;
+}
+
+#qunit-tests li strong {
+ cursor: pointer;
+}
+
+#qunit-tests li.skipped strong {
+ cursor: default;
+}
+
+#qunit-tests li a {
+ padding: 0.5em;
+ color: #C2CCD1;
+ text-decoration: none;
+}
+
+#qunit-tests li p a {
+ padding: 0.25em;
+ color: #6B6464;
+}
+#qunit-tests li a:hover,
+#qunit-tests li a:focus {
+ color: #000;
+}
+
+#qunit-tests li .runtime {
+ float: right;
+ font-size: smaller;
+}
+
+.qunit-assert-list {
+ margin-top: 0.5em;
+ padding: 0.5em;
+
+ background-color: #FFF;
+
+ border-radius: 5px;
+}
+
+.qunit-source {
+ margin: 0.6em 0 0.3em;
+}
+
+.qunit-collapsed {
+ display: none;
+}
+
+#qunit-tests table {
+ border-collapse: collapse;
+ margin-top: 0.2em;
+}
+
+#qunit-tests th {
+ text-align: right;
+ vertical-align: top;
+ padding: 0 0.5em 0 0;
+}
+
+#qunit-tests td {
+ vertical-align: top;
+}
+
+#qunit-tests pre {
+ margin: 0;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+
+#qunit-tests del {
+ background-color: #E0F2BE;
+ color: #374E0C;
+ text-decoration: none;
+}
+
+#qunit-tests ins {
+ background-color: #FFCACA;
+ color: #500;
+ text-decoration: none;
+}
+
+/*** Test Counts */
+
+#qunit-tests b.counts { color: #000; }
+#qunit-tests b.passed { color: #5E740B; }
+#qunit-tests b.failed { color: #710909; }
+
+#qunit-tests li li {
+ padding: 5px;
+ background-color: #FFF;
+ border-bottom: none;
+ list-style-position: inside;
+}
+
+/*** Passing Styles */
+
+#qunit-tests li li.pass {
+ color: #3C510C;
+ background-color: #FFF;
+ border-left: 10px solid #C6E746;
+}
+
+#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
+#qunit-tests .pass .test-name { color: #366097; }
+
+#qunit-tests .pass .test-actual,
+#qunit-tests .pass .test-expected { color: #999; }
+
+#qunit-banner.qunit-pass { background-color: #C6E746; }
+
+/*** Failing Styles */
+
+#qunit-tests li li.fail {
+ color: #710909;
+ background-color: #FFF;
+ border-left: 10px solid #EE5757;
+ white-space: pre;
+}
+
+#qunit-tests > li:last-child {
+ border-radius: 0 0 5px 5px;
+}
+
+#qunit-tests .fail { color: #000; background-color: #EE5757; }
+#qunit-tests .fail .test-name,
+#qunit-tests .fail .module-name { color: #000; }
+
+#qunit-tests .fail .test-actual { color: #EE5757; }
+#qunit-tests .fail .test-expected { color: #008000; }
+
+#qunit-banner.qunit-fail { background-color: #EE5757; }
+
+/*** Skipped tests */
+
+#qunit-tests .skipped {
+ background-color: #EBECE9;
+}
+
+#qunit-tests .qunit-skipped-label {
+ background-color: #F4FF77;
+ display: inline-block;
+ font-style: normal;
+ color: #366097;
+ line-height: 1.8em;
+ padding: 0 0.5em;
+ margin: -0.4em 0.4em -0.4em 0;
+}
+
+/** Result */
+
+#qunit-testresult {
+ padding: 0.5em 1em 0.5em 1em;
+
+ color: #2B81AF;
+ background-color: #D2E0E6;
+
+ border-bottom: 1px solid #FFF;
+}
+#qunit-testresult .module-name {
+ font-weight: 700;
+}
+
+/** Fixture */
+
+#qunit-fixture {
+ position: absolute;
+ top: -10000px;
+ left: -10000px;
+ width: 1000px;
+ height: 1000px;
+}
\ No newline at end of file
diff --git a/ext/qunit-1.23.1.js b/ext/qunit-1.23.1.js
new file mode 100644
index 0000000..f4ed59e
--- /dev/null
+++ b/ext/qunit-1.23.1.js
@@ -0,0 +1,4334 @@
+/*!
+ * QUnit 1.23.1
+ * https://qunitjs.com/
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license
+ * https://jquery.org/license
+ *
+ * Date: 2016-04-12T17:29Z
+ */
+
+( function( global ) {
+
+var QUnit = {};
+
+var Date = global.Date;
+var now = Date.now || function() {
+ return new Date().getTime();
+};
+
+var setTimeout = global.setTimeout;
+var clearTimeout = global.clearTimeout;
+
+// Store a local window from the global to allow direct references.
+var window = global.window;
+
+var defined = {
+ document: window && window.document !== undefined,
+ setTimeout: setTimeout !== undefined,
+ sessionStorage: ( function() {
+ var x = "qunit-test-string";
+ try {
+ sessionStorage.setItem( x, x );
+ sessionStorage.removeItem( x );
+ return true;
+ } catch ( e ) {
+ return false;
+ }
+ }() )
+};
+
+var fileName = ( sourceFromStacktrace( 0 ) || "" ).replace( /(:\d+)+\)?/, "" ).replace( /.+\//, "" );
+var globalStartCalled = false;
+var runStarted = false;
+
+var toString = Object.prototype.toString,
+ hasOwn = Object.prototype.hasOwnProperty;
+
+// Returns a new Array with the elements that are in a but not in b
+function diff( a, b ) {
+ var i, j,
+ result = a.slice();
+
+ for ( i = 0; i < result.length; i++ ) {
+ for ( j = 0; j < b.length; j++ ) {
+ if ( result[ i ] === b[ j ] ) {
+ result.splice( i, 1 );
+ i--;
+ break;
+ }
+ }
+ }
+ return result;
+}
+
+// From jquery.js
+function inArray( elem, array ) {
+ if ( array.indexOf ) {
+ return array.indexOf( elem );
+ }
+
+ for ( var i = 0, length = array.length; i < length; i++ ) {
+ if ( array[ i ] === elem ) {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+/**
+ * Makes a clone of an object using only Array or Object as base,
+ * and copies over the own enumerable properties.
+ *
+ * @param {Object} obj
+ * @return {Object} New object with only the own properties (recursively).
+ */
+function objectValues ( obj ) {
+ var key, val,
+ vals = QUnit.is( "array", obj ) ? [] : {};
+ for ( key in obj ) {
+ if ( hasOwn.call( obj, key ) ) {
+ val = obj[ key ];
+ vals[ key ] = val === Object( val ) ? objectValues( val ) : val;
+ }
+ }
+ return vals;
+}
+
+function extend( a, b, undefOnly ) {
+ for ( var prop in b ) {
+ if ( hasOwn.call( b, prop ) ) {
+
+ // Avoid "Member not found" error in IE8 caused by messing with window.constructor
+ // This block runs on every environment, so `global` is being used instead of `window`
+ // to avoid errors on node.
+ if ( prop !== "constructor" || a !== global ) {
+ if ( b[ prop ] === undefined ) {
+ delete a[ prop ];
+ } else if ( !( undefOnly && typeof a[ prop ] !== "undefined" ) ) {
+ a[ prop ] = b[ prop ];
+ }
+ }
+ }
+ }
+
+ return a;
+}
+
+function objectType( obj ) {
+ if ( typeof obj === "undefined" ) {
+ return "undefined";
+ }
+
+ // Consider: typeof null === object
+ if ( obj === null ) {
+ return "null";
+ }
+
+ var match = toString.call( obj ).match( /^\[object\s(.*)\]$/ ),
+ type = match && match[ 1 ];
+
+ switch ( type ) {
+ case "Number":
+ if ( isNaN( obj ) ) {
+ return "nan";
+ }
+ return "number";
+ case "String":
+ case "Boolean":
+ case "Array":
+ case "Set":
+ case "Map":
+ case "Date":
+ case "RegExp":
+ case "Function":
+ case "Symbol":
+ return type.toLowerCase();
+ }
+ if ( typeof obj === "object" ) {
+ return "object";
+ }
+}
+
+// Safe object type checking
+function is( type, obj ) {
+ return QUnit.objectType( obj ) === type;
+}
+
+// Doesn't support IE6 to IE9, it will return undefined on these browsers
+// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
+function extractStacktrace( e, offset ) {
+ offset = offset === undefined ? 4 : offset;
+
+ var stack, include, i;
+
+ if ( e.stack ) {
+ stack = e.stack.split( "\n" );
+ if ( /^error$/i.test( stack[ 0 ] ) ) {
+ stack.shift();
+ }
+ if ( fileName ) {
+ include = [];
+ for ( i = offset; i < stack.length; i++ ) {
+ if ( stack[ i ].indexOf( fileName ) !== -1 ) {
+ break;
+ }
+ include.push( stack[ i ] );
+ }
+ if ( include.length ) {
+ return include.join( "\n" );
+ }
+ }
+ return stack[ offset ];
+
+ // Support: Safari <=6 only
+ } else if ( e.sourceURL ) {
+
+ // Exclude useless self-reference for generated Error objects
+ if ( /qunit.js$/.test( e.sourceURL ) ) {
+ return;
+ }
+
+ // For actual exceptions, this is useful
+ return e.sourceURL + ":" + e.line;
+ }
+}
+
+function sourceFromStacktrace( offset ) {
+ var error = new Error();
+
+ // Support: Safari <=7 only, IE <=10 - 11 only
+ // Not all browsers generate the `stack` property for `new Error()`, see also #636
+ if ( !error.stack ) {
+ try {
+ throw error;
+ } catch ( err ) {
+ error = err;
+ }
+ }
+
+ return extractStacktrace( error, offset );
+}
+
+/**
+ * Config object: Maintain internal state
+ * Later exposed as QUnit.config
+ * `config` initialized at top of scope
+ */
+var config = {
+
+ // The queue of tests to run
+ queue: [],
+
+ // Block until document ready
+ blocking: true,
+
+ // By default, run previously failed tests first
+ // very useful in combination with "Hide passed tests" checked
+ reorder: true,
+
+ // By default, modify document.title when suite is done
+ altertitle: true,
+
+ // HTML Reporter: collapse every test except the first failing test
+ // If false, all failing tests will be expanded
+ collapse: true,
+
+ // By default, scroll to top of the page when suite is done
+ scrolltop: true,
+
+ // Depth up-to which object will be dumped
+ maxDepth: 5,
+
+ // When enabled, all tests must call expect()
+ requireExpects: false,
+
+ // Placeholder for user-configurable form-exposed URL parameters
+ urlConfig: [],
+
+ // Set of all modules.
+ modules: [],
+
+ // Stack of nested modules
+ moduleStack: [],
+
+ // The first unnamed module
+ currentModule: {
+ name: "",
+ tests: []
+ },
+
+ callbacks: {}
+};
+
+// Push a loose unnamed module to the modules collection
+config.modules.push( config.currentModule );
+
+var loggingCallbacks = {};
+
+// Register logging callbacks
+function registerLoggingCallbacks( obj ) {
+ var i, l, key,
+ callbackNames = [ "begin", "done", "log", "testStart", "testDone",
+ "moduleStart", "moduleDone" ];
+
+ function registerLoggingCallback( key ) {
+ var loggingCallback = function( callback ) {
+ if ( objectType( callback ) !== "function" ) {
+ throw new Error(
+ "QUnit logging methods require a callback function as their first parameters."
+ );
+ }
+
+ config.callbacks[ key ].push( callback );
+ };
+
+ // DEPRECATED: This will be removed on QUnit 2.0.0+
+ // Stores the registered functions allowing restoring
+ // at verifyLoggingCallbacks() if modified
+ loggingCallbacks[ key ] = loggingCallback;
+
+ return loggingCallback;
+ }
+
+ for ( i = 0, l = callbackNames.length; i < l; i++ ) {
+ key = callbackNames[ i ];
+
+ // Initialize key collection of logging callback
+ if ( objectType( config.callbacks[ key ] ) === "undefined" ) {
+ config.callbacks[ key ] = [];
+ }
+
+ obj[ key ] = registerLoggingCallback( key );
+ }
+}
+
+function runLoggingCallbacks( key, args ) {
+ var i, l, callbacks;
+
+ callbacks = config.callbacks[ key ];
+ for ( i = 0, l = callbacks.length; i < l; i++ ) {
+ callbacks[ i ]( args );
+ }
+}
+
+// DEPRECATED: This will be removed on 2.0.0+
+// This function verifies if the loggingCallbacks were modified by the user
+// If so, it will restore it, assign the given callback and print a console warning
+function verifyLoggingCallbacks() {
+ var loggingCallback, userCallback;
+
+ for ( loggingCallback in loggingCallbacks ) {
+ if ( QUnit[ loggingCallback ] !== loggingCallbacks[ loggingCallback ] ) {
+
+ userCallback = QUnit[ loggingCallback ];
+
+ // Restore the callback function
+ QUnit[ loggingCallback ] = loggingCallbacks[ loggingCallback ];
+
+ // Assign the deprecated given callback
+ QUnit[ loggingCallback ]( userCallback );
+
+ if ( global.console && global.console.warn ) {
+ global.console.warn(
+ "QUnit." + loggingCallback + " was replaced with a new value.\n" +
+ "Please, check out the documentation on how to apply logging callbacks.\n" +
+ "Reference: https://api.qunitjs.com/category/callbacks/"
+ );
+ }
+ }
+ }
+}
+
+( function() {
+ if ( !defined.document ) {
+ return;
+ }
+
+ // `onErrorFnPrev` initialized at top of scope
+ // Preserve other handlers
+ var onErrorFnPrev = window.onerror;
+
+ // Cover uncaught exceptions
+ // Returning true will suppress the default browser handler,
+ // returning false will let it run.
+ window.onerror = function( error, filePath, linerNr ) {
+ var ret = false;
+ if ( onErrorFnPrev ) {
+ ret = onErrorFnPrev( error, filePath, linerNr );
+ }
+
+ // Treat return value as window.onerror itself does,
+ // Only do our handling if not suppressed.
+ if ( ret !== true ) {
+ if ( QUnit.config.current ) {
+ if ( QUnit.config.current.ignoreGlobalErrors ) {
+ return true;
+ }
+ QUnit.pushFailure( error, filePath + ":" + linerNr );
+ } else {
+ QUnit.test( "global failure", extend( function() {
+ QUnit.pushFailure( error, filePath + ":" + linerNr );
+ }, { validTest: true } ) );
+ }
+ return false;
+ }
+
+ return ret;
+ };
+}() );
+
+// Figure out if we're running the tests from a server or not
+QUnit.isLocal = !( defined.document && window.location.protocol !== "file:" );
+
+// Expose the current QUnit version
+QUnit.version = "1.23.1";
+
+extend( QUnit, {
+
+ // Call on start of module test to prepend name to all tests
+ module: function( name, testEnvironment, executeNow ) {
+ var module, moduleFns;
+ var currentModule = config.currentModule;
+
+ if ( arguments.length === 2 ) {
+ if ( objectType( testEnvironment ) === "function" ) {
+ executeNow = testEnvironment;
+ testEnvironment = undefined;
+ }
+ }
+
+ // DEPRECATED: handles setup/teardown functions,
+ // beforeEach and afterEach should be used instead
+ if ( testEnvironment && testEnvironment.setup ) {
+ testEnvironment.beforeEach = testEnvironment.setup;
+ delete testEnvironment.setup;
+ }
+ if ( testEnvironment && testEnvironment.teardown ) {
+ testEnvironment.afterEach = testEnvironment.teardown;
+ delete testEnvironment.teardown;
+ }
+
+ module = createModule();
+
+ moduleFns = {
+ beforeEach: setHook( module, "beforeEach" ),
+ afterEach: setHook( module, "afterEach" )
+ };
+
+ if ( objectType( executeNow ) === "function" ) {
+ config.moduleStack.push( module );
+ setCurrentModule( module );
+ executeNow.call( module.testEnvironment, moduleFns );
+ config.moduleStack.pop();
+ module = module.parentModule || currentModule;
+ }
+
+ setCurrentModule( module );
+
+ function createModule() {
+ var parentModule = config.moduleStack.length ?
+ config.moduleStack.slice( -1 )[ 0 ] : null;
+ var moduleName = parentModule !== null ?
+ [ parentModule.name, name ].join( " > " ) : name;
+ var module = {
+ name: moduleName,
+ parentModule: parentModule,
+ tests: [],
+ moduleId: generateHash( moduleName )
+ };
+
+ var env = {};
+ if ( parentModule ) {
+ extend( env, parentModule.testEnvironment );
+ delete env.beforeEach;
+ delete env.afterEach;
+ }
+ extend( env, testEnvironment );
+ module.testEnvironment = env;
+
+ config.modules.push( module );
+ return module;
+ }
+
+ function setCurrentModule( module ) {
+ config.currentModule = module;
+ }
+
+ },
+
+ // DEPRECATED: QUnit.asyncTest() will be removed in QUnit 2.0.
+ asyncTest: asyncTest,
+
+ test: test,
+
+ skip: skip,
+
+ only: only,
+
+ // DEPRECATED: The functionality of QUnit.start() will be altered in QUnit 2.0.
+ // In QUnit 2.0, invoking it will ONLY affect the `QUnit.config.autostart` blocking behavior.
+ start: function( count ) {
+ var globalStartAlreadyCalled = globalStartCalled;
+
+ if ( !config.current ) {
+ globalStartCalled = true;
+
+ if ( runStarted ) {
+ throw new Error( "Called start() outside of a test context while already started" );
+ } else if ( globalStartAlreadyCalled || count > 1 ) {
+ throw new Error( "Called start() outside of a test context too many times" );
+ } else if ( config.autostart ) {
+ throw new Error( "Called start() outside of a test context when " +
+ "QUnit.config.autostart was true" );
+ } else if ( !config.pageLoaded ) {
+
+ // The page isn't completely loaded yet, so bail out and let `QUnit.load` handle it
+ config.autostart = true;
+ return;
+ }
+ } else {
+
+ // If a test is running, adjust its semaphore
+ config.current.semaphore -= count || 1;
+
+ // If semaphore is non-numeric, throw error
+ if ( isNaN( config.current.semaphore ) ) {
+ config.current.semaphore = 0;
+
+ QUnit.pushFailure(
+ "Called start() with a non-numeric decrement.",
+ sourceFromStacktrace( 2 )
+ );
+ return;
+ }
+
+ // Don't start until equal number of stop-calls
+ if ( config.current.semaphore > 0 ) {
+ return;
+ }
+
+ // Throw an Error if start is called more often than stop
+ if ( config.current.semaphore < 0 ) {
+ config.current.semaphore = 0;
+
+ QUnit.pushFailure(
+ "Called start() while already started (test's semaphore was 0 already)",
+ sourceFromStacktrace( 2 )
+ );
+ return;
+ }
+ }
+
+ resumeProcessing();
+ },
+
+ // DEPRECATED: QUnit.stop() will be removed in QUnit 2.0.
+ stop: function( count ) {
+
+ // If there isn't a test running, don't allow QUnit.stop() to be called
+ if ( !config.current ) {
+ throw new Error( "Called stop() outside of a test context" );
+ }
+
+ // If a test is running, adjust its semaphore
+ config.current.semaphore += count || 1;
+
+ pauseProcessing();
+ },
+
+ config: config,
+
+ is: is,
+
+ objectType: objectType,
+
+ extend: extend,
+
+ load: function() {
+ config.pageLoaded = true;
+
+ // Initialize the configuration options
+ extend( config, {
+ stats: { all: 0, bad: 0 },
+ moduleStats: { all: 0, bad: 0 },
+ started: 0,
+ updateRate: 1000,
+ autostart: true,
+ filter: ""
+ }, true );
+
+ config.blocking = false;
+
+ if ( config.autostart ) {
+ resumeProcessing();
+ }
+ },
+
+ stack: function( offset ) {
+ offset = ( offset || 0 ) + 2;
+ return sourceFromStacktrace( offset );
+ }
+} );
+
+registerLoggingCallbacks( QUnit );
+
+function begin() {
+ var i, l,
+ modulesLog = [];
+
+ // If the test run hasn't officially begun yet
+ if ( !config.started ) {
+
+ // Record the time of the test run's beginning
+ config.started = now();
+
+ verifyLoggingCallbacks();
+
+ // Delete the loose unnamed module if unused.
+ if ( config.modules[ 0 ].name === "" && config.modules[ 0 ].tests.length === 0 ) {
+ config.modules.shift();
+ }
+
+ // Avoid unnecessary information by not logging modules' test environments
+ for ( i = 0, l = config.modules.length; i < l; i++ ) {
+ modulesLog.push( {
+ name: config.modules[ i ].name,
+ tests: config.modules[ i ].tests
+ } );
+ }
+
+ // The test run is officially beginning now
+ runLoggingCallbacks( "begin", {
+ totalTests: Test.count,
+ modules: modulesLog
+ } );
+ }
+
+ config.blocking = false;
+ process( true );
+}
+
+function process( last ) {
+ function next() {
+ process( last );
+ }
+ var start = now();
+ config.depth = ( config.depth || 0 ) + 1;
+
+ while ( config.queue.length && !config.blocking ) {
+ if ( !defined.setTimeout || config.updateRate <= 0 ||
+ ( ( now() - start ) < config.updateRate ) ) {
+ if ( config.current ) {
+
+ // Reset async tracking for each phase of the Test lifecycle
+ config.current.usedAsync = false;
+ }
+ config.queue.shift()();
+ } else {
+ setTimeout( next, 13 );
+ break;
+ }
+ }
+ config.depth--;
+ if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) {
+ done();
+ }
+}
+
+function pauseProcessing() {
+ config.blocking = true;
+
+ if ( config.testTimeout && defined.setTimeout ) {
+ clearTimeout( config.timeout );
+ config.timeout = setTimeout( function() {
+ if ( config.current ) {
+ config.current.semaphore = 0;
+ QUnit.pushFailure( "Test timed out", sourceFromStacktrace( 2 ) );
+ } else {
+ throw new Error( "Test timed out" );
+ }
+ resumeProcessing();
+ }, config.testTimeout );
+ }
+}
+
+function resumeProcessing() {
+ runStarted = true;
+
+ // A slight delay to allow this iteration of the event loop to finish (more assertions, etc.)
+ if ( defined.setTimeout ) {
+ setTimeout( function() {
+ if ( config.current && config.current.semaphore > 0 ) {
+ return;
+ }
+ if ( config.timeout ) {
+ clearTimeout( config.timeout );
+ }
+
+ begin();
+ }, 13 );
+ } else {
+ begin();
+ }
+}
+
+function done() {
+ var runtime, passed;
+
+ config.autorun = true;
+
+ // Log the last module results
+ if ( config.previousModule ) {
+ runLoggingCallbacks( "moduleDone", {
+ name: config.previousModule.name,
+ tests: config.previousModule.tests,
+ failed: config.moduleStats.bad,
+ passed: config.moduleStats.all - config.moduleStats.bad,
+ total: config.moduleStats.all,
+ runtime: now() - config.moduleStats.started
+ } );
+ }
+ delete config.previousModule;
+
+ runtime = now() - config.started;
+ passed = config.stats.all - config.stats.bad;
+
+ runLoggingCallbacks( "done", {
+ failed: config.stats.bad,
+ passed: passed,
+ total: config.stats.all,
+ runtime: runtime
+ } );
+}
+
+function setHook( module, hookName ) {
+ if ( module.testEnvironment === undefined ) {
+ module.testEnvironment = {};
+ }
+
+ return function( callback ) {
+ module.testEnvironment[ hookName ] = callback;
+ };
+}
+
+var focused = false;
+var priorityCount = 0;
+var unitSampler;
+
+function Test( settings ) {
+ var i, l;
+
+ ++Test.count;
+
+ extend( this, settings );
+ this.assertions = [];
+ this.semaphore = 0;
+ this.usedAsync = false;
+ this.module = config.currentModule;
+ this.stack = sourceFromStacktrace( 3 );
+
+ // Register unique strings
+ for ( i = 0, l = this.module.tests; i < l.length; i++ ) {
+ if ( this.module.tests[ i ].name === this.testName ) {
+ this.testName += " ";
+ }
+ }
+
+ this.testId = generateHash( this.module.name, this.testName );
+
+ this.module.tests.push( {
+ name: this.testName,
+ testId: this.testId
+ } );
+
+ if ( settings.skip ) {
+
+ // Skipped tests will fully ignore any sent callback
+ this.callback = function() {};
+ this.async = false;
+ this.expected = 0;
+ } else {
+ this.assert = new Assert( this );
+ }
+}
+
+Test.count = 0;
+
+Test.prototype = {
+ before: function() {
+ if (
+
+ // Emit moduleStart when we're switching from one module to another
+ this.module !== config.previousModule ||
+
+ // They could be equal (both undefined) but if the previousModule property doesn't
+ // yet exist it means this is the first test in a suite that isn't wrapped in a
+ // module, in which case we'll just emit a moduleStart event for 'undefined'.
+ // Without this, reporters can get testStart before moduleStart which is a problem.
+ !hasOwn.call( config, "previousModule" )
+ ) {
+ if ( hasOwn.call( config, "previousModule" ) ) {
+ runLoggingCallbacks( "moduleDone", {
+ name: config.previousModule.name,
+ tests: config.previousModule.tests,
+ failed: config.moduleStats.bad,
+ passed: config.moduleStats.all - config.moduleStats.bad,
+ total: config.moduleStats.all,
+ runtime: now() - config.moduleStats.started
+ } );
+ }
+ config.previousModule = this.module;
+ config.moduleStats = { all: 0, bad: 0, started: now() };
+ runLoggingCallbacks( "moduleStart", {
+ name: this.module.name,
+ tests: this.module.tests
+ } );
+ }
+
+ config.current = this;
+
+ if ( this.module.testEnvironment ) {
+ delete this.module.testEnvironment.beforeEach;
+ delete this.module.testEnvironment.afterEach;
+ }
+ this.testEnvironment = extend( {}, this.module.testEnvironment );
+
+ this.started = now();
+ runLoggingCallbacks( "testStart", {
+ name: this.testName,
+ module: this.module.name,
+ testId: this.testId
+ } );
+
+ if ( !config.pollution ) {
+ saveGlobal();
+ }
+ },
+
+ run: function() {
+ var promise;
+
+ config.current = this;
+
+ if ( this.async ) {
+ QUnit.stop();
+ }
+
+ this.callbackStarted = now();
+
+ if ( config.notrycatch ) {
+ runTest( this );
+ return;
+ }
+
+ try {
+ runTest( this );
+ } catch ( e ) {
+ this.pushFailure( "Died on test #" + ( this.assertions.length + 1 ) + " " +
+ this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) );
+
+ // Else next test will carry the responsibility
+ saveGlobal();
+
+ // Restart the tests if they're blocking
+ if ( config.blocking ) {
+ QUnit.start();
+ }
+ }
+
+ function runTest( test ) {
+ promise = test.callback.call( test.testEnvironment, test.assert );
+ test.resolvePromise( promise );
+ }
+ },
+
+ after: function() {
+ checkPollution();
+ },
+
+ queueHook: function( hook, hookName ) {
+ var promise,
+ test = this;
+ return function runHook() {
+ config.current = test;
+ if ( config.notrycatch ) {
+ callHook();
+ return;
+ }
+ try {
+ callHook();
+ } catch ( error ) {
+ test.pushFailure( hookName + " failed on " + test.testName + ": " +
+ ( error.message || error ), extractStacktrace( error, 0 ) );
+ }
+
+ function callHook() {
+ promise = hook.call( test.testEnvironment, test.assert );
+ test.resolvePromise( promise, hookName );
+ }
+ };
+ },
+
+ // Currently only used for module level hooks, can be used to add global level ones
+ hooks: function( handler ) {
+ var hooks = [];
+
+ function processHooks( test, module ) {
+ if ( module.parentModule ) {
+ processHooks( test, module.parentModule );
+ }
+ if ( module.testEnvironment &&
+ QUnit.objectType( module.testEnvironment[ handler ] ) === "function" ) {
+ hooks.push( test.queueHook( module.testEnvironment[ handler ], handler ) );
+ }
+ }
+
+ // Hooks are ignored on skipped tests
+ if ( !this.skip ) {
+ processHooks( this, this.module );
+ }
+ return hooks;
+ },
+
+ finish: function() {
+ config.current = this;
+ if ( config.requireExpects && this.expected === null ) {
+ this.pushFailure( "Expected number of assertions to be defined, but expect() was " +
+ "not called.", this.stack );
+ } else if ( this.expected !== null && this.expected !== this.assertions.length ) {
+ this.pushFailure( "Expected " + this.expected + " assertions, but " +
+ this.assertions.length + " were run", this.stack );
+ } else if ( this.expected === null && !this.assertions.length ) {
+ this.pushFailure( "Expected at least one assertion, but none were run - call " +
+ "expect(0) to accept zero assertions.", this.stack );
+ }
+
+ var i,
+ bad = 0;
+
+ this.runtime = now() - this.started;
+ config.stats.all += this.assertions.length;
+ config.moduleStats.all += this.assertions.length;
+
+ for ( i = 0; i < this.assertions.length; i++ ) {
+ if ( !this.assertions[ i ].result ) {
+ bad++;
+ config.stats.bad++;
+ config.moduleStats.bad++;
+ }
+ }
+
+ runLoggingCallbacks( "testDone", {
+ name: this.testName,
+ module: this.module.name,
+ skipped: !!this.skip,
+ failed: bad,
+ passed: this.assertions.length - bad,
+ total: this.assertions.length,
+ runtime: this.runtime,
+
+ // HTML Reporter use
+ assertions: this.assertions,
+ testId: this.testId,
+
+ // Source of Test
+ source: this.stack,
+
+ // DEPRECATED: this property will be removed in 2.0.0, use runtime instead
+ duration: this.runtime
+ } );
+
+ // QUnit.reset() is deprecated and will be replaced for a new
+ // fixture reset function on QUnit 2.0/2.1.
+ // It's still called here for backwards compatibility handling
+ QUnit.reset();
+
+ config.current = undefined;
+ },
+
+ queue: function() {
+ var priority,
+ test = this;
+
+ if ( !this.valid() ) {
+ return;
+ }
+
+ function run() {
+
+ // Each of these can by async
+ synchronize( [
+ function() {
+ test.before();
+ },
+
+ test.hooks( "beforeEach" ),
+ function() {
+ test.run();
+ },
+
+ test.hooks( "afterEach" ).reverse(),
+
+ function() {
+ test.after();
+ },
+ function() {
+ test.finish();
+ }
+ ] );
+ }
+
+ // Prioritize previously failed tests, detected from sessionStorage
+ priority = QUnit.config.reorder && defined.sessionStorage &&
+ +sessionStorage.getItem( "qunit-test-" + this.module.name + "-" + this.testName );
+
+ return synchronize( run, priority, config.seed );
+ },
+
+ pushResult: function( resultInfo ) {
+
+ // Destructure of resultInfo = { result, actual, expected, message, negative }
+ var source,
+ details = {
+ module: this.module.name,
+ name: this.testName,
+ result: resultInfo.result,
+ message: resultInfo.message,
+ actual: resultInfo.actual,
+ expected: resultInfo.expected,
+ testId: this.testId,
+ negative: resultInfo.negative || false,
+ runtime: now() - this.started
+ };
+
+ if ( !resultInfo.result ) {
+ source = sourceFromStacktrace();
+
+ if ( source ) {
+ details.source = source;
+ }
+ }
+
+ runLoggingCallbacks( "log", details );
+
+ this.assertions.push( {
+ result: !!resultInfo.result,
+ message: resultInfo.message
+ } );
+ },
+
+ pushFailure: function( message, source, actual ) {
+ if ( !( this instanceof Test ) ) {
+ throw new Error( "pushFailure() assertion outside test context, was " +
+ sourceFromStacktrace( 2 ) );
+ }
+
+ var details = {
+ module: this.module.name,
+ name: this.testName,
+ result: false,
+ message: message || "error",
+ actual: actual || null,
+ testId: this.testId,
+ runtime: now() - this.started
+ };
+
+ if ( source ) {
+ details.source = source;
+ }
+
+ runLoggingCallbacks( "log", details );
+
+ this.assertions.push( {
+ result: false,
+ message: message
+ } );
+ },
+
+ resolvePromise: function( promise, phase ) {
+ var then, message,
+ test = this;
+ if ( promise != null ) {
+ then = promise.then;
+ if ( QUnit.objectType( then ) === "function" ) {
+ QUnit.stop();
+ then.call(
+ promise,
+ function() { QUnit.start(); },
+ function( error ) {
+ message = "Promise rejected " +
+ ( !phase ? "during" : phase.replace( /Each$/, "" ) ) +
+ " " + test.testName + ": " + ( error.message || error );
+ test.pushFailure( message, extractStacktrace( error, 0 ) );
+
+ // Else next test will carry the responsibility
+ saveGlobal();
+
+ // Unblock
+ QUnit.start();
+ }
+ );
+ }
+ }
+ },
+
+ valid: function() {
+ var filter = config.filter,
+ regexFilter = /^(!?)\/([\w\W]*)\/(i?$)/.exec( filter ),
+ module = config.module && config.module.toLowerCase(),
+ fullName = ( this.module.name + ": " + this.testName );
+
+ function moduleChainNameMatch( testModule ) {
+ var testModuleName = testModule.name ? testModule.name.toLowerCase() : null;
+ if ( testModuleName === module ) {
+ return true;
+ } else if ( testModule.parentModule ) {
+ return moduleChainNameMatch( testModule.parentModule );
+ } else {
+ return false;
+ }
+ }
+
+ function moduleChainIdMatch( testModule ) {
+ return inArray( testModule.moduleId, config.moduleId ) > -1 ||
+ testModule.parentModule && moduleChainIdMatch( testModule.parentModule );
+ }
+
+ // Internally-generated tests are always valid
+ if ( this.callback && this.callback.validTest ) {
+ return true;
+ }
+
+ if ( config.moduleId && config.moduleId.length > 0 &&
+ !moduleChainIdMatch( this.module ) ) {
+
+ return false;
+ }
+
+ if ( config.testId && config.testId.length > 0 &&
+ inArray( this.testId, config.testId ) < 0 ) {
+
+ return false;
+ }
+
+ if ( module && !moduleChainNameMatch( this.module ) ) {
+ return false;
+ }
+
+ if ( !filter ) {
+ return true;
+ }
+
+ return regexFilter ?
+ this.regexFilter( !!regexFilter[ 1 ], regexFilter[ 2 ], regexFilter[ 3 ], fullName ) :
+ this.stringFilter( filter, fullName );
+ },
+
+ regexFilter: function( exclude, pattern, flags, fullName ) {
+ var regex = new RegExp( pattern, flags );
+ var match = regex.test( fullName );
+
+ return match !== exclude;
+ },
+
+ stringFilter: function( filter, fullName ) {
+ filter = filter.toLowerCase();
+ fullName = fullName.toLowerCase();
+
+ var include = filter.charAt( 0 ) !== "!";
+ if ( !include ) {
+ filter = filter.slice( 1 );
+ }
+
+ // If the filter matches, we need to honour include
+ if ( fullName.indexOf( filter ) !== -1 ) {
+ return include;
+ }
+
+ // Otherwise, do the opposite
+ return !include;
+ }
+};
+
+// Resets the test setup. Useful for tests that modify the DOM.
+/*
+DEPRECATED: Use multiple tests instead of resetting inside a test.
+Use testStart or testDone for custom cleanup.
+This method will throw an error in 2.0, and will be removed in 2.1
+*/
+QUnit.reset = function() {
+
+ // Return on non-browser environments
+ // This is necessary to not break on node tests
+ if ( !defined.document ) {
+ return;
+ }
+
+ var fixture = defined.document && document.getElementById &&
+ document.getElementById( "qunit-fixture" );
+
+ if ( fixture ) {
+ fixture.innerHTML = config.fixture;
+ }
+};
+
+QUnit.pushFailure = function() {
+ if ( !QUnit.config.current ) {
+ throw new Error( "pushFailure() assertion outside test context, in " +
+ sourceFromStacktrace( 2 ) );
+ }
+
+ // Gets current test obj
+ var currentTest = QUnit.config.current;
+
+ return currentTest.pushFailure.apply( currentTest, arguments );
+};
+
+// Based on Java's String.hashCode, a simple but not
+// rigorously collision resistant hashing function
+function generateHash( module, testName ) {
+ var hex,
+ i = 0,
+ hash = 0,
+ str = module + "\x1C" + testName,
+ len = str.length;
+
+ for ( ; i < len; i++ ) {
+ hash = ( ( hash << 5 ) - hash ) + str.charCodeAt( i );
+ hash |= 0;
+ }
+
+ // Convert the possibly negative integer hash code into an 8 character hex string, which isn't
+ // strictly necessary but increases user understanding that the id is a SHA-like hash
+ hex = ( 0x100000000 + hash ).toString( 16 );
+ if ( hex.length < 8 ) {
+ hex = "0000000" + hex;
+ }
+
+ return hex.slice( -8 );
+}
+
+function synchronize( callback, priority, seed ) {
+ var last = !priority,
+ index;
+
+ if ( QUnit.objectType( callback ) === "array" ) {
+ while ( callback.length ) {
+ synchronize( callback.shift() );
+ }
+ return;
+ }
+
+ if ( priority ) {
+ config.queue.splice( priorityCount++, 0, callback );
+ } else if ( seed ) {
+ if ( !unitSampler ) {
+ unitSampler = unitSamplerGenerator( seed );
+ }
+
+ // Insert into a random position after all priority items
+ index = Math.floor( unitSampler() * ( config.queue.length - priorityCount + 1 ) );
+ config.queue.splice( priorityCount + index, 0, callback );
+ } else {
+ config.queue.push( callback );
+ }
+
+ if ( config.autorun && !config.blocking ) {
+ process( last );
+ }
+}
+
+function unitSamplerGenerator( seed ) {
+
+ // 32-bit xorshift, requires only a nonzero seed
+ // http://excamera.com/sphinx/article-xorshift.html
+ var sample = parseInt( generateHash( seed ), 16 ) || -1;
+ return function() {
+ sample ^= sample << 13;
+ sample ^= sample >>> 17;
+ sample ^= sample << 5;
+
+ // ECMAScript has no unsigned number type
+ if ( sample < 0 ) {
+ sample += 0x100000000;
+ }
+
+ return sample / 0x100000000;
+ };
+}
+
+function saveGlobal() {
+ config.pollution = [];
+
+ if ( config.noglobals ) {
+ for ( var key in global ) {
+ if ( hasOwn.call( global, key ) ) {
+
+ // In Opera sometimes DOM element ids show up here, ignore them
+ if ( /^qunit-test-output/.test( key ) ) {
+ continue;
+ }
+ config.pollution.push( key );
+ }
+ }
+ }
+}
+
+function checkPollution() {
+ var newGlobals,
+ deletedGlobals,
+ old = config.pollution;
+
+ saveGlobal();
+
+ newGlobals = diff( config.pollution, old );
+ if ( newGlobals.length > 0 ) {
+ QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join( ", " ) );
+ }
+
+ deletedGlobals = diff( old, config.pollution );
+ if ( deletedGlobals.length > 0 ) {
+ QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join( ", " ) );
+ }
+}
+
+// Will be exposed as QUnit.asyncTest
+function asyncTest( testName, expected, callback ) {
+ if ( arguments.length === 2 ) {
+ callback = expected;
+ expected = null;
+ }
+
+ QUnit.test( testName, expected, callback, true );
+}
+
+// Will be exposed as QUnit.test
+function test( testName, expected, callback, async ) {
+ if ( focused ) { return; }
+
+ var newTest;
+
+ if ( arguments.length === 2 ) {
+ callback = expected;
+ expected = null;
+ }
+
+ newTest = new Test( {
+ testName: testName,
+ expected: expected,
+ async: async,
+ callback: callback
+ } );
+
+ newTest.queue();
+}
+
+// Will be exposed as QUnit.skip
+function skip( testName ) {
+ if ( focused ) { return; }
+
+ var test = new Test( {
+ testName: testName,
+ skip: true
+ } );
+
+ test.queue();
+}
+
+// Will be exposed as QUnit.only
+function only( testName, expected, callback, async ) {
+ var newTest;
+
+ if ( focused ) { return; }
+
+ QUnit.config.queue.length = 0;
+ focused = true;
+
+ if ( arguments.length === 2 ) {
+ callback = expected;
+ expected = null;
+ }
+
+ newTest = new Test( {
+ testName: testName,
+ expected: expected,
+ async: async,
+ callback: callback
+ } );
+
+ newTest.queue();
+}
+
+function Assert( testContext ) {
+ this.test = testContext;
+}
+
+// Assert helpers
+QUnit.assert = Assert.prototype = {
+
+ // Specify the number of expected assertions to guarantee that failed test
+ // (no assertions are run at all) don't slip through.
+ expect: function( asserts ) {
+ if ( arguments.length === 1 ) {
+ this.test.expected = asserts;
+ } else {
+ return this.test.expected;
+ }
+ },
+
+ // Increment this Test's semaphore counter, then return a function that
+ // decrements that counter a maximum of once.
+ async: function( count ) {
+ var test = this.test,
+ popped = false,
+ acceptCallCount = count;
+
+ if ( typeof acceptCallCount === "undefined" ) {
+ acceptCallCount = 1;
+ }
+
+ test.semaphore += 1;
+ test.usedAsync = true;
+ pauseProcessing();
+
+ return function done() {
+
+ if ( popped ) {
+ test.pushFailure( "Too many calls to the `assert.async` callback",
+ sourceFromStacktrace( 2 ) );
+ return;
+ }
+ acceptCallCount -= 1;
+ if ( acceptCallCount > 0 ) {
+ return;
+ }
+
+ test.semaphore -= 1;
+ popped = true;
+ resumeProcessing();
+ };
+ },
+
+ // Exports test.push() to the user API
+ // Alias of pushResult.
+ push: function( result, actual, expected, message, negative ) {
+ var currentAssert = this instanceof Assert ? this : QUnit.config.current.assert;
+ return currentAssert.pushResult( {
+ result: result,
+ actual: actual,
+ expected: expected,
+ message: message,
+ negative: negative
+ } );
+ },
+
+ pushResult: function( resultInfo ) {
+
+ // Destructure of resultInfo = { result, actual, expected, message, negative }
+ var assert = this,
+ currentTest = ( assert instanceof Assert && assert.test ) || QUnit.config.current;
+
+ // Backwards compatibility fix.
+ // Allows the direct use of global exported assertions and QUnit.assert.*
+ // Although, it's use is not recommended as it can leak assertions
+ // to other tests from async tests, because we only get a reference to the current test,
+ // not exactly the test where assertion were intended to be called.
+ if ( !currentTest ) {
+ throw new Error( "assertion outside test context, in " + sourceFromStacktrace( 2 ) );
+ }
+
+ if ( currentTest.usedAsync === true && currentTest.semaphore === 0 ) {
+ currentTest.pushFailure( "Assertion after the final `assert.async` was resolved",
+ sourceFromStacktrace( 2 ) );
+
+ // Allow this assertion to continue running anyway...
+ }
+
+ if ( !( assert instanceof Assert ) ) {
+ assert = currentTest.assert;
+ }
+
+ return assert.test.pushResult( resultInfo );
+ },
+
+ ok: function( result, message ) {
+ message = message || ( result ? "okay" : "failed, expected argument to be truthy, was: " +
+ QUnit.dump.parse( result ) );
+ this.pushResult( {
+ result: !!result,
+ actual: result,
+ expected: true,
+ message: message
+ } );
+ },
+
+ notOk: function( result, message ) {
+ message = message || ( !result ? "okay" : "failed, expected argument to be falsy, was: " +
+ QUnit.dump.parse( result ) );
+ this.pushResult( {
+ result: !result,
+ actual: result,
+ expected: false,
+ message: message
+ } );
+ },
+
+ equal: function( actual, expected, message ) {
+ /*jshint eqeqeq:false */
+ this.pushResult( {
+ result: expected == actual,
+ actual: actual,
+ expected: expected,
+ message: message
+ } );
+ },
+
+ notEqual: function( actual, expected, message ) {
+ /*jshint eqeqeq:false */
+ this.pushResult( {
+ result: expected != actual,
+ actual: actual,
+ expected: expected,
+ message: message,
+ negative: true
+ } );
+ },
+
+ propEqual: function( actual, expected, message ) {
+ actual = objectValues( actual );
+ expected = objectValues( expected );
+ this.pushResult( {
+ result: QUnit.equiv( actual, expected ),
+ actual: actual,
+ expected: expected,
+ message: message
+ } );
+ },
+
+ notPropEqual: function( actual, expected, message ) {
+ actual = objectValues( actual );
+ expected = objectValues( expected );
+ this.pushResult( {
+ result: !QUnit.equiv( actual, expected ),
+ actual: actual,
+ expected: expected,
+ message: message,
+ negative: true
+ } );
+ },
+
+ deepEqual: function( actual, expected, message ) {
+ this.pushResult( {
+ result: QUnit.equiv( actual, expected ),
+ actual: actual,
+ expected: expected,
+ message: message
+ } );
+ },
+
+ notDeepEqual: function( actual, expected, message ) {
+ this.pushResult( {
+ result: !QUnit.equiv( actual, expected ),
+ actual: actual,
+ expected: expected,
+ message: message,
+ negative: true
+ } );
+ },
+
+ strictEqual: function( actual, expected, message ) {
+ this.pushResult( {
+ result: expected === actual,
+ actual: actual,
+ expected: expected,
+ message: message
+ } );
+ },
+
+ notStrictEqual: function( actual, expected, message ) {
+ this.pushResult( {
+ result: expected !== actual,
+ actual: actual,
+ expected: expected,
+ message: message,
+ negative: true
+ } );
+ },
+
+ "throws": function( block, expected, message ) {
+ var actual, expectedType,
+ expectedOutput = expected,
+ ok = false,
+ currentTest = ( this instanceof Assert && this.test ) || QUnit.config.current;
+
+ // 'expected' is optional unless doing string comparison
+ if ( message == null && typeof expected === "string" ) {
+ message = expected;
+ expected = null;
+ }
+
+ currentTest.ignoreGlobalErrors = true;
+ try {
+ block.call( currentTest.testEnvironment );
+ } catch ( e ) {
+ actual = e;
+ }
+ currentTest.ignoreGlobalErrors = false;
+
+ if ( actual ) {
+ expectedType = QUnit.objectType( expected );
+
+ // We don't want to validate thrown error
+ if ( !expected ) {
+ ok = true;
+ expectedOutput = null;
+
+ // Expected is a regexp
+ } else if ( expectedType === "regexp" ) {
+ ok = expected.test( errorString( actual ) );
+
+ // Expected is a string
+ } else if ( expectedType === "string" ) {
+ ok = expected === errorString( actual );
+
+ // Expected is a constructor, maybe an Error constructor
+ } else if ( expectedType === "function" && actual instanceof expected ) {
+ ok = true;
+
+ // Expected is an Error object
+ } else if ( expectedType === "object" ) {
+ ok = actual instanceof expected.constructor &&
+ actual.name === expected.name &&
+ actual.message === expected.message;
+
+ // Expected is a validation function which returns true if validation passed
+ } else if ( expectedType === "function" && expected.call( {}, actual ) === true ) {
+ expectedOutput = null;
+ ok = true;
+ }
+ }
+
+ currentTest.assert.pushResult( {
+ result: ok,
+ actual: actual,
+ expected: expectedOutput,
+ message: message
+ } );
+ }
+};
+
+// Provide an alternative to assert.throws(), for environments that consider throws a reserved word
+// Known to us are: Closure Compiler, Narwhal
+( function() {
+ /*jshint sub:true */
+ Assert.prototype.raises = Assert.prototype [ "throws" ]; //jscs:ignore requireDotNotation
+}() );
+
+function errorString( error ) {
+ var name, message,
+ resultErrorString = error.toString();
+ if ( resultErrorString.substring( 0, 7 ) === "[object" ) {
+ name = error.name ? error.name.toString() : "Error";
+ message = error.message ? error.message.toString() : "";
+ if ( name && message ) {
+ return name + ": " + message;
+ } else if ( name ) {
+ return name;
+ } else if ( message ) {
+ return message;
+ } else {
+ return "Error";
+ }
+ } else {
+ return resultErrorString;
+ }
+}
+
+// Test for equality any JavaScript type.
+// Author: Philippe Rathé
+QUnit.equiv = ( function() {
+
+ // Stack to decide between skip/abort functions
+ var callers = [];
+
+ // Stack to avoiding loops from circular referencing
+ var parents = [];
+ var parentsB = [];
+
+ var getProto = Object.getPrototypeOf || function( obj ) {
+
+ /*jshint proto: true */
+ return obj.__proto__;
+ };
+
+ function useStrictEquality( b, a ) {
+
+ // To catch short annotation VS 'new' annotation of a declaration. e.g.:
+ // `var i = 1;`
+ // `var j = new Number(1);`
+ if ( typeof a === "object" ) {
+ a = a.valueOf();
+ }
+ if ( typeof b === "object" ) {
+ b = b.valueOf();
+ }
+
+ return a === b;
+ }
+
+ function compareConstructors( a, b ) {
+ var protoA = getProto( a );
+ var protoB = getProto( b );
+
+ // Comparing constructors is more strict than using `instanceof`
+ if ( a.constructor === b.constructor ) {
+ return true;
+ }
+
+ // Ref #851
+ // If the obj prototype descends from a null constructor, treat it
+ // as a null prototype.
+ if ( protoA && protoA.constructor === null ) {
+ protoA = null;
+ }
+ if ( protoB && protoB.constructor === null ) {
+ protoB = null;
+ }
+
+ // Allow objects with no prototype to be equivalent to
+ // objects with Object as their constructor.
+ if ( ( protoA === null && protoB === Object.prototype ) ||
+ ( protoB === null && protoA === Object.prototype ) ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ function getRegExpFlags( regexp ) {
+ return "flags" in regexp ? regexp.flags : regexp.toString().match( /[gimuy]*$/ )[ 0 ];
+ }
+
+ var callbacks = {
+ "string": useStrictEquality,
+ "boolean": useStrictEquality,
+ "number": useStrictEquality,
+ "null": useStrictEquality,
+ "undefined": useStrictEquality,
+ "symbol": useStrictEquality,
+ "date": useStrictEquality,
+
+ "nan": function() {
+ return true;
+ },
+
+ "regexp": function( b, a ) {
+ return a.source === b.source &&
+
+ // Include flags in the comparison
+ getRegExpFlags( a ) === getRegExpFlags( b );
+ },
+
+ // - skip when the property is a method of an instance (OOP)
+ // - abort otherwise,
+ // initial === would have catch identical references anyway
+ "function": function() {
+ var caller = callers[ callers.length - 1 ];
+ return caller !== Object && typeof caller !== "undefined";
+ },
+
+ "array": function( b, a ) {
+ var i, j, len, loop, aCircular, bCircular;
+
+ len = a.length;
+ if ( len !== b.length ) {
+
+ // Safe and faster
+ return false;
+ }
+
+ // Track reference to avoid circular references
+ parents.push( a );
+ parentsB.push( b );
+ for ( i = 0; i < len; i++ ) {
+ loop = false;
+ for ( j = 0; j < parents.length; j++ ) {
+ aCircular = parents[ j ] === a[ i ];
+ bCircular = parentsB[ j ] === b[ i ];
+ if ( aCircular || bCircular ) {
+ if ( a[ i ] === b[ i ] || aCircular && bCircular ) {
+ loop = true;
+ } else {
+ parents.pop();
+ parentsB.pop();
+ return false;
+ }
+ }
+ }
+ if ( !loop && !innerEquiv( a[ i ], b[ i ] ) ) {
+ parents.pop();
+ parentsB.pop();
+ return false;
+ }
+ }
+ parents.pop();
+ parentsB.pop();
+ return true;
+ },
+
+ "set": function( b, a ) {
+ var innerEq,
+ outerEq = true;
+
+ if ( a.size !== b.size ) {
+ return false;
+ }
+
+ a.forEach( function( aVal ) {
+ innerEq = false;
+
+ b.forEach( function( bVal ) {
+ if ( innerEquiv( bVal, aVal ) ) {
+ innerEq = true;
+ }
+ } );
+
+ if ( !innerEq ) {
+ outerEq = false;
+ }
+ } );
+
+ return outerEq;
+ },
+
+ "map": function( b, a ) {
+ var innerEq,
+ outerEq = true;
+
+ if ( a.size !== b.size ) {
+ return false;
+ }
+
+ a.forEach( function( aVal, aKey ) {
+ innerEq = false;
+
+ b.forEach( function( bVal, bKey ) {
+ if ( innerEquiv( [ bVal, bKey ], [ aVal, aKey ] ) ) {
+ innerEq = true;
+ }
+ } );
+
+ if ( !innerEq ) {
+ outerEq = false;
+ }
+ } );
+
+ return outerEq;
+ },
+
+ "object": function( b, a ) {
+ var i, j, loop, aCircular, bCircular;
+
+ // Default to true
+ var eq = true;
+ var aProperties = [];
+ var bProperties = [];
+
+ if ( compareConstructors( a, b ) === false ) {
+ return false;
+ }
+
+ // Stack constructor before traversing properties
+ callers.push( a.constructor );
+
+ // Track reference to avoid circular references
+ parents.push( a );
+ parentsB.push( b );
+
+ // Be strict: don't ensure hasOwnProperty and go deep
+ for ( i in a ) {
+ loop = false;
+ for ( j = 0; j < parents.length; j++ ) {
+ aCircular = parents[ j ] === a[ i ];
+ bCircular = parentsB[ j ] === b[ i ];
+ if ( aCircular || bCircular ) {
+ if ( a[ i ] === b[ i ] || aCircular && bCircular ) {
+ loop = true;
+ } else {
+ eq = false;
+ break;
+ }
+ }
+ }
+ aProperties.push( i );
+ if ( !loop && !innerEquiv( a[ i ], b[ i ] ) ) {
+ eq = false;
+ break;
+ }
+ }
+
+ parents.pop();
+ parentsB.pop();
+
+ // Unstack, we are done
+ callers.pop();
+
+ for ( i in b ) {
+
+ // Collect b's properties
+ bProperties.push( i );
+ }
+
+ // Ensures identical properties name
+ return eq && innerEquiv( aProperties.sort(), bProperties.sort() );
+ }
+ };
+
+ function typeEquiv( a, b ) {
+ var type = QUnit.objectType( a );
+ return QUnit.objectType( b ) === type && callbacks[ type ]( b, a );
+ }
+
+ // The real equiv function
+ function innerEquiv( a, b ) {
+
+ // We're done when there's nothing more to compare
+ if ( arguments.length < 2 ) {
+ return true;
+ }
+
+ // Require type-specific equality
+ return ( a === b || typeEquiv( a, b ) ) &&
+
+ // ...across all consecutive argument pairs
+ ( arguments.length === 2 || innerEquiv.apply( this, [].slice.call( arguments, 1 ) ) );
+ }
+
+ return innerEquiv;
+}() );
+
+// Based on jsDump by Ariel Flesler
+// http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html
+QUnit.dump = ( function() {
+ function quote( str ) {
+ return "\"" + str.toString().replace( /\\/g, "\\\\" ).replace( /"/g, "\\\"" ) + "\"";
+ }
+ function literal( o ) {
+ return o + "";
+ }
+ function join( pre, arr, post ) {
+ var s = dump.separator(),
+ base = dump.indent(),
+ inner = dump.indent( 1 );
+ if ( arr.join ) {
+ arr = arr.join( "," + s + inner );
+ }
+ if ( !arr ) {
+ return pre + post;
+ }
+ return [ pre, inner + arr, base + post ].join( s );
+ }
+ function array( arr, stack ) {
+ var i = arr.length,
+ ret = new Array( i );
+
+ if ( dump.maxDepth && dump.depth > dump.maxDepth ) {
+ return "[object Array]";
+ }
+
+ this.up();
+ while ( i-- ) {
+ ret[ i ] = this.parse( arr[ i ], undefined, stack );
+ }
+ this.down();
+ return join( "[", ret, "]" );
+ }
+
+ var reName = /^function (\w+)/,
+ dump = {
+
+ // The objType is used mostly internally, you can fix a (custom) type in advance
+ parse: function( obj, objType, stack ) {
+ stack = stack || [];
+ var res, parser, parserType,
+ inStack = inArray( obj, stack );
+
+ if ( inStack !== -1 ) {
+ return "recursion(" + ( inStack - stack.length ) + ")";
+ }
+
+ objType = objType || this.typeOf( obj );
+ parser = this.parsers[ objType ];
+ parserType = typeof parser;
+
+ if ( parserType === "function" ) {
+ stack.push( obj );
+ res = parser.call( this, obj, stack );
+ stack.pop();
+ return res;
+ }
+ return ( parserType === "string" ) ? parser : this.parsers.error;
+ },
+ typeOf: function( obj ) {
+ var type;
+ if ( obj === null ) {
+ type = "null";
+ } else if ( typeof obj === "undefined" ) {
+ type = "undefined";
+ } else if ( QUnit.is( "regexp", obj ) ) {
+ type = "regexp";
+ } else if ( QUnit.is( "date", obj ) ) {
+ type = "date";
+ } else if ( QUnit.is( "function", obj ) ) {
+ type = "function";
+ } else if ( obj.setInterval !== undefined &&
+ obj.document !== undefined &&
+ obj.nodeType === undefined ) {
+ type = "window";
+ } else if ( obj.nodeType === 9 ) {
+ type = "document";
+ } else if ( obj.nodeType ) {
+ type = "node";
+ } else if (
+
+ // Native arrays
+ toString.call( obj ) === "[object Array]" ||
+
+ // NodeList objects
+ ( typeof obj.length === "number" && obj.item !== undefined &&
+ ( obj.length ? obj.item( 0 ) === obj[ 0 ] : ( obj.item( 0 ) === null &&
+ obj[ 0 ] === undefined ) ) )
+ ) {
+ type = "array";
+ } else if ( obj.constructor === Error.prototype.constructor ) {
+ type = "error";
+ } else {
+ type = typeof obj;
+ }
+ return type;
+ },
+
+ separator: function() {
+ return this.multiline ? this.HTML ? " " : "\n" : this.HTML ? " " : " ";
+ },
+
+ // Extra can be a number, shortcut for increasing-calling-decreasing
+ indent: function( extra ) {
+ if ( !this.multiline ) {
+ return "";
+ }
+ var chr = this.indentChar;
+ if ( this.HTML ) {
+ chr = chr.replace( /\t/g, " " ).replace( / /g, " " );
+ }
+ return new Array( this.depth + ( extra || 0 ) ).join( chr );
+ },
+ up: function( a ) {
+ this.depth += a || 1;
+ },
+ down: function( a ) {
+ this.depth -= a || 1;
+ },
+ setParser: function( name, parser ) {
+ this.parsers[ name ] = parser;
+ },
+
+ // The next 3 are exposed so you can use them
+ quote: quote,
+ literal: literal,
+ join: join,
+ depth: 1,
+ maxDepth: QUnit.config.maxDepth,
+
+ // This is the list of parsers, to modify them, use dump.setParser
+ parsers: {
+ window: "[Window]",
+ document: "[Document]",
+ error: function( error ) {
+ return "Error(\"" + error.message + "\")";
+ },
+ unknown: "[Unknown]",
+ "null": "null",
+ "undefined": "undefined",
+ "function": function( fn ) {
+ var ret = "function",
+
+ // Functions never have name in IE
+ name = "name" in fn ? fn.name : ( reName.exec( fn ) || [] )[ 1 ];
+
+ if ( name ) {
+ ret += " " + name;
+ }
+ ret += "(";
+
+ ret = [ ret, dump.parse( fn, "functionArgs" ), "){" ].join( "" );
+ return join( ret, dump.parse( fn, "functionCode" ), "}" );
+ },
+ array: array,
+ nodelist: array,
+ "arguments": array,
+ object: function( map, stack ) {
+ var keys, key, val, i, nonEnumerableProperties,
+ ret = [];
+
+ if ( dump.maxDepth && dump.depth > dump.maxDepth ) {
+ return "[object Object]";
+ }
+
+ dump.up();
+ keys = [];
+ for ( key in map ) {
+ keys.push( key );
+ }
+
+ // Some properties are not always enumerable on Error objects.
+ nonEnumerableProperties = [ "message", "name" ];
+ for ( i in nonEnumerableProperties ) {
+ key = nonEnumerableProperties[ i ];
+ if ( key in map && inArray( key, keys ) < 0 ) {
+ keys.push( key );
+ }
+ }
+ keys.sort();
+ for ( i = 0; i < keys.length; i++ ) {
+ key = keys[ i ];
+ val = map[ key ];
+ ret.push( dump.parse( key, "key" ) + ": " +
+ dump.parse( val, undefined, stack ) );
+ }
+ dump.down();
+ return join( "{", ret, "}" );
+ },
+ node: function( node ) {
+ var len, i, val,
+ open = dump.HTML ? "<" : "<",
+ close = dump.HTML ? ">" : ">",
+ tag = node.nodeName.toLowerCase(),
+ ret = open + tag,
+ attrs = node.attributes;
+
+ if ( attrs ) {
+ for ( i = 0, len = attrs.length; i < len; i++ ) {
+ val = attrs[ i ].nodeValue;
+
+ // IE6 includes all attributes in .attributes, even ones not explicitly
+ // set. Those have values like undefined, null, 0, false, "" or
+ // "inherit".
+ if ( val && val !== "inherit" ) {
+ ret += " " + attrs[ i ].nodeName + "=" +
+ dump.parse( val, "attribute" );
+ }
+ }
+ }
+ ret += close;
+
+ // Show content of TextNode or CDATASection
+ if ( node.nodeType === 3 || node.nodeType === 4 ) {
+ ret += node.nodeValue;
+ }
+
+ return ret + open + "/" + tag + close;
+ },
+
+ // Function calls it internally, it's the arguments part of the function
+ functionArgs: function( fn ) {
+ var args,
+ l = fn.length;
+
+ if ( !l ) {
+ return "";
+ }
+
+ args = new Array( l );
+ while ( l-- ) {
+
+ // 97 is 'a'
+ args[ l ] = String.fromCharCode( 97 + l );
+ }
+ return " " + args.join( ", " ) + " ";
+ },
+
+ // Object calls it internally, the key part of an item in a map
+ key: quote,
+
+ // Function calls it internally, it's the content of the function
+ functionCode: "[code]",
+
+ // Node calls it internally, it's a html attribute value
+ attribute: quote,
+ string: quote,
+ date: quote,
+ regexp: literal,
+ number: literal,
+ "boolean": literal
+ },
+
+ // If true, entities are escaped ( <, >, \t, space and \n )
+ HTML: false,
+
+ // Indentation unit
+ indentChar: " ",
+
+ // If true, items in a collection, are separated by a \n, else just a space.
+ multiline: true
+ };
+
+ return dump;
+}() );
+
+// Back compat
+QUnit.jsDump = QUnit.dump;
+
+// Deprecated
+// Extend assert methods to QUnit for Backwards compatibility
+( function() {
+ var i,
+ assertions = Assert.prototype;
+
+ function applyCurrent( current ) {
+ return function() {
+ var assert = new Assert( QUnit.config.current );
+ current.apply( assert, arguments );
+ };
+ }
+
+ for ( i in assertions ) {
+ QUnit[ i ] = applyCurrent( assertions[ i ] );
+ }
+}() );
+
+// For browser, export only select globals
+if ( defined.document ) {
+
+ ( function() {
+ var i, l,
+ keys = [
+ "test",
+ "module",
+ "expect",
+ "asyncTest",
+ "start",
+ "stop",
+ "ok",
+ "notOk",
+ "equal",
+ "notEqual",
+ "propEqual",
+ "notPropEqual",
+ "deepEqual",
+ "notDeepEqual",
+ "strictEqual",
+ "notStrictEqual",
+ "throws",
+ "raises"
+ ];
+
+ for ( i = 0, l = keys.length; i < l; i++ ) {
+ window[ keys[ i ] ] = QUnit[ keys[ i ] ];
+ }
+ }() );
+
+ window.QUnit = QUnit;
+}
+
+// For nodejs
+if ( typeof module !== "undefined" && module && module.exports ) {
+ module.exports = QUnit;
+
+ // For consistency with CommonJS environments' exports
+ module.exports.QUnit = QUnit;
+}
+
+// For CommonJS with exports, but without module.exports, like Rhino
+if ( typeof exports !== "undefined" && exports ) {
+ exports.QUnit = QUnit;
+}
+
+if ( typeof define === "function" && define.amd ) {
+ define( function() {
+ return QUnit;
+ } );
+ QUnit.config.autostart = false;
+}
+
+// Get a reference to the global object, like window in browsers
+}( ( function() {
+ return this;
+}() ) ) );
+
+( function() {
+
+// Only interact with URLs via window.location
+var location = typeof window !== "undefined" && window.location;
+if ( !location ) {
+ return;
+}
+
+var urlParams = getUrlParams();
+
+QUnit.urlParams = urlParams;
+
+// Match module/test by inclusion in an array
+QUnit.config.moduleId = [].concat( urlParams.moduleId || [] );
+QUnit.config.testId = [].concat( urlParams.testId || [] );
+
+// Exact case-insensitive match of the module name
+QUnit.config.module = urlParams.module;
+
+// Regular expression or case-insenstive substring match against "moduleName: testName"
+QUnit.config.filter = urlParams.filter;
+
+// Test order randomization
+if ( urlParams.seed === true ) {
+
+ // Generate a random seed if the option is specified without a value
+ QUnit.config.seed = Math.random().toString( 36 ).slice( 2 );
+} else if ( urlParams.seed ) {
+ QUnit.config.seed = urlParams.seed;
+}
+
+// Add URL-parameter-mapped config values with UI form rendering data
+QUnit.config.urlConfig.push(
+ {
+ id: "hidepassed",
+ label: "Hide passed tests",
+ tooltip: "Only show tests and assertions that fail. Stored as query-strings."
+ },
+ {
+ id: "noglobals",
+ label: "Check for Globals",
+ tooltip: "Enabling this will test if any test introduces new properties on the " +
+ "global object (`window` in Browsers). Stored as query-strings."
+ },
+ {
+ id: "notrycatch",
+ label: "No try-catch",
+ tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging " +
+ "exceptions in IE reasonable. Stored as query-strings."
+ }
+);
+
+QUnit.begin( function() {
+ var i, option,
+ urlConfig = QUnit.config.urlConfig;
+
+ for ( i = 0; i < urlConfig.length; i++ ) {
+
+ // Options can be either strings or objects with nonempty "id" properties
+ option = QUnit.config.urlConfig[ i ];
+ if ( typeof option !== "string" ) {
+ option = option.id;
+ }
+
+ if ( QUnit.config[ option ] === undefined ) {
+ QUnit.config[ option ] = urlParams[ option ];
+ }
+ }
+} );
+
+function getUrlParams() {
+ var i, param, name, value;
+ var urlParams = {};
+ var params = location.search.slice( 1 ).split( "&" );
+ var length = params.length;
+
+ for ( i = 0; i < length; i++ ) {
+ if ( params[ i ] ) {
+ param = params[ i ].split( "=" );
+ name = decodeURIComponent( param[ 0 ] );
+
+ // Allow just a key to turn on a flag, e.g., test.html?noglobals
+ value = param.length === 1 ||
+ decodeURIComponent( param.slice( 1 ).join( "=" ) ) ;
+ if ( urlParams[ name ] ) {
+ urlParams[ name ] = [].concat( urlParams[ name ], value );
+ } else {
+ urlParams[ name ] = value;
+ }
+ }
+ }
+
+ return urlParams;
+}
+
+// Don't load the HTML Reporter on non-browser environments
+if ( typeof window === "undefined" || !window.document ) {
+ return;
+}
+
+// Deprecated QUnit.init - Ref #530
+// Re-initialize the configuration options
+QUnit.init = function() {
+ var config = QUnit.config;
+
+ config.stats = { all: 0, bad: 0 };
+ config.moduleStats = { all: 0, bad: 0 };
+ config.started = 0;
+ config.updateRate = 1000;
+ config.blocking = false;
+ config.autostart = true;
+ config.autorun = false;
+ config.filter = "";
+ config.queue = [];
+
+ appendInterface();
+};
+
+var config = QUnit.config,
+ document = window.document,
+ collapseNext = false,
+ hasOwn = Object.prototype.hasOwnProperty,
+ unfilteredUrl = setUrl( { filter: undefined, module: undefined,
+ moduleId: undefined, testId: undefined } ),
+ defined = {
+ sessionStorage: ( function() {
+ var x = "qunit-test-string";
+ try {
+ sessionStorage.setItem( x, x );
+ sessionStorage.removeItem( x );
+ return true;
+ } catch ( e ) {
+ return false;
+ }
+ }() )
+ },
+ modulesList = [];
+
+/**
+* Escape text for attribute or text content.
+*/
+function escapeText( s ) {
+ if ( !s ) {
+ return "";
+ }
+ s = s + "";
+
+ // Both single quotes and double quotes (for attributes)
+ return s.replace( /['"<>&]/g, function( s ) {
+ switch ( s ) {
+ case "'":
+ return "'";
+ case "\"":
+ return """;
+ case "<":
+ return "<";
+ case ">":
+ return ">";
+ case "&":
+ return "&";
+ }
+ } );
+}
+
+/**
+ * @param {HTMLElement} elem
+ * @param {string} type
+ * @param {Function} fn
+ */
+function addEvent( elem, type, fn ) {
+ if ( elem.addEventListener ) {
+
+ // Standards-based browsers
+ elem.addEventListener( type, fn, false );
+ } else if ( elem.attachEvent ) {
+
+ // Support: IE <9
+ elem.attachEvent( "on" + type, function() {
+ var event = window.event;
+ if ( !event.target ) {
+ event.target = event.srcElement || document;
+ }
+
+ fn.call( elem, event );
+ } );
+ }
+}
+
+/**
+ * @param {Array|NodeList} elems
+ * @param {string} type
+ * @param {Function} fn
+ */
+function addEvents( elems, type, fn ) {
+ var i = elems.length;
+ while ( i-- ) {
+ addEvent( elems[ i ], type, fn );
+ }
+}
+
+function hasClass( elem, name ) {
+ return ( " " + elem.className + " " ).indexOf( " " + name + " " ) >= 0;
+}
+
+function addClass( elem, name ) {
+ if ( !hasClass( elem, name ) ) {
+ elem.className += ( elem.className ? " " : "" ) + name;
+ }
+}
+
+function toggleClass( elem, name, force ) {
+ if ( force || typeof force === "undefined" && !hasClass( elem, name ) ) {
+ addClass( elem, name );
+ } else {
+ removeClass( elem, name );
+ }
+}
+
+function removeClass( elem, name ) {
+ var set = " " + elem.className + " ";
+
+ // Class name may appear multiple times
+ while ( set.indexOf( " " + name + " " ) >= 0 ) {
+ set = set.replace( " " + name + " ", " " );
+ }
+
+ // Trim for prettiness
+ elem.className = typeof set.trim === "function" ? set.trim() : set.replace( /^\s+|\s+$/g, "" );
+}
+
+function id( name ) {
+ return document.getElementById && document.getElementById( name );
+}
+
+function getUrlConfigHtml() {
+ var i, j, val,
+ escaped, escapedTooltip,
+ selection = false,
+ urlConfig = config.urlConfig,
+ urlConfigHtml = "";
+
+ for ( i = 0; i < urlConfig.length; i++ ) {
+
+ // Options can be either strings or objects with nonempty "id" properties
+ val = config.urlConfig[ i ];
+ if ( typeof val === "string" ) {
+ val = {
+ id: val,
+ label: val
+ };
+ }
+
+ escaped = escapeText( val.id );
+ escapedTooltip = escapeText( val.tooltip );
+
+ if ( !val.value || typeof val.value === "string" ) {
+ urlConfigHtml += "" + val.label + " ";
+ } else {
+ urlConfigHtml += "" + val.label +
+ ": ";
+
+ if ( QUnit.is( "array", val.value ) ) {
+ for ( j = 0; j < val.value.length; j++ ) {
+ escaped = escapeText( val.value[ j ] );
+ urlConfigHtml += "" + escaped + " ";
+ }
+ } else {
+ for ( j in val.value ) {
+ if ( hasOwn.call( val.value, j ) ) {
+ urlConfigHtml += "" + escapeText( val.value[ j ] ) + " ";
+ }
+ }
+ }
+ if ( config[ val.id ] && !selection ) {
+ escaped = escapeText( config[ val.id ] );
+ urlConfigHtml += "" + escaped + " ";
+ }
+ urlConfigHtml += " ";
+ }
+ }
+
+ return urlConfigHtml;
+}
+
+// Handle "click" events on toolbar checkboxes and "change" for select menus.
+// Updates the URL with the new state of `config.urlConfig` values.
+function toolbarChanged() {
+ var updatedUrl, value, tests,
+ field = this,
+ params = {};
+
+ // Detect if field is a select menu or a checkbox
+ if ( "selectedIndex" in field ) {
+ value = field.options[ field.selectedIndex ].value || undefined;
+ } else {
+ value = field.checked ? ( field.defaultValue || true ) : undefined;
+ }
+
+ params[ field.name ] = value;
+ updatedUrl = setUrl( params );
+
+ // Check if we can apply the change without a page refresh
+ if ( "hidepassed" === field.name && "replaceState" in window.history ) {
+ QUnit.urlParams[ field.name ] = value;
+ config[ field.name ] = value || false;
+ tests = id( "qunit-tests" );
+ if ( tests ) {
+ toggleClass( tests, "hidepass", value || false );
+ }
+ window.history.replaceState( null, "", updatedUrl );
+ } else {
+ window.location = updatedUrl;
+ }
+}
+
+function setUrl( params ) {
+ var key, arrValue, i,
+ querystring = "?",
+ location = window.location;
+
+ params = QUnit.extend( QUnit.extend( {}, QUnit.urlParams ), params );
+
+ for ( key in params ) {
+
+ // Skip inherited or undefined properties
+ if ( hasOwn.call( params, key ) && params[ key ] !== undefined ) {
+
+ // Output a parameter for each value of this key (but usually just one)
+ arrValue = [].concat( params[ key ] );
+ for ( i = 0; i < arrValue.length; i++ ) {
+ querystring += encodeURIComponent( key );
+ if ( arrValue[ i ] !== true ) {
+ querystring += "=" + encodeURIComponent( arrValue[ i ] );
+ }
+ querystring += "&";
+ }
+ }
+ }
+ return location.protocol + "//" + location.host +
+ location.pathname + querystring.slice( 0, -1 );
+}
+
+function applyUrlParams() {
+ var selectedModule,
+ modulesList = id( "qunit-modulefilter" ),
+ filter = id( "qunit-filter-input" ).value;
+
+ selectedModule = modulesList ?
+ decodeURIComponent( modulesList.options[ modulesList.selectedIndex ].value ) :
+ undefined;
+
+ window.location = setUrl( {
+ module: ( selectedModule === "" ) ? undefined : selectedModule,
+ filter: ( filter === "" ) ? undefined : filter,
+
+ // Remove moduleId and testId filters
+ moduleId: undefined,
+ testId: undefined
+ } );
+}
+
+function toolbarUrlConfigContainer() {
+ var urlConfigContainer = document.createElement( "span" );
+
+ urlConfigContainer.innerHTML = getUrlConfigHtml();
+ addClass( urlConfigContainer, "qunit-url-config" );
+
+ // For oldIE support:
+ // * Add handlers to the individual elements instead of the container
+ // * Use "click" instead of "change" for checkboxes
+ addEvents( urlConfigContainer.getElementsByTagName( "input" ), "click", toolbarChanged );
+ addEvents( urlConfigContainer.getElementsByTagName( "select" ), "change", toolbarChanged );
+
+ return urlConfigContainer;
+}
+
+function toolbarLooseFilter() {
+ var filter = document.createElement( "form" ),
+ label = document.createElement( "label" ),
+ input = document.createElement( "input" ),
+ button = document.createElement( "button" );
+
+ addClass( filter, "qunit-filter" );
+
+ label.innerHTML = "Filter: ";
+
+ input.type = "text";
+ input.value = config.filter || "";
+ input.name = "filter";
+ input.id = "qunit-filter-input";
+
+ button.innerHTML = "Go";
+
+ label.appendChild( input );
+
+ filter.appendChild( label );
+ filter.appendChild( button );
+ addEvent( filter, "submit", function( ev ) {
+ applyUrlParams();
+
+ if ( ev && ev.preventDefault ) {
+ ev.preventDefault();
+ }
+
+ return false;
+ } );
+
+ return filter;
+}
+
+function toolbarModuleFilterHtml() {
+ var i,
+ moduleFilterHtml = "";
+
+ if ( !modulesList.length ) {
+ return false;
+ }
+
+ moduleFilterHtml += "Module: " +
+ "< All Modules > ";
+
+ for ( i = 0; i < modulesList.length; i++ ) {
+ moduleFilterHtml += "" + escapeText( modulesList[ i ] ) + " ";
+ }
+ moduleFilterHtml += " ";
+
+ return moduleFilterHtml;
+}
+
+function toolbarModuleFilter() {
+ var toolbar = id( "qunit-testrunner-toolbar" ),
+ moduleFilter = document.createElement( "span" ),
+ moduleFilterHtml = toolbarModuleFilterHtml();
+
+ if ( !toolbar || !moduleFilterHtml ) {
+ return false;
+ }
+
+ moduleFilter.setAttribute( "id", "qunit-modulefilter-container" );
+ moduleFilter.innerHTML = moduleFilterHtml;
+
+ addEvent( moduleFilter.lastChild, "change", applyUrlParams );
+
+ toolbar.appendChild( moduleFilter );
+}
+
+function appendToolbar() {
+ var toolbar = id( "qunit-testrunner-toolbar" );
+
+ if ( toolbar ) {
+ toolbar.appendChild( toolbarUrlConfigContainer() );
+ toolbar.appendChild( toolbarLooseFilter() );
+ toolbarModuleFilter();
+ }
+}
+
+function appendHeader() {
+ var header = id( "qunit-header" );
+
+ if ( header ) {
+ header.innerHTML = "" + header.innerHTML +
+ " ";
+ }
+}
+
+function appendBanner() {
+ var banner = id( "qunit-banner" );
+
+ if ( banner ) {
+ banner.className = "";
+ }
+}
+
+function appendTestResults() {
+ var tests = id( "qunit-tests" ),
+ result = id( "qunit-testresult" );
+
+ if ( result ) {
+ result.parentNode.removeChild( result );
+ }
+
+ if ( tests ) {
+ tests.innerHTML = "";
+ result = document.createElement( "p" );
+ result.id = "qunit-testresult";
+ result.className = "result";
+ tests.parentNode.insertBefore( result, tests );
+ result.innerHTML = "Running... ";
+ }
+}
+
+function storeFixture() {
+ var fixture = id( "qunit-fixture" );
+ if ( fixture ) {
+ config.fixture = fixture.innerHTML;
+ }
+}
+
+function appendFilteredTest() {
+ var testId = QUnit.config.testId;
+ if ( !testId || testId.length <= 0 ) {
+ return "";
+ }
+ return "Rerunning selected tests: " +
+ escapeText( testId.join( ", " ) ) +
+ "
Run all tests ";
+}
+
+function appendUserAgent() {
+ var userAgent = id( "qunit-userAgent" );
+
+ if ( userAgent ) {
+ userAgent.innerHTML = "";
+ userAgent.appendChild(
+ document.createTextNode(
+ "QUnit " + QUnit.version + "; " + navigator.userAgent
+ )
+ );
+ }
+}
+
+function appendInterface() {
+ var qunit = id( "qunit" );
+
+ if ( qunit ) {
+ qunit.innerHTML =
+ "" +
+ " " +
+ "
" +
+ appendFilteredTest() +
+ " " +
+ " ";
+ }
+
+ appendHeader();
+ appendBanner();
+ appendTestResults();
+ appendUserAgent();
+ appendToolbar();
+}
+
+function appendTestsList( modules ) {
+ var i, l, x, z, test, moduleObj;
+
+ for ( i = 0, l = modules.length; i < l; i++ ) {
+ moduleObj = modules[ i ];
+
+ for ( x = 0, z = moduleObj.tests.length; x < z; x++ ) {
+ test = moduleObj.tests[ x ];
+
+ appendTest( test.name, test.testId, moduleObj.name );
+ }
+ }
+}
+
+function appendTest( name, testId, moduleName ) {
+ var title, rerunTrigger, testBlock, assertList,
+ tests = id( "qunit-tests" );
+
+ if ( !tests ) {
+ return;
+ }
+
+ title = document.createElement( "strong" );
+ title.innerHTML = getNameHtml( name, moduleName );
+
+ rerunTrigger = document.createElement( "a" );
+ rerunTrigger.innerHTML = "Rerun";
+ rerunTrigger.href = setUrl( { testId: testId } );
+
+ testBlock = document.createElement( "li" );
+ testBlock.appendChild( title );
+ testBlock.appendChild( rerunTrigger );
+ testBlock.id = "qunit-test-output-" + testId;
+
+ assertList = document.createElement( "ol" );
+ assertList.className = "qunit-assert-list";
+
+ testBlock.appendChild( assertList );
+
+ tests.appendChild( testBlock );
+}
+
+// HTML Reporter initialization and load
+QUnit.begin( function( details ) {
+ var i, moduleObj, tests;
+
+ // Sort modules by name for the picker
+ for ( i = 0; i < details.modules.length; i++ ) {
+ moduleObj = details.modules[ i ];
+ if ( moduleObj.name ) {
+ modulesList.push( moduleObj.name );
+ }
+ }
+ modulesList.sort( function( a, b ) {
+ return a.localeCompare( b );
+ } );
+
+ // Capture fixture HTML from the page
+ storeFixture();
+
+ // Initialize QUnit elements
+ appendInterface();
+ appendTestsList( details.modules );
+ tests = id( "qunit-tests" );
+ if ( tests && config.hidepassed ) {
+ addClass( tests, "hidepass" );
+ }
+} );
+
+QUnit.done( function( details ) {
+ var i, key,
+ banner = id( "qunit-banner" ),
+ tests = id( "qunit-tests" ),
+ html = [
+ "Tests completed in ",
+ details.runtime,
+ " milliseconds. ",
+ "",
+ details.passed,
+ " assertions of ",
+ details.total,
+ " passed, ",
+ details.failed,
+ " failed."
+ ].join( "" );
+
+ if ( banner ) {
+ banner.className = details.failed ? "qunit-fail" : "qunit-pass";
+ }
+
+ if ( tests ) {
+ id( "qunit-testresult" ).innerHTML = html;
+ }
+
+ if ( config.altertitle && document.title ) {
+
+ // Show ✖ for good, ✔ for bad suite result in title
+ // use escape sequences in case file gets loaded with non-utf-8-charset
+ document.title = [
+ ( details.failed ? "\u2716" : "\u2714" ),
+ document.title.replace( /^[\u2714\u2716] /i, "" )
+ ].join( " " );
+ }
+
+ // Clear own sessionStorage items if all tests passed
+ if ( config.reorder && defined.sessionStorage && details.failed === 0 ) {
+ for ( i = 0; i < sessionStorage.length; i++ ) {
+ key = sessionStorage.key( i++ );
+ if ( key.indexOf( "qunit-test-" ) === 0 ) {
+ sessionStorage.removeItem( key );
+ }
+ }
+ }
+
+ // Scroll back to top to show results
+ if ( config.scrolltop && window.scrollTo ) {
+ window.scrollTo( 0, 0 );
+ }
+} );
+
+function getNameHtml( name, module ) {
+ var nameHtml = "";
+
+ if ( module ) {
+ nameHtml = "" + escapeText( module ) + " : ";
+ }
+
+ nameHtml += "" + escapeText( name ) + " ";
+
+ return nameHtml;
+}
+
+QUnit.testStart( function( details ) {
+ var running, testBlock, bad;
+
+ testBlock = id( "qunit-test-output-" + details.testId );
+ if ( testBlock ) {
+ testBlock.className = "running";
+ } else {
+
+ // Report later registered tests
+ appendTest( details.name, details.testId, details.module );
+ }
+
+ running = id( "qunit-testresult" );
+ if ( running ) {
+ bad = QUnit.config.reorder && defined.sessionStorage &&
+ +sessionStorage.getItem( "qunit-test-" + details.module + "-" + details.name );
+
+ running.innerHTML = ( bad ?
+ "Rerunning previously failed test: " :
+ "Running: " ) +
+ getNameHtml( details.name, details.module );
+ }
+
+} );
+
+function stripHtml( string ) {
+
+ // Strip tags, html entity and whitespaces
+ return string.replace( /<\/?[^>]+(>|$)/g, "" ).replace( /\"/g, "" ).replace( /\s+/g, "" );
+}
+
+QUnit.log( function( details ) {
+ var assertList, assertLi,
+ message, expected, actual, diff,
+ showDiff = false,
+ testItem = id( "qunit-test-output-" + details.testId );
+
+ if ( !testItem ) {
+ return;
+ }
+
+ message = escapeText( details.message ) || ( details.result ? "okay" : "failed" );
+ message = "" + message + " ";
+ message += "@ " + details.runtime + " ms ";
+
+ // The pushFailure doesn't provide details.expected
+ // when it calls, it's implicit to also not show expected and diff stuff
+ // Also, we need to check details.expected existence, as it can exist and be undefined
+ if ( !details.result && hasOwn.call( details, "expected" ) ) {
+ if ( details.negative ) {
+ expected = "NOT " + QUnit.dump.parse( details.expected );
+ } else {
+ expected = QUnit.dump.parse( details.expected );
+ }
+
+ actual = QUnit.dump.parse( details.actual );
+ message += "Expected: " +
+ escapeText( expected ) +
+ " ";
+
+ if ( actual !== expected ) {
+
+ message += "Result: " +
+ escapeText( actual ) + " ";
+
+ // Don't show diff if actual or expected are booleans
+ if ( !( /^(true|false)$/.test( actual ) ) &&
+ !( /^(true|false)$/.test( expected ) ) ) {
+ diff = QUnit.diff( expected, actual );
+ showDiff = stripHtml( diff ).length !==
+ stripHtml( expected ).length +
+ stripHtml( actual ).length;
+ }
+
+ // Don't show diff if expected and actual are totally different
+ if ( showDiff ) {
+ message += "Diff: " +
+ diff + " ";
+ }
+ } else if ( expected.indexOf( "[object Array]" ) !== -1 ||
+ expected.indexOf( "[object Object]" ) !== -1 ) {
+ message += "Message: " +
+ "Diff suppressed as the depth of object is more than current max depth (" +
+ QUnit.config.maxDepth + ").Hint: Use QUnit.dump.maxDepth to " +
+ " run with a higher max depth or " +
+ "Rerun without max depth.
";
+ } else {
+ message += "Message: " +
+ "Diff suppressed as the expected and actual results have an equivalent" +
+ " serialization ";
+ }
+
+ if ( details.source ) {
+ message += "Source: " +
+ escapeText( details.source ) + " ";
+ }
+
+ message += "
";
+
+ // This occurs when pushFailure is set and we have an extracted stack trace
+ } else if ( !details.result && details.source ) {
+ message += "" +
+ "Source: " +
+ escapeText( details.source ) + " " +
+ "
";
+ }
+
+ assertList = testItem.getElementsByTagName( "ol" )[ 0 ];
+
+ assertLi = document.createElement( "li" );
+ assertLi.className = details.result ? "pass" : "fail";
+ assertLi.innerHTML = message;
+ assertList.appendChild( assertLi );
+} );
+
+QUnit.testDone( function( details ) {
+ var testTitle, time, testItem, assertList,
+ good, bad, testCounts, skipped, sourceName,
+ tests = id( "qunit-tests" );
+
+ if ( !tests ) {
+ return;
+ }
+
+ testItem = id( "qunit-test-output-" + details.testId );
+
+ assertList = testItem.getElementsByTagName( "ol" )[ 0 ];
+
+ good = details.passed;
+ bad = details.failed;
+
+ // Store result when possible
+ if ( config.reorder && defined.sessionStorage ) {
+ if ( bad ) {
+ sessionStorage.setItem( "qunit-test-" + details.module + "-" + details.name, bad );
+ } else {
+ sessionStorage.removeItem( "qunit-test-" + details.module + "-" + details.name );
+ }
+ }
+
+ if ( bad === 0 ) {
+
+ // Collapse the passing tests
+ addClass( assertList, "qunit-collapsed" );
+ } else if ( bad && config.collapse && !collapseNext ) {
+
+ // Skip collapsing the first failing test
+ collapseNext = true;
+ } else {
+
+ // Collapse remaining tests
+ addClass( assertList, "qunit-collapsed" );
+ }
+
+ // The testItem.firstChild is the test name
+ testTitle = testItem.firstChild;
+
+ testCounts = bad ?
+ "" + bad + " , " + "" + good + " , " :
+ "";
+
+ testTitle.innerHTML += " (" + testCounts +
+ details.assertions.length + ") ";
+
+ if ( details.skipped ) {
+ testItem.className = "skipped";
+ skipped = document.createElement( "em" );
+ skipped.className = "qunit-skipped-label";
+ skipped.innerHTML = "skipped";
+ testItem.insertBefore( skipped, testTitle );
+ } else {
+ addEvent( testTitle, "click", function() {
+ toggleClass( assertList, "qunit-collapsed" );
+ } );
+
+ testItem.className = bad ? "fail" : "pass";
+
+ time = document.createElement( "span" );
+ time.className = "runtime";
+ time.innerHTML = details.runtime + " ms";
+ testItem.insertBefore( time, assertList );
+ }
+
+ // Show the source of the test when showing assertions
+ if ( details.source ) {
+ sourceName = document.createElement( "p" );
+ sourceName.innerHTML = "Source: " + details.source;
+ addClass( sourceName, "qunit-source" );
+ if ( bad === 0 ) {
+ addClass( sourceName, "qunit-collapsed" );
+ }
+ addEvent( testTitle, "click", function() {
+ toggleClass( sourceName, "qunit-collapsed" );
+ } );
+ testItem.appendChild( sourceName );
+ }
+} );
+
+// Avoid readyState issue with phantomjs
+// Ref: #818
+var notPhantom = ( function( p ) {
+ return !( p && p.version && p.version.major > 0 );
+} )( window.phantom );
+
+if ( notPhantom && document.readyState === "complete" ) {
+ QUnit.load();
+} else {
+ addEvent( window, "load", QUnit.load );
+}
+
+/*
+ * This file is a modified version of google-diff-match-patch's JavaScript implementation
+ * (https://code.google.com/p/google-diff-match-patch/source/browse/trunk/javascript/diff_match_patch_uncompressed.js),
+ * modifications are licensed as more fully set forth in LICENSE.txt.
+ *
+ * The original source of google-diff-match-patch is attributable and licensed as follows:
+ *
+ * Copyright 2006 Google Inc.
+ * https://code.google.com/p/google-diff-match-patch/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * More Info:
+ * https://code.google.com/p/google-diff-match-patch/
+ *
+ * Usage: QUnit.diff(expected, actual)
+ *
+ */
+QUnit.diff = ( function() {
+ function DiffMatchPatch() {
+ }
+
+ // DIFF FUNCTIONS
+
+ /**
+ * The data structure representing a diff is an array of tuples:
+ * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
+ * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
+ */
+ var DIFF_DELETE = -1,
+ DIFF_INSERT = 1,
+ DIFF_EQUAL = 0;
+
+ /**
+ * Find the differences between two texts. Simplifies the problem by stripping
+ * any common prefix or suffix off the texts before diffing.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {boolean=} optChecklines Optional speedup flag. If present and false,
+ * then don't run a line-level diff first to identify the changed areas.
+ * Defaults to true, which does a faster, slightly less optimal diff.
+ * @return {!Array.} Array of diff tuples.
+ */
+ DiffMatchPatch.prototype.DiffMain = function( text1, text2, optChecklines ) {
+ var deadline, checklines, commonlength,
+ commonprefix, commonsuffix, diffs;
+
+ // The diff must be complete in up to 1 second.
+ deadline = ( new Date() ).getTime() + 1000;
+
+ // Check for null inputs.
+ if ( text1 === null || text2 === null ) {
+ throw new Error( "Null input. (DiffMain)" );
+ }
+
+ // Check for equality (speedup).
+ if ( text1 === text2 ) {
+ if ( text1 ) {
+ return [
+ [ DIFF_EQUAL, text1 ]
+ ];
+ }
+ return [];
+ }
+
+ if ( typeof optChecklines === "undefined" ) {
+ optChecklines = true;
+ }
+
+ checklines = optChecklines;
+
+ // Trim off common prefix (speedup).
+ commonlength = this.diffCommonPrefix( text1, text2 );
+ commonprefix = text1.substring( 0, commonlength );
+ text1 = text1.substring( commonlength );
+ text2 = text2.substring( commonlength );
+
+ // Trim off common suffix (speedup).
+ commonlength = this.diffCommonSuffix( text1, text2 );
+ commonsuffix = text1.substring( text1.length - commonlength );
+ text1 = text1.substring( 0, text1.length - commonlength );
+ text2 = text2.substring( 0, text2.length - commonlength );
+
+ // Compute the diff on the middle block.
+ diffs = this.diffCompute( text1, text2, checklines, deadline );
+
+ // Restore the prefix and suffix.
+ if ( commonprefix ) {
+ diffs.unshift( [ DIFF_EQUAL, commonprefix ] );
+ }
+ if ( commonsuffix ) {
+ diffs.push( [ DIFF_EQUAL, commonsuffix ] );
+ }
+ this.diffCleanupMerge( diffs );
+ return diffs;
+ };
+
+ /**
+ * Reduce the number of edits by eliminating operationally trivial equalities.
+ * @param {!Array.} diffs Array of diff tuples.
+ */
+ DiffMatchPatch.prototype.diffCleanupEfficiency = function( diffs ) {
+ var changes, equalities, equalitiesLength, lastequality,
+ pointer, preIns, preDel, postIns, postDel;
+ changes = false;
+ equalities = []; // Stack of indices where equalities are found.
+ equalitiesLength = 0; // Keeping our own length var is faster in JS.
+ /** @type {?string} */
+ lastequality = null;
+
+ // Always equal to diffs[equalities[equalitiesLength - 1]][1]
+ pointer = 0; // Index of current position.
+
+ // Is there an insertion operation before the last equality.
+ preIns = false;
+
+ // Is there a deletion operation before the last equality.
+ preDel = false;
+
+ // Is there an insertion operation after the last equality.
+ postIns = false;
+
+ // Is there a deletion operation after the last equality.
+ postDel = false;
+ while ( pointer < diffs.length ) {
+
+ // Equality found.
+ if ( diffs[ pointer ][ 0 ] === DIFF_EQUAL ) {
+ if ( diffs[ pointer ][ 1 ].length < 4 && ( postIns || postDel ) ) {
+
+ // Candidate found.
+ equalities[ equalitiesLength++ ] = pointer;
+ preIns = postIns;
+ preDel = postDel;
+ lastequality = diffs[ pointer ][ 1 ];
+ } else {
+
+ // Not a candidate, and can never become one.
+ equalitiesLength = 0;
+ lastequality = null;
+ }
+ postIns = postDel = false;
+
+ // An insertion or deletion.
+ } else {
+
+ if ( diffs[ pointer ][ 0 ] === DIFF_DELETE ) {
+ postDel = true;
+ } else {
+ postIns = true;
+ }
+
+ /*
+ * Five types to be split:
+ * A BXYC D
+ * A XC D
+ * A BXC
+ * AXC D
+ * A BXC
+ */
+ if ( lastequality && ( ( preIns && preDel && postIns && postDel ) ||
+ ( ( lastequality.length < 2 ) &&
+ ( preIns + preDel + postIns + postDel ) === 3 ) ) ) {
+
+ // Duplicate record.
+ diffs.splice(
+ equalities[ equalitiesLength - 1 ],
+ 0,
+ [ DIFF_DELETE, lastequality ]
+ );
+
+ // Change second copy to insert.
+ diffs[ equalities[ equalitiesLength - 1 ] + 1 ][ 0 ] = DIFF_INSERT;
+ equalitiesLength--; // Throw away the equality we just deleted;
+ lastequality = null;
+ if ( preIns && preDel ) {
+
+ // No changes made which could affect previous entry, keep going.
+ postIns = postDel = true;
+ equalitiesLength = 0;
+ } else {
+ equalitiesLength--; // Throw away the previous equality.
+ pointer = equalitiesLength > 0 ? equalities[ equalitiesLength - 1 ] : -1;
+ postIns = postDel = false;
+ }
+ changes = true;
+ }
+ }
+ pointer++;
+ }
+
+ if ( changes ) {
+ this.diffCleanupMerge( diffs );
+ }
+ };
+
+ /**
+ * Convert a diff array into a pretty HTML report.
+ * @param {!Array.} diffs Array of diff tuples.
+ * @param {integer} string to be beautified.
+ * @return {string} HTML representation.
+ */
+ DiffMatchPatch.prototype.diffPrettyHtml = function( diffs ) {
+ var op, data, x,
+ html = [];
+ for ( x = 0; x < diffs.length; x++ ) {
+ op = diffs[ x ][ 0 ]; // Operation (insert, delete, equal)
+ data = diffs[ x ][ 1 ]; // Text of change.
+ switch ( op ) {
+ case DIFF_INSERT:
+ html[ x ] = "" + escapeText( data ) + " ";
+ break;
+ case DIFF_DELETE:
+ html[ x ] = "" + escapeText( data ) + "";
+ break;
+ case DIFF_EQUAL:
+ html[ x ] = "" + escapeText( data ) + " ";
+ break;
+ }
+ }
+ return html.join( "" );
+ };
+
+ /**
+ * Determine the common prefix of two strings.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {number} The number of characters common to the start of each
+ * string.
+ */
+ DiffMatchPatch.prototype.diffCommonPrefix = function( text1, text2 ) {
+ var pointermid, pointermax, pointermin, pointerstart;
+
+ // Quick check for common null cases.
+ if ( !text1 || !text2 || text1.charAt( 0 ) !== text2.charAt( 0 ) ) {
+ return 0;
+ }
+
+ // Binary search.
+ // Performance analysis: https://neil.fraser.name/news/2007/10/09/
+ pointermin = 0;
+ pointermax = Math.min( text1.length, text2.length );
+ pointermid = pointermax;
+ pointerstart = 0;
+ while ( pointermin < pointermid ) {
+ if ( text1.substring( pointerstart, pointermid ) ===
+ text2.substring( pointerstart, pointermid ) ) {
+ pointermin = pointermid;
+ pointerstart = pointermin;
+ } else {
+ pointermax = pointermid;
+ }
+ pointermid = Math.floor( ( pointermax - pointermin ) / 2 + pointermin );
+ }
+ return pointermid;
+ };
+
+ /**
+ * Determine the common suffix of two strings.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {number} The number of characters common to the end of each string.
+ */
+ DiffMatchPatch.prototype.diffCommonSuffix = function( text1, text2 ) {
+ var pointermid, pointermax, pointermin, pointerend;
+
+ // Quick check for common null cases.
+ if ( !text1 ||
+ !text2 ||
+ text1.charAt( text1.length - 1 ) !== text2.charAt( text2.length - 1 ) ) {
+ return 0;
+ }
+
+ // Binary search.
+ // Performance analysis: https://neil.fraser.name/news/2007/10/09/
+ pointermin = 0;
+ pointermax = Math.min( text1.length, text2.length );
+ pointermid = pointermax;
+ pointerend = 0;
+ while ( pointermin < pointermid ) {
+ if ( text1.substring( text1.length - pointermid, text1.length - pointerend ) ===
+ text2.substring( text2.length - pointermid, text2.length - pointerend ) ) {
+ pointermin = pointermid;
+ pointerend = pointermin;
+ } else {
+ pointermax = pointermid;
+ }
+ pointermid = Math.floor( ( pointermax - pointermin ) / 2 + pointermin );
+ }
+ return pointermid;
+ };
+
+ /**
+ * Find the differences between two texts. Assumes that the texts do not
+ * have any common prefix or suffix.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {boolean} checklines Speedup flag. If false, then don't run a
+ * line-level diff first to identify the changed areas.
+ * If true, then run a faster, slightly less optimal diff.
+ * @param {number} deadline Time when the diff should be complete by.
+ * @return {!Array.} Array of diff tuples.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffCompute = function( text1, text2, checklines, deadline ) {
+ var diffs, longtext, shorttext, i, hm,
+ text1A, text2A, text1B, text2B,
+ midCommon, diffsA, diffsB;
+
+ if ( !text1 ) {
+
+ // Just add some text (speedup).
+ return [
+ [ DIFF_INSERT, text2 ]
+ ];
+ }
+
+ if ( !text2 ) {
+
+ // Just delete some text (speedup).
+ return [
+ [ DIFF_DELETE, text1 ]
+ ];
+ }
+
+ longtext = text1.length > text2.length ? text1 : text2;
+ shorttext = text1.length > text2.length ? text2 : text1;
+ i = longtext.indexOf( shorttext );
+ if ( i !== -1 ) {
+
+ // Shorter text is inside the longer text (speedup).
+ diffs = [
+ [ DIFF_INSERT, longtext.substring( 0, i ) ],
+ [ DIFF_EQUAL, shorttext ],
+ [ DIFF_INSERT, longtext.substring( i + shorttext.length ) ]
+ ];
+
+ // Swap insertions for deletions if diff is reversed.
+ if ( text1.length > text2.length ) {
+ diffs[ 0 ][ 0 ] = diffs[ 2 ][ 0 ] = DIFF_DELETE;
+ }
+ return diffs;
+ }
+
+ if ( shorttext.length === 1 ) {
+
+ // Single character string.
+ // After the previous speedup, the character can't be an equality.
+ return [
+ [ DIFF_DELETE, text1 ],
+ [ DIFF_INSERT, text2 ]
+ ];
+ }
+
+ // Check to see if the problem can be split in two.
+ hm = this.diffHalfMatch( text1, text2 );
+ if ( hm ) {
+
+ // A half-match was found, sort out the return data.
+ text1A = hm[ 0 ];
+ text1B = hm[ 1 ];
+ text2A = hm[ 2 ];
+ text2B = hm[ 3 ];
+ midCommon = hm[ 4 ];
+
+ // Send both pairs off for separate processing.
+ diffsA = this.DiffMain( text1A, text2A, checklines, deadline );
+ diffsB = this.DiffMain( text1B, text2B, checklines, deadline );
+
+ // Merge the results.
+ return diffsA.concat( [
+ [ DIFF_EQUAL, midCommon ]
+ ], diffsB );
+ }
+
+ if ( checklines && text1.length > 100 && text2.length > 100 ) {
+ return this.diffLineMode( text1, text2, deadline );
+ }
+
+ return this.diffBisect( text1, text2, deadline );
+ };
+
+ /**
+ * Do the two texts share a substring which is at least half the length of the
+ * longer text?
+ * This speedup can produce non-minimal diffs.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {Array.} Five element Array, containing the prefix of
+ * text1, the suffix of text1, the prefix of text2, the suffix of
+ * text2 and the common middle. Or null if there was no match.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffHalfMatch = function( text1, text2 ) {
+ var longtext, shorttext, dmp,
+ text1A, text2B, text2A, text1B, midCommon,
+ hm1, hm2, hm;
+
+ longtext = text1.length > text2.length ? text1 : text2;
+ shorttext = text1.length > text2.length ? text2 : text1;
+ if ( longtext.length < 4 || shorttext.length * 2 < longtext.length ) {
+ return null; // Pointless.
+ }
+ dmp = this; // 'this' becomes 'window' in a closure.
+
+ /**
+ * Does a substring of shorttext exist within longtext such that the substring
+ * is at least half the length of longtext?
+ * Closure, but does not reference any external variables.
+ * @param {string} longtext Longer string.
+ * @param {string} shorttext Shorter string.
+ * @param {number} i Start index of quarter length substring within longtext.
+ * @return {Array.} Five element Array, containing the prefix of
+ * longtext, the suffix of longtext, the prefix of shorttext, the suffix
+ * of shorttext and the common middle. Or null if there was no match.
+ * @private
+ */
+ function diffHalfMatchI( longtext, shorttext, i ) {
+ var seed, j, bestCommon, prefixLength, suffixLength,
+ bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB;
+
+ // Start with a 1/4 length substring at position i as a seed.
+ seed = longtext.substring( i, i + Math.floor( longtext.length / 4 ) );
+ j = -1;
+ bestCommon = "";
+ while ( ( j = shorttext.indexOf( seed, j + 1 ) ) !== -1 ) {
+ prefixLength = dmp.diffCommonPrefix( longtext.substring( i ),
+ shorttext.substring( j ) );
+ suffixLength = dmp.diffCommonSuffix( longtext.substring( 0, i ),
+ shorttext.substring( 0, j ) );
+ if ( bestCommon.length < suffixLength + prefixLength ) {
+ bestCommon = shorttext.substring( j - suffixLength, j ) +
+ shorttext.substring( j, j + prefixLength );
+ bestLongtextA = longtext.substring( 0, i - suffixLength );
+ bestLongtextB = longtext.substring( i + prefixLength );
+ bestShorttextA = shorttext.substring( 0, j - suffixLength );
+ bestShorttextB = shorttext.substring( j + prefixLength );
+ }
+ }
+ if ( bestCommon.length * 2 >= longtext.length ) {
+ return [ bestLongtextA, bestLongtextB,
+ bestShorttextA, bestShorttextB, bestCommon
+ ];
+ } else {
+ return null;
+ }
+ }
+
+ // First check if the second quarter is the seed for a half-match.
+ hm1 = diffHalfMatchI( longtext, shorttext,
+ Math.ceil( longtext.length / 4 ) );
+
+ // Check again based on the third quarter.
+ hm2 = diffHalfMatchI( longtext, shorttext,
+ Math.ceil( longtext.length / 2 ) );
+ if ( !hm1 && !hm2 ) {
+ return null;
+ } else if ( !hm2 ) {
+ hm = hm1;
+ } else if ( !hm1 ) {
+ hm = hm2;
+ } else {
+
+ // Both matched. Select the longest.
+ hm = hm1[ 4 ].length > hm2[ 4 ].length ? hm1 : hm2;
+ }
+
+ // A half-match was found, sort out the return data.
+ text1A, text1B, text2A, text2B;
+ if ( text1.length > text2.length ) {
+ text1A = hm[ 0 ];
+ text1B = hm[ 1 ];
+ text2A = hm[ 2 ];
+ text2B = hm[ 3 ];
+ } else {
+ text2A = hm[ 0 ];
+ text2B = hm[ 1 ];
+ text1A = hm[ 2 ];
+ text1B = hm[ 3 ];
+ }
+ midCommon = hm[ 4 ];
+ return [ text1A, text1B, text2A, text2B, midCommon ];
+ };
+
+ /**
+ * Do a quick line-level diff on both strings, then rediff the parts for
+ * greater accuracy.
+ * This speedup can produce non-minimal diffs.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {number} deadline Time when the diff should be complete by.
+ * @return {!Array.} Array of diff tuples.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffLineMode = function( text1, text2, deadline ) {
+ var a, diffs, linearray, pointer, countInsert,
+ countDelete, textInsert, textDelete, j;
+
+ // Scan the text on a line-by-line basis first.
+ a = this.diffLinesToChars( text1, text2 );
+ text1 = a.chars1;
+ text2 = a.chars2;
+ linearray = a.lineArray;
+
+ diffs = this.DiffMain( text1, text2, false, deadline );
+
+ // Convert the diff back to original text.
+ this.diffCharsToLines( diffs, linearray );
+
+ // Eliminate freak matches (e.g. blank lines)
+ this.diffCleanupSemantic( diffs );
+
+ // Rediff any replacement blocks, this time character-by-character.
+ // Add a dummy entry at the end.
+ diffs.push( [ DIFF_EQUAL, "" ] );
+ pointer = 0;
+ countDelete = 0;
+ countInsert = 0;
+ textDelete = "";
+ textInsert = "";
+ while ( pointer < diffs.length ) {
+ switch ( diffs[ pointer ][ 0 ] ) {
+ case DIFF_INSERT:
+ countInsert++;
+ textInsert += diffs[ pointer ][ 1 ];
+ break;
+ case DIFF_DELETE:
+ countDelete++;
+ textDelete += diffs[ pointer ][ 1 ];
+ break;
+ case DIFF_EQUAL:
+
+ // Upon reaching an equality, check for prior redundancies.
+ if ( countDelete >= 1 && countInsert >= 1 ) {
+
+ // Delete the offending records and add the merged ones.
+ diffs.splice( pointer - countDelete - countInsert,
+ countDelete + countInsert );
+ pointer = pointer - countDelete - countInsert;
+ a = this.DiffMain( textDelete, textInsert, false, deadline );
+ for ( j = a.length - 1; j >= 0; j-- ) {
+ diffs.splice( pointer, 0, a[ j ] );
+ }
+ pointer = pointer + a.length;
+ }
+ countInsert = 0;
+ countDelete = 0;
+ textDelete = "";
+ textInsert = "";
+ break;
+ }
+ pointer++;
+ }
+ diffs.pop(); // Remove the dummy entry at the end.
+
+ return diffs;
+ };
+
+ /**
+ * Find the 'middle snake' of a diff, split the problem in two
+ * and return the recursively constructed diff.
+ * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {number} deadline Time at which to bail if not yet complete.
+ * @return {!Array.} Array of diff tuples.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffBisect = function( text1, text2, deadline ) {
+ var text1Length, text2Length, maxD, vOffset, vLength,
+ v1, v2, x, delta, front, k1start, k1end, k2start,
+ k2end, k2Offset, k1Offset, x1, x2, y1, y2, d, k1, k2;
+
+ // Cache the text lengths to prevent multiple calls.
+ text1Length = text1.length;
+ text2Length = text2.length;
+ maxD = Math.ceil( ( text1Length + text2Length ) / 2 );
+ vOffset = maxD;
+ vLength = 2 * maxD;
+ v1 = new Array( vLength );
+ v2 = new Array( vLength );
+
+ // Setting all elements to -1 is faster in Chrome & Firefox than mixing
+ // integers and undefined.
+ for ( x = 0; x < vLength; x++ ) {
+ v1[ x ] = -1;
+ v2[ x ] = -1;
+ }
+ v1[ vOffset + 1 ] = 0;
+ v2[ vOffset + 1 ] = 0;
+ delta = text1Length - text2Length;
+
+ // If the total number of characters is odd, then the front path will collide
+ // with the reverse path.
+ front = ( delta % 2 !== 0 );
+
+ // Offsets for start and end of k loop.
+ // Prevents mapping of space beyond the grid.
+ k1start = 0;
+ k1end = 0;
+ k2start = 0;
+ k2end = 0;
+ for ( d = 0; d < maxD; d++ ) {
+
+ // Bail out if deadline is reached.
+ if ( ( new Date() ).getTime() > deadline ) {
+ break;
+ }
+
+ // Walk the front path one step.
+ for ( k1 = -d + k1start; k1 <= d - k1end; k1 += 2 ) {
+ k1Offset = vOffset + k1;
+ if ( k1 === -d || ( k1 !== d && v1[ k1Offset - 1 ] < v1[ k1Offset + 1 ] ) ) {
+ x1 = v1[ k1Offset + 1 ];
+ } else {
+ x1 = v1[ k1Offset - 1 ] + 1;
+ }
+ y1 = x1 - k1;
+ while ( x1 < text1Length && y1 < text2Length &&
+ text1.charAt( x1 ) === text2.charAt( y1 ) ) {
+ x1++;
+ y1++;
+ }
+ v1[ k1Offset ] = x1;
+ if ( x1 > text1Length ) {
+
+ // Ran off the right of the graph.
+ k1end += 2;
+ } else if ( y1 > text2Length ) {
+
+ // Ran off the bottom of the graph.
+ k1start += 2;
+ } else if ( front ) {
+ k2Offset = vOffset + delta - k1;
+ if ( k2Offset >= 0 && k2Offset < vLength && v2[ k2Offset ] !== -1 ) {
+
+ // Mirror x2 onto top-left coordinate system.
+ x2 = text1Length - v2[ k2Offset ];
+ if ( x1 >= x2 ) {
+
+ // Overlap detected.
+ return this.diffBisectSplit( text1, text2, x1, y1, deadline );
+ }
+ }
+ }
+ }
+
+ // Walk the reverse path one step.
+ for ( k2 = -d + k2start; k2 <= d - k2end; k2 += 2 ) {
+ k2Offset = vOffset + k2;
+ if ( k2 === -d || ( k2 !== d && v2[ k2Offset - 1 ] < v2[ k2Offset + 1 ] ) ) {
+ x2 = v2[ k2Offset + 1 ];
+ } else {
+ x2 = v2[ k2Offset - 1 ] + 1;
+ }
+ y2 = x2 - k2;
+ while ( x2 < text1Length && y2 < text2Length &&
+ text1.charAt( text1Length - x2 - 1 ) ===
+ text2.charAt( text2Length - y2 - 1 ) ) {
+ x2++;
+ y2++;
+ }
+ v2[ k2Offset ] = x2;
+ if ( x2 > text1Length ) {
+
+ // Ran off the left of the graph.
+ k2end += 2;
+ } else if ( y2 > text2Length ) {
+
+ // Ran off the top of the graph.
+ k2start += 2;
+ } else if ( !front ) {
+ k1Offset = vOffset + delta - k2;
+ if ( k1Offset >= 0 && k1Offset < vLength && v1[ k1Offset ] !== -1 ) {
+ x1 = v1[ k1Offset ];
+ y1 = vOffset + x1 - k1Offset;
+
+ // Mirror x2 onto top-left coordinate system.
+ x2 = text1Length - x2;
+ if ( x1 >= x2 ) {
+
+ // Overlap detected.
+ return this.diffBisectSplit( text1, text2, x1, y1, deadline );
+ }
+ }
+ }
+ }
+ }
+
+ // Diff took too long and hit the deadline or
+ // number of diffs equals number of characters, no commonality at all.
+ return [
+ [ DIFF_DELETE, text1 ],
+ [ DIFF_INSERT, text2 ]
+ ];
+ };
+
+ /**
+ * Given the location of the 'middle snake', split the diff in two parts
+ * and recurse.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {number} x Index of split point in text1.
+ * @param {number} y Index of split point in text2.
+ * @param {number} deadline Time at which to bail if not yet complete.
+ * @return {!Array.} Array of diff tuples.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffBisectSplit = function( text1, text2, x, y, deadline ) {
+ var text1a, text1b, text2a, text2b, diffs, diffsb;
+ text1a = text1.substring( 0, x );
+ text2a = text2.substring( 0, y );
+ text1b = text1.substring( x );
+ text2b = text2.substring( y );
+
+ // Compute both diffs serially.
+ diffs = this.DiffMain( text1a, text2a, false, deadline );
+ diffsb = this.DiffMain( text1b, text2b, false, deadline );
+
+ return diffs.concat( diffsb );
+ };
+
+ /**
+ * Reduce the number of edits by eliminating semantically trivial equalities.
+ * @param {!Array.} diffs Array of diff tuples.
+ */
+ DiffMatchPatch.prototype.diffCleanupSemantic = function( diffs ) {
+ var changes, equalities, equalitiesLength, lastequality,
+ pointer, lengthInsertions2, lengthDeletions2, lengthInsertions1,
+ lengthDeletions1, deletion, insertion, overlapLength1, overlapLength2;
+ changes = false;
+ equalities = []; // Stack of indices where equalities are found.
+ equalitiesLength = 0; // Keeping our own length var is faster in JS.
+ /** @type {?string} */
+ lastequality = null;
+
+ // Always equal to diffs[equalities[equalitiesLength - 1]][1]
+ pointer = 0; // Index of current position.
+
+ // Number of characters that changed prior to the equality.
+ lengthInsertions1 = 0;
+ lengthDeletions1 = 0;
+
+ // Number of characters that changed after the equality.
+ lengthInsertions2 = 0;
+ lengthDeletions2 = 0;
+ while ( pointer < diffs.length ) {
+ if ( diffs[ pointer ][ 0 ] === DIFF_EQUAL ) { // Equality found.
+ equalities[ equalitiesLength++ ] = pointer;
+ lengthInsertions1 = lengthInsertions2;
+ lengthDeletions1 = lengthDeletions2;
+ lengthInsertions2 = 0;
+ lengthDeletions2 = 0;
+ lastequality = diffs[ pointer ][ 1 ];
+ } else { // An insertion or deletion.
+ if ( diffs[ pointer ][ 0 ] === DIFF_INSERT ) {
+ lengthInsertions2 += diffs[ pointer ][ 1 ].length;
+ } else {
+ lengthDeletions2 += diffs[ pointer ][ 1 ].length;
+ }
+
+ // Eliminate an equality that is smaller or equal to the edits on both
+ // sides of it.
+ if ( lastequality && ( lastequality.length <=
+ Math.max( lengthInsertions1, lengthDeletions1 ) ) &&
+ ( lastequality.length <= Math.max( lengthInsertions2,
+ lengthDeletions2 ) ) ) {
+
+ // Duplicate record.
+ diffs.splice(
+ equalities[ equalitiesLength - 1 ],
+ 0,
+ [ DIFF_DELETE, lastequality ]
+ );
+
+ // Change second copy to insert.
+ diffs[ equalities[ equalitiesLength - 1 ] + 1 ][ 0 ] = DIFF_INSERT;
+
+ // Throw away the equality we just deleted.
+ equalitiesLength--;
+
+ // Throw away the previous equality (it needs to be reevaluated).
+ equalitiesLength--;
+ pointer = equalitiesLength > 0 ? equalities[ equalitiesLength - 1 ] : -1;
+
+ // Reset the counters.
+ lengthInsertions1 = 0;
+ lengthDeletions1 = 0;
+ lengthInsertions2 = 0;
+ lengthDeletions2 = 0;
+ lastequality = null;
+ changes = true;
+ }
+ }
+ pointer++;
+ }
+
+ // Normalize the diff.
+ if ( changes ) {
+ this.diffCleanupMerge( diffs );
+ }
+
+ // Find any overlaps between deletions and insertions.
+ // e.g: abcxxxxxxdef
+ // -> abcxxxdef
+ // e.g: xxxabcdefxxx
+ // -> def xxxabc
+ // Only extract an overlap if it is as big as the edit ahead or behind it.
+ pointer = 1;
+ while ( pointer < diffs.length ) {
+ if ( diffs[ pointer - 1 ][ 0 ] === DIFF_DELETE &&
+ diffs[ pointer ][ 0 ] === DIFF_INSERT ) {
+ deletion = diffs[ pointer - 1 ][ 1 ];
+ insertion = diffs[ pointer ][ 1 ];
+ overlapLength1 = this.diffCommonOverlap( deletion, insertion );
+ overlapLength2 = this.diffCommonOverlap( insertion, deletion );
+ if ( overlapLength1 >= overlapLength2 ) {
+ if ( overlapLength1 >= deletion.length / 2 ||
+ overlapLength1 >= insertion.length / 2 ) {
+
+ // Overlap found. Insert an equality and trim the surrounding edits.
+ diffs.splice(
+ pointer,
+ 0,
+ [ DIFF_EQUAL, insertion.substring( 0, overlapLength1 ) ]
+ );
+ diffs[ pointer - 1 ][ 1 ] =
+ deletion.substring( 0, deletion.length - overlapLength1 );
+ diffs[ pointer + 1 ][ 1 ] = insertion.substring( overlapLength1 );
+ pointer++;
+ }
+ } else {
+ if ( overlapLength2 >= deletion.length / 2 ||
+ overlapLength2 >= insertion.length / 2 ) {
+
+ // Reverse overlap found.
+ // Insert an equality and swap and trim the surrounding edits.
+ diffs.splice(
+ pointer,
+ 0,
+ [ DIFF_EQUAL, deletion.substring( 0, overlapLength2 ) ]
+ );
+
+ diffs[ pointer - 1 ][ 0 ] = DIFF_INSERT;
+ diffs[ pointer - 1 ][ 1 ] =
+ insertion.substring( 0, insertion.length - overlapLength2 );
+ diffs[ pointer + 1 ][ 0 ] = DIFF_DELETE;
+ diffs[ pointer + 1 ][ 1 ] =
+ deletion.substring( overlapLength2 );
+ pointer++;
+ }
+ }
+ pointer++;
+ }
+ pointer++;
+ }
+ };
+
+ /**
+ * Determine if the suffix of one string is the prefix of another.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {number} The number of characters common to the end of the first
+ * string and the start of the second string.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffCommonOverlap = function( text1, text2 ) {
+ var text1Length, text2Length, textLength,
+ best, length, pattern, found;
+
+ // Cache the text lengths to prevent multiple calls.
+ text1Length = text1.length;
+ text2Length = text2.length;
+
+ // Eliminate the null case.
+ if ( text1Length === 0 || text2Length === 0 ) {
+ return 0;
+ }
+
+ // Truncate the longer string.
+ if ( text1Length > text2Length ) {
+ text1 = text1.substring( text1Length - text2Length );
+ } else if ( text1Length < text2Length ) {
+ text2 = text2.substring( 0, text1Length );
+ }
+ textLength = Math.min( text1Length, text2Length );
+
+ // Quick check for the worst case.
+ if ( text1 === text2 ) {
+ return textLength;
+ }
+
+ // Start by looking for a single character match
+ // and increase length until no match is found.
+ // Performance analysis: https://neil.fraser.name/news/2010/11/04/
+ best = 0;
+ length = 1;
+ while ( true ) {
+ pattern = text1.substring( textLength - length );
+ found = text2.indexOf( pattern );
+ if ( found === -1 ) {
+ return best;
+ }
+ length += found;
+ if ( found === 0 || text1.substring( textLength - length ) ===
+ text2.substring( 0, length ) ) {
+ best = length;
+ length++;
+ }
+ }
+ };
+
+ /**
+ * Split two texts into an array of strings. Reduce the texts to a string of
+ * hashes where each Unicode character represents one line.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {{chars1: string, chars2: string, lineArray: !Array.}}
+ * An object containing the encoded text1, the encoded text2 and
+ * the array of unique strings.
+ * The zeroth element of the array of unique strings is intentionally blank.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffLinesToChars = function( text1, text2 ) {
+ var lineArray, lineHash, chars1, chars2;
+ lineArray = []; // E.g. lineArray[4] === 'Hello\n'
+ lineHash = {}; // E.g. lineHash['Hello\n'] === 4
+
+ // '\x00' is a valid character, but various debuggers don't like it.
+ // So we'll insert a junk entry to avoid generating a null character.
+ lineArray[ 0 ] = "";
+
+ /**
+ * Split a text into an array of strings. Reduce the texts to a string of
+ * hashes where each Unicode character represents one line.
+ * Modifies linearray and linehash through being a closure.
+ * @param {string} text String to encode.
+ * @return {string} Encoded string.
+ * @private
+ */
+ function diffLinesToCharsMunge( text ) {
+ var chars, lineStart, lineEnd, lineArrayLength, line;
+ chars = "";
+
+ // Walk the text, pulling out a substring for each line.
+ // text.split('\n') would would temporarily double our memory footprint.
+ // Modifying text would create many large strings to garbage collect.
+ lineStart = 0;
+ lineEnd = -1;
+
+ // Keeping our own length variable is faster than looking it up.
+ lineArrayLength = lineArray.length;
+ while ( lineEnd < text.length - 1 ) {
+ lineEnd = text.indexOf( "\n", lineStart );
+ if ( lineEnd === -1 ) {
+ lineEnd = text.length - 1;
+ }
+ line = text.substring( lineStart, lineEnd + 1 );
+ lineStart = lineEnd + 1;
+
+ if ( lineHash.hasOwnProperty ? lineHash.hasOwnProperty( line ) :
+ ( lineHash[ line ] !== undefined ) ) {
+ chars += String.fromCharCode( lineHash[ line ] );
+ } else {
+ chars += String.fromCharCode( lineArrayLength );
+ lineHash[ line ] = lineArrayLength;
+ lineArray[ lineArrayLength++ ] = line;
+ }
+ }
+ return chars;
+ }
+
+ chars1 = diffLinesToCharsMunge( text1 );
+ chars2 = diffLinesToCharsMunge( text2 );
+ return {
+ chars1: chars1,
+ chars2: chars2,
+ lineArray: lineArray
+ };
+ };
+
+ /**
+ * Rehydrate the text in a diff from a string of line hashes to real lines of
+ * text.
+ * @param {!Array.} diffs Array of diff tuples.
+ * @param {!Array.} lineArray Array of unique strings.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffCharsToLines = function( diffs, lineArray ) {
+ var x, chars, text, y;
+ for ( x = 0; x < diffs.length; x++ ) {
+ chars = diffs[ x ][ 1 ];
+ text = [];
+ for ( y = 0; y < chars.length; y++ ) {
+ text[ y ] = lineArray[ chars.charCodeAt( y ) ];
+ }
+ diffs[ x ][ 1 ] = text.join( "" );
+ }
+ };
+
+ /**
+ * Reorder and merge like edit sections. Merge equalities.
+ * Any edit section can move as long as it doesn't cross an equality.
+ * @param {!Array.} diffs Array of diff tuples.
+ */
+ DiffMatchPatch.prototype.diffCleanupMerge = function( diffs ) {
+ var pointer, countDelete, countInsert, textInsert, textDelete,
+ commonlength, changes, diffPointer, position;
+ diffs.push( [ DIFF_EQUAL, "" ] ); // Add a dummy entry at the end.
+ pointer = 0;
+ countDelete = 0;
+ countInsert = 0;
+ textDelete = "";
+ textInsert = "";
+ commonlength;
+ while ( pointer < diffs.length ) {
+ switch ( diffs[ pointer ][ 0 ] ) {
+ case DIFF_INSERT:
+ countInsert++;
+ textInsert += diffs[ pointer ][ 1 ];
+ pointer++;
+ break;
+ case DIFF_DELETE:
+ countDelete++;
+ textDelete += diffs[ pointer ][ 1 ];
+ pointer++;
+ break;
+ case DIFF_EQUAL:
+
+ // Upon reaching an equality, check for prior redundancies.
+ if ( countDelete + countInsert > 1 ) {
+ if ( countDelete !== 0 && countInsert !== 0 ) {
+
+ // Factor out any common prefixes.
+ commonlength = this.diffCommonPrefix( textInsert, textDelete );
+ if ( commonlength !== 0 ) {
+ if ( ( pointer - countDelete - countInsert ) > 0 &&
+ diffs[ pointer - countDelete - countInsert - 1 ][ 0 ] ===
+ DIFF_EQUAL ) {
+ diffs[ pointer - countDelete - countInsert - 1 ][ 1 ] +=
+ textInsert.substring( 0, commonlength );
+ } else {
+ diffs.splice( 0, 0, [ DIFF_EQUAL,
+ textInsert.substring( 0, commonlength )
+ ] );
+ pointer++;
+ }
+ textInsert = textInsert.substring( commonlength );
+ textDelete = textDelete.substring( commonlength );
+ }
+
+ // Factor out any common suffixies.
+ commonlength = this.diffCommonSuffix( textInsert, textDelete );
+ if ( commonlength !== 0 ) {
+ diffs[ pointer ][ 1 ] = textInsert.substring( textInsert.length -
+ commonlength ) + diffs[ pointer ][ 1 ];
+ textInsert = textInsert.substring( 0, textInsert.length -
+ commonlength );
+ textDelete = textDelete.substring( 0, textDelete.length -
+ commonlength );
+ }
+ }
+
+ // Delete the offending records and add the merged ones.
+ if ( countDelete === 0 ) {
+ diffs.splice( pointer - countInsert,
+ countDelete + countInsert, [ DIFF_INSERT, textInsert ] );
+ } else if ( countInsert === 0 ) {
+ diffs.splice( pointer - countDelete,
+ countDelete + countInsert, [ DIFF_DELETE, textDelete ] );
+ } else {
+ diffs.splice(
+ pointer - countDelete - countInsert,
+ countDelete + countInsert,
+ [ DIFF_DELETE, textDelete ], [ DIFF_INSERT, textInsert ]
+ );
+ }
+ pointer = pointer - countDelete - countInsert +
+ ( countDelete ? 1 : 0 ) + ( countInsert ? 1 : 0 ) + 1;
+ } else if ( pointer !== 0 && diffs[ pointer - 1 ][ 0 ] === DIFF_EQUAL ) {
+
+ // Merge this equality with the previous one.
+ diffs[ pointer - 1 ][ 1 ] += diffs[ pointer ][ 1 ];
+ diffs.splice( pointer, 1 );
+ } else {
+ pointer++;
+ }
+ countInsert = 0;
+ countDelete = 0;
+ textDelete = "";
+ textInsert = "";
+ break;
+ }
+ }
+ if ( diffs[ diffs.length - 1 ][ 1 ] === "" ) {
+ diffs.pop(); // Remove the dummy entry at the end.
+ }
+
+ // Second pass: look for single edits surrounded on both sides by equalities
+ // which can be shifted sideways to eliminate an equality.
+ // e.g: ABA C -> AB AC
+ changes = false;
+ pointer = 1;
+
+ // Intentionally ignore the first and last element (don't need checking).
+ while ( pointer < diffs.length - 1 ) {
+ if ( diffs[ pointer - 1 ][ 0 ] === DIFF_EQUAL &&
+ diffs[ pointer + 1 ][ 0 ] === DIFF_EQUAL ) {
+
+ diffPointer = diffs[ pointer ][ 1 ];
+ position = diffPointer.substring(
+ diffPointer.length - diffs[ pointer - 1 ][ 1 ].length
+ );
+
+ // This is a single edit surrounded by equalities.
+ if ( position === diffs[ pointer - 1 ][ 1 ] ) {
+
+ // Shift the edit over the previous equality.
+ diffs[ pointer ][ 1 ] = diffs[ pointer - 1 ][ 1 ] +
+ diffs[ pointer ][ 1 ].substring( 0, diffs[ pointer ][ 1 ].length -
+ diffs[ pointer - 1 ][ 1 ].length );
+ diffs[ pointer + 1 ][ 1 ] =
+ diffs[ pointer - 1 ][ 1 ] + diffs[ pointer + 1 ][ 1 ];
+ diffs.splice( pointer - 1, 1 );
+ changes = true;
+ } else if ( diffPointer.substring( 0, diffs[ pointer + 1 ][ 1 ].length ) ===
+ diffs[ pointer + 1 ][ 1 ] ) {
+
+ // Shift the edit over the next equality.
+ diffs[ pointer - 1 ][ 1 ] += diffs[ pointer + 1 ][ 1 ];
+ diffs[ pointer ][ 1 ] =
+ diffs[ pointer ][ 1 ].substring( diffs[ pointer + 1 ][ 1 ].length ) +
+ diffs[ pointer + 1 ][ 1 ];
+ diffs.splice( pointer + 1, 1 );
+ changes = true;
+ }
+ }
+ pointer++;
+ }
+
+ // If shifts were made, the diff needs reordering and another shift sweep.
+ if ( changes ) {
+ this.diffCleanupMerge( diffs );
+ }
+ };
+
+ return function( o, n ) {
+ var diff, output, text;
+ diff = new DiffMatchPatch();
+ output = diff.DiffMain( o, n );
+ diff.diffCleanupEfficiency( output );
+ text = diff.diffPrettyHtml( output );
+
+ return text;
+ };
+}() );
+
+}() );
\ No newline at end of file
diff --git a/package.json b/package.json
old mode 100755
new mode 100644
index 94f3e29..efc2bcb
--- a/package.json
+++ b/package.json
@@ -13,7 +13,9 @@
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-qunit": "^0.5.2",
- "grunt-contrib-uglify": "^0.7.0"
+ "grunt-contrib-uglify": "^0.7.0",
+ "jquery": "^2.2.3",
+ "qunit": "^0.9.1"
},
"scripts": {
"test": "grunt"
diff --git a/tests/cssParsing.html b/tests/cssParsing.html
index 889d3f7..2310e3b 100755
--- a/tests/cssParsing.html
+++ b/tests/cssParsing.html
@@ -1,10 +1,10 @@
Unit Tests for CSS Parsing & CSS operations
-
-
+
+
-
+
From fdac5327ec59d2217c8fb8d4a1e7797159204811 Mon Sep 17 00:00:00 2001
From: Kemal DAG
Date: Tue, 19 Apr 2016 17:20:37 +0300
Subject: [PATCH 17/28] Remove bower operations from travis.yml
---
.travis.yml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 787fb70..58962c1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,4 @@
language: node_js
node_js:
- "4.2.1"
-before_install: npm install -g grunt-cli bower
-before_script: bower install
\ No newline at end of file
+before_install: npm install -g grunt-cli
From 27ca1be7ca4dd39728a16bea877436e5c939bee0 Mon Sep 17 00:00:00 2001
From: Kemal DAG
Date: Tue, 19 Apr 2016 17:23:15 +0300
Subject: [PATCH 18/28] Update documentation
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 892952c..cfe8021 100755
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Please read the story behind it [here]
Demo
======
-Check it out [plunker demo]
+Check out [plunker demo]
[plunker demo]: http://embed.plnkr.co/qMRJpJ92BHNrJuCnbRFB/preview
@@ -23,7 +23,6 @@ Following commands will prepare development enviroment by installing dependencie
```
npm install
- bower install
```
And to execute unit tests and produce css.min.js, execute
From 66c82b2ade425930db33813d576fe699cd9f0fbf Mon Sep 17 00:00:00 2001
From: Braam Genis
Date: Wed, 6 Jul 2016 13:13:14 +0200
Subject: [PATCH 19/28] Handle multiple `@import` statements in
`findBySelector`.
---
css.js | 6 +++---
tests/cssParsing.test.js | 6 +++++-
tests/data.js | 29 ++++++++++++++++++++++++++++-
3 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/css.js b/css.js
index ebb2c98..eecc0b8 100644
--- a/css.js
+++ b/css.js
@@ -236,7 +236,7 @@
}
}
- if (found.length < 2) {
+ if (selector === '@imports' || found.length < 2) {
return found;
} else {
var base = found[0];
@@ -275,7 +275,7 @@
var found = this.findBySelector(cssObjectArray, obj.selector); //found compressed
if (found.length !== 0) {
- compressed.push(found[0]);
+ compressed = compressed.concat(found);
done[obj.selector] = true;
}
}
@@ -672,4 +672,4 @@
global.cssjs = fi;
-})(this);
\ No newline at end of file
+})(this);
diff --git a/tests/cssParsing.test.js b/tests/cssParsing.test.js
index ad773d4..9da869c 100755
--- a/tests/cssParsing.test.js
+++ b/tests/cssParsing.test.js
@@ -13,6 +13,10 @@ QUnit.test('FullInspector Unit Tests', function(assert) {
result = fullInspector.findBySelector(unitTest.findBySelector.input1, unitTest.findBySelector.input2);
assert.deepEqual(result, expected, 'fi.prototype.findBySelector : find css object by selector string'); //assert 3
+ expected = unitTest.findBySelector2.output;
+ result = fullInspector.findBySelector(unitTest.findBySelector2.input1, unitTest.findBySelector2.input2);
+ assert.deepEqual(result, expected, 'fi.prototype.findBySelector : should not compress @imports'); //assert 3
+
expected = unitTest.cssDiff1.output;
result = fullInspector.cssDiff(unitTest.cssDiff1.input1, unitTest.cssDiff1.input2);
assert.deepEqual(result, expected, 'fi.prototype.cssDiff : css1\'s contains an updated value' ); //assert 4
@@ -166,4 +170,4 @@ QUnit.test('Intelligent CSS Push Tests', function(assert) {
assert.deepEqual(styles, expected, 'Push media query CSS containing a new css directive to an existing media query CSS object');
});
-QUnit.start();
\ No newline at end of file
+QUnit.start();
diff --git a/tests/data.js b/tests/data.js
index 52b4342..72ae48e 100755
--- a/tests/data.js
+++ b/tests/data.js
@@ -152,6 +152,33 @@ var unitTest = {
}
]
},
+ findBySelector2 : {
+ input1 :[
+ {
+ selector : '@imports',
+ styles: '@import url(https://fonts.googleapis.com/css?family=Roboto);',
+ type: 'imports',
+ },
+ {
+ selector : '@imports',
+ styles: '@import url(https://fonts.googleapis.com/css?family=Droid+Serif);',
+ type: 'imports',
+ }
+ ],
+ input2 : '@imports',
+ output :[
+ {
+ selector : '@imports',
+ styles: '@import url(https://fonts.googleapis.com/css?family=Roboto);',
+ type: 'imports',
+ },
+ {
+ selector : '@imports',
+ styles: '@import url(https://fonts.googleapis.com/css?family=Droid+Serif);',
+ type: 'imports',
+ }
+ ]
+ },
cssDiff1 : {
input1 : {
selector : '.someSelector',
@@ -364,4 +391,4 @@ var cssDiffFailedValues = [
css2 : '{"selector":".form-textarea, .form-textbox","rules":[{"directive":"border","value":"1px solid #b7bbbd"},{"directive":"-webkit-border-radius","value":"2px"},{"directive":"-moz-border-radius","value":"2px"},{"directive":"border-radius","value":"2px"},{"directive":"padding","value":"4px"},{"directive":"background","value":"transparent !important"},{"directive":"width","value":"100%"},{"directive":"-webkit-appearance","value":"none"},{"directive":"-webkit-box-shadow","value":"inset 0 0 4px rgba(0,0,0,0.2), 0 1px 0 rgb(255,255,255)"},{"directive":"-moz-box-shadow","value":"inset 0 0 4px rgba(0,0,0,0.2), 0 1px 0 rgb(255,255,255)"},{"directive":"box-shadow","value":"inset 0 0 4px rgba(0,0,0,0.2), 0 1px 0 rgb(255,255,255)"},{"directive":"border","value":"1px solid #AEAEAE"},{"directive":"color","value":"#333"},{"directive":"font-family","value":"\\"Verdana\\", sans-serif"},{"directive":"-webkit-box-sizing","value":"border-box"},{"directive":"-moz-box-sizing","value":"border-box"},{"directive":"box-sizing","value":"border-box"}]}',
output : false
}
-];
\ No newline at end of file
+];
From 34f0a9b31a4ecd9c70502c3f4bac3a7adc22dd7f Mon Sep 17 00:00:00 2001
From: David Khourshid
Date: Mon, 7 Nov 2016 13:04:22 -0500
Subject: [PATCH 20/28] Update README.md
Add syntax highlighting
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index cfe8021..99a9870 100755
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ On the browser
Simply parse css string, and log the output
-```
+```html
-
+
+
```
@@ -58,13 +65,13 @@ On the server
```js
- var cssString = ' .someSelector { margin:40px 10px; padding:5px}';
- //require parser constructor
- var cssjs = require("./css.js");
- //initialize parser object
- var parser = new cssjs.cssjs();
- //parse css string
- var parsed = parser.parseCSS(cssString);
-
- console.log(parsed);
+var cssString = ' .someSelector { margin:40px 10px; padding:5px}';
+//require parser constructor
+var cssjs = require("./css.js");
+//initialize parser object
+var parser = new cssjs.cssjs();
+//parse css string
+var parsed = parser.parseCSS(cssString);
+
+console.log(parsed);
```
From ad736ef50688b27c8892ba0f30596fecfb8a678e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ertu=C4=9Frul=20Emre=20Ertekin?=
Date: Thu, 1 Mar 2018 15:12:26 +0300
Subject: [PATCH 26/28] PackageJSON :: name conflict
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 7a41e5a..b8b02f5 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "css.js",
+ "name": "jotform-css.js",
"version": "1.0.0",
"description": "A lightweight, battle tested, fast, CSS parser in JavaScript.",
"main": "css.js",
From f9704438d2c9d9780ce2f89bd45189d19b94a686 Mon Sep 17 00:00:00 2001
From: Ertugrul Emre Ertekin
Date: Thu, 1 Mar 2018 15:14:30 +0300
Subject: [PATCH 27/28] NPM module updated
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index b8b02f5..ba63a85 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jotform-css.js",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "A lightweight, battle tested, fast, CSS parser in JavaScript.",
"main": "css.js",
"directories": {
From f6f741d958674027ecd406426f244be9e80ae09b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 6 Aug 2021 00:04:49 +0300
Subject: [PATCH 28/28] Bump grunt from 1.0.2 to 1.3.0 (#35)
Bumps [grunt](https://github.com/gruntjs/grunt) from 1.0.2 to 1.3.0.
- [Release notes](https://github.com/gruntjs/grunt/releases)
- [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG)
- [Commits](https://github.com/gruntjs/grunt/compare/v1.0.2...v1.3.0)
---
updated-dependencies:
- dependency-name: grunt
dependency-type: direct:development
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package-lock.json | 992 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 757 insertions(+), 235 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 226bcdd..1b37a45 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "css.js",
- "version": "1.0.0",
+ "version": "1.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -50,7 +50,15 @@
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
- "sprintf-js": "1.0.3"
+ "sprintf-js": "~1.0.2"
+ },
+ "dependencies": {
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true
+ }
}
},
"arr-diff": {
@@ -74,12 +82,24 @@
"integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
"dev": true
},
+ "array-each": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz",
+ "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=",
+ "dev": true
+ },
"array-find-index": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
"integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
"dev": true
},
+ "array-slice": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz",
+ "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==",
+ "dev": true
+ },
"array-unique": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
@@ -105,9 +125,9 @@
"dev": true
},
"async": {
- "version": "1.5.2",
- "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
- "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=",
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz",
+ "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==",
"dev": true
},
"async-each": {
@@ -434,12 +454,6 @@
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
"dev": true
},
- "coffeescript": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.10.0.tgz",
- "integrity": "sha1-56qDAZF+9iGzXYo580jc3R234z4=",
- "dev": true
- },
"collection-visit": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
@@ -450,6 +464,21 @@
"object-visit": "1.0.1"
}
},
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
"colors": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz",
@@ -592,14 +621,10 @@
"dev": true
},
"dateformat": {
- "version": "1.0.12",
- "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz",
- "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=",
- "dev": true,
- "requires": {
- "get-stdin": "4.0.1",
- "meow": "3.7.0"
- }
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz",
+ "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==",
+ "dev": true
},
"debug": {
"version": "2.6.9",
@@ -744,6 +769,12 @@
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "dev": true
+ },
"eventemitter2": {
"version": "0.4.14",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz",
@@ -912,6 +943,25 @@
"glob": "5.0.15"
}
},
+ "fined": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/fined/-/fined-1.2.0.tgz",
+ "integrity": "sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==",
+ "dev": true,
+ "requires": {
+ "expand-tilde": "^2.0.2",
+ "is-plain-object": "^2.0.3",
+ "object.defaults": "^1.1.0",
+ "object.pick": "^1.2.0",
+ "parse-filepath": "^1.0.1"
+ }
+ },
+ "flagged-respawn": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz",
+ "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==",
+ "dev": true
+ },
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@@ -1000,7 +1050,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"aproba": {
"version": "1.1.1",
@@ -1051,7 +1102,8 @@
"balanced-match": {
"version": "0.4.2",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"bcrypt-pbkdf": {
"version": "1.0.1",
@@ -1066,6 +1118,7 @@
"version": "0.0.9",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"inherits": "2.0.3"
}
@@ -1074,6 +1127,7 @@
"version": "2.10.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"hoek": "2.16.3"
}
@@ -1082,6 +1136,7 @@
"version": "1.1.7",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"balanced-match": "0.4.2",
"concat-map": "0.0.1"
@@ -1090,7 +1145,8 @@
"buffer-shims": {
"version": "1.0.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"caseless": {
"version": "0.12.0",
@@ -1107,12 +1163,14 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"combined-stream": {
"version": "1.0.5",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"delayed-stream": "1.0.0"
}
@@ -1120,22 +1178,26 @@
"concat-map": {
"version": "0.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"cryptiles": {
"version": "2.0.5",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"boom": "2.10.1"
}
@@ -1175,7 +1237,8 @@
"delayed-stream": {
"version": "1.0.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"delegates": {
"version": "1.0.0",
@@ -1207,7 +1270,8 @@
"extsprintf": {
"version": "1.0.2",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"forever-agent": {
"version": "0.6.1",
@@ -1229,12 +1293,14 @@
"fs.realpath": {
"version": "1.0.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"fstream": {
"version": "1.0.11",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"graceful-fs": "4.1.11",
"inherits": "2.0.3",
@@ -1290,6 +1356,7 @@
"version": "7.1.2",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
@@ -1302,7 +1369,8 @@
"graceful-fs": {
"version": "4.1.11",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"har-schema": {
"version": "1.0.5",
@@ -1330,6 +1398,7 @@
"version": "3.1.3",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"boom": "2.10.1",
"cryptiles": "2.0.5",
@@ -1340,7 +1409,8 @@
"hoek": {
"version": "2.16.3",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"http-signature": {
"version": "1.1.1",
@@ -1357,6 +1427,7 @@
"version": "1.0.6",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
@@ -1365,7 +1436,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"ini": {
"version": "1.3.4",
@@ -1377,6 +1449,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"number-is-nan": "1.0.1"
}
@@ -1390,7 +1463,8 @@
"isarray": {
"version": "1.0.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"isstream": {
"version": "0.1.2",
@@ -1463,12 +1537,14 @@
"mime-db": {
"version": "1.27.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"mime-types": {
"version": "2.1.15",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"mime-db": "1.27.0"
}
@@ -1477,6 +1553,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"brace-expansion": "1.1.7"
}
@@ -1484,12 +1561,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -1544,7 +1623,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"oauth-sign": {
"version": "0.8.2",
@@ -1562,6 +1642,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"wrappy": "1.0.2"
}
@@ -1591,7 +1672,8 @@
"path-is-absolute": {
"version": "1.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"performance-now": {
"version": "0.2.0",
@@ -1602,7 +1684,8 @@
"process-nextick-args": {
"version": "1.0.7",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"punycode": {
"version": "1.4.1",
@@ -1640,6 +1723,7 @@
"version": "2.2.9",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"buffer-shims": "1.0.0",
"core-util-is": "1.0.2",
@@ -1684,6 +1768,7 @@
"version": "2.6.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"glob": "7.1.2"
}
@@ -1691,7 +1776,8 @@
"safe-buffer": {
"version": "5.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"semver": {
"version": "5.3.0",
@@ -1715,6 +1801,7 @@
"version": "1.0.9",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"hoek": "2.16.3"
}
@@ -1748,6 +1835,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
@@ -1758,6 +1846,7 @@
"version": "1.0.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"safe-buffer": "5.0.1"
}
@@ -1772,6 +1861,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"ansi-regex": "2.1.1"
}
@@ -1786,6 +1876,7 @@
"version": "2.2.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"block-stream": "0.0.9",
"fstream": "1.0.11",
@@ -1841,7 +1932,8 @@
"util-deprecate": {
"version": "1.0.2",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"uuid": {
"version": "3.0.1",
@@ -1870,7 +1962,8 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
}
}
},
@@ -1887,9 +1980,9 @@
"dev": true
},
"getobject": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz",
- "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=",
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.1.tgz",
+ "integrity": "sha512-tj18lLe+917AACr6BdVoUuHnBPTVd9BEJp1vxnMZ58ztNvuxz9Ufa+wf3g37tlGITH35jggwZ2d9lcgHJJgXfQ==",
"dev": true
},
"getpass": {
@@ -1964,101 +2057,71 @@
"dev": true
},
"grunt": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.2.tgz",
- "integrity": "sha1-TmpeaVtwRy/VME9fqeNCNoNqc7w=",
- "dev": true,
- "requires": {
- "coffeescript": "1.10.0",
- "dateformat": "1.0.12",
- "eventemitter2": "0.4.14",
- "exit": "0.1.2",
- "findup-sync": "0.3.0",
- "glob": "7.0.6",
- "grunt-cli": "1.2.0",
- "grunt-known-options": "1.1.0",
- "grunt-legacy-log": "1.0.0",
- "grunt-legacy-util": "1.0.0",
- "iconv-lite": "0.4.19",
- "js-yaml": "3.5.5",
- "minimatch": "3.0.4",
- "nopt": "3.0.6",
- "path-is-absolute": "1.0.1",
- "rimraf": "2.2.8"
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.3.0.tgz",
+ "integrity": "sha512-6ILlMXv11/4cxuhSMfSU+SfvbxrPuqZrAtLN64+tZpQ3DAKfSQPQHRbTjSbdtxfyQhGZPtN0bDZJ/LdCM5WXXA==",
+ "dev": true,
+ "requires": {
+ "dateformat": "~3.0.3",
+ "eventemitter2": "~0.4.13",
+ "exit": "~0.1.2",
+ "findup-sync": "~0.3.0",
+ "glob": "~7.1.6",
+ "grunt-cli": "~1.3.2",
+ "grunt-known-options": "~1.1.0",
+ "grunt-legacy-log": "~3.0.0",
+ "grunt-legacy-util": "~2.0.0",
+ "iconv-lite": "~0.4.13",
+ "js-yaml": "~3.14.0",
+ "minimatch": "~3.0.4",
+ "mkdirp": "~1.0.4",
+ "nopt": "~3.0.6",
+ "rimraf": "~3.0.2"
},
"dependencies": {
- "findup-sync": {
- "version": "0.3.0",
- "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz",
- "integrity": "sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=",
- "dev": true,
- "requires": {
- "glob": "5.0.15"
- },
- "dependencies": {
- "glob": {
- "version": "5.0.15",
- "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
- "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=",
- "dev": true,
- "requires": {
- "inflight": "1.0.6",
- "inherits": "2.0.3",
- "minimatch": "3.0.4",
- "once": "1.4.0",
- "path-is-absolute": "1.0.1"
- }
- }
- }
- },
"glob": {
- "version": "7.0.6",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz",
- "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=",
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
"dev": true,
"requires": {
- "fs.realpath": "1.0.0",
- "inflight": "1.0.6",
- "inherits": "2.0.3",
- "minimatch": "3.0.4",
- "once": "1.4.0",
- "path-is-absolute": "1.0.1"
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
}
},
"grunt-cli": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz",
- "integrity": "sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=",
- "dev": true,
- "requires": {
- "findup-sync": "0.3.0",
- "grunt-known-options": "1.1.0",
- "nopt": "3.0.6",
- "resolve": "1.1.7"
- }
- },
- "minimatch": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
- "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
- "dev": true,
- "requires": {
- "brace-expansion": "1.1.11"
- }
- },
- "nopt": {
- "version": "3.0.6",
- "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
- "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=",
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.3.2.tgz",
+ "integrity": "sha512-8OHDiZZkcptxVXtMfDxJvmN7MVJNE8L/yIcPb4HB7TlyFD1kDvjHrb62uhySsU14wJx9ORMnTuhRMQ40lH/orQ==",
"dev": true,
"requires": {
- "abbrev": "1.1.1"
+ "grunt-known-options": "~1.1.0",
+ "interpret": "~1.1.0",
+ "liftoff": "~2.5.0",
+ "nopt": "~4.0.1",
+ "v8flags": "~3.1.1"
+ },
+ "dependencies": {
+ "nopt": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz",
+ "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==",
+ "dev": true,
+ "requires": {
+ "abbrev": "1",
+ "osenv": "^0.1.4"
+ }
+ }
}
},
- "resolve": {
- "version": "1.1.7",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
- "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
+ "mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true
}
}
@@ -2175,113 +2238,79 @@
"dev": true
},
"grunt-legacy-log": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-1.0.0.tgz",
- "integrity": "sha1-+4bxgJhHvAfcR4Q/ns1srLYt8tU=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-3.0.0.tgz",
+ "integrity": "sha512-GHZQzZmhyq0u3hr7aHW4qUH0xDzwp2YXldLPZTCjlOeGscAOWWPftZG3XioW8MasGp+OBRIu39LFx14SLjXRcA==",
"dev": true,
"requires": {
- "colors": "1.1.2",
- "grunt-legacy-log-utils": "1.0.0",
- "hooker": "0.2.3",
- "lodash": "3.10.1",
- "underscore.string": "3.2.3"
+ "colors": "~1.1.2",
+ "grunt-legacy-log-utils": "~2.1.0",
+ "hooker": "~0.2.3",
+ "lodash": "~4.17.19"
}
},
"grunt-legacy-log-utils": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-1.0.0.tgz",
- "integrity": "sha1-p7ji0Ps1taUPSvmG/BEnSevJbz0=",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.1.0.tgz",
+ "integrity": "sha512-lwquaPXJtKQk0rUM1IQAop5noEpwFqOXasVoedLeNzaibf/OPWjKYvvdqnEHNmU+0T0CaReAXIbGo747ZD+Aaw==",
"dev": true,
"requires": {
- "chalk": "1.1.3",
- "lodash": "4.3.0"
+ "chalk": "~4.1.0",
+ "lodash": "~4.17.19"
},
"dependencies": {
- "ansi-regex": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
- "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
- "dev": true
- },
"ansi-styles": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
- "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
- "dev": true
- },
- "chalk": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
- "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": {
- "ansi-styles": "2.2.1",
- "escape-string-regexp": "1.0.5",
- "has-ansi": "2.0.0",
- "strip-ansi": "3.0.1",
- "supports-color": "2.0.0"
+ "color-convert": "^2.0.1"
}
},
- "has-ansi": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
- "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
+ "chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"requires": {
- "ansi-regex": "2.1.1"
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
}
},
- "lodash": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz",
- "integrity": "sha1-79nEpuxT87BUEkKZFcPkgk5NJaQ=",
- "dev": true
- },
- "strip-ansi": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
- "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"requires": {
- "ansi-regex": "2.1.1"
+ "has-flag": "^4.0.0"
}
- },
- "supports-color": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
- "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
- "dev": true
}
}
},
"grunt-legacy-util": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.0.0.tgz",
- "integrity": "sha1-OGqnjcbtUJhsKxiVcmWxtIq7m4Y=",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-2.0.1.tgz",
+ "integrity": "sha512-2bQiD4fzXqX8rhNdXkAywCadeqiPiay0oQny77wA2F3WF4grPJXCvAcyoWUJV+po/b15glGkxuSiQCK299UC2w==",
"dev": true,
"requires": {
- "async": "1.5.2",
- "exit": "0.1.2",
- "getobject": "0.1.0",
- "hooker": "0.2.3",
- "lodash": "4.3.0",
- "underscore.string": "3.2.3",
- "which": "1.2.14"
+ "async": "~3.2.0",
+ "exit": "~0.1.2",
+ "getobject": "~1.0.0",
+ "hooker": "~0.2.3",
+ "lodash": "~4.17.21",
+ "underscore.string": "~3.3.5",
+ "which": "~2.0.2"
},
"dependencies": {
- "lodash": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz",
- "integrity": "sha1-79nEpuxT87BUEkKZFcPkgk5NJaQ=",
- "dev": true
- },
"which": {
- "version": "1.2.14",
- "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz",
- "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": {
- "isexe": "2.0.0"
+ "isexe": "^2.0.0"
}
}
}
@@ -2359,6 +2388,12 @@
"ansi-regex": "2.1.1"
}
},
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
"has-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
@@ -2493,10 +2528,13 @@
}
},
"iconv-lite": {
- "version": "0.4.19",
- "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
- "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==",
- "dev": true
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "dev": true,
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
},
"indent-string": {
"version": "2.1.0",
@@ -2529,6 +2567,22 @@
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"dev": true
},
+ "interpret": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz",
+ "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=",
+ "dev": true
+ },
+ "is-absolute": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz",
+ "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==",
+ "dev": true,
+ "requires": {
+ "is-relative": "^1.0.0",
+ "is-windows": "^1.0.1"
+ }
+ },
"is-accessor-descriptor": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
@@ -2712,6 +2766,15 @@
"integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=",
"dev": true
},
+ "is-relative": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz",
+ "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==",
+ "dev": true,
+ "requires": {
+ "is-unc-path": "^1.0.0"
+ }
+ },
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
@@ -2724,8 +2787,17 @@
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
},
- "is-utf8": {
- "version": "0.2.1",
+ "is-unc-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz",
+ "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==",
+ "dev": true,
+ "requires": {
+ "unc-path-regex": "^0.1.2"
+ }
+ },
+ "is-utf8": {
+ "version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
"dev": true
@@ -2778,21 +2850,13 @@
"dev": true
},
"js-yaml": {
- "version": "3.5.5",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz",
- "integrity": "sha1-A3fDgBfKvHMisNH7zSWkkWQfL74=",
+ "version": "3.14.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
+ "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"dev": true,
"requires": {
- "argparse": "1.0.10",
- "esprima": "2.7.3"
- },
- "dependencies": {
- "esprima": {
- "version": "2.7.3",
- "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz",
- "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=",
- "dev": true
- }
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
}
},
"jsbn": {
@@ -2889,6 +2953,296 @@
"graceful-fs": "4.1.11"
}
},
+ "liftoff": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz",
+ "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=",
+ "dev": true,
+ "requires": {
+ "extend": "^3.0.0",
+ "findup-sync": "^2.0.0",
+ "fined": "^1.0.1",
+ "flagged-respawn": "^1.0.0",
+ "is-plain-object": "^2.0.4",
+ "object.map": "^1.0.0",
+ "rechoir": "^0.6.2",
+ "resolve": "^1.1.7"
+ },
+ "dependencies": {
+ "arr-diff": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
+ "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=",
+ "dev": true
+ },
+ "array-unique": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
+ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
+ "dev": true
+ },
+ "braces": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
+ "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
+ "dev": true,
+ "requires": {
+ "arr-flatten": "^1.1.0",
+ "array-unique": "^0.3.2",
+ "extend-shallow": "^2.0.1",
+ "fill-range": "^4.0.0",
+ "isobject": "^3.0.1",
+ "repeat-element": "^1.1.2",
+ "snapdragon": "^0.8.1",
+ "snapdragon-node": "^2.0.1",
+ "split-string": "^3.0.2",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "expand-brackets": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
+ "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=",
+ "dev": true,
+ "requires": {
+ "debug": "^2.3.3",
+ "define-property": "^0.2.5",
+ "extend-shallow": "^2.0.1",
+ "posix-character-classes": "^0.1.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
+ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^0.1.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ },
+ "is-descriptor": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
+ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "dev": true,
+ "requires": {
+ "is-accessor-descriptor": "^0.1.6",
+ "is-data-descriptor": "^0.1.4",
+ "kind-of": "^5.0.0"
+ }
+ },
+ "kind-of": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
+ "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "dev": true
+ }
+ }
+ },
+ "extglob": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
+ "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
+ "dev": true,
+ "requires": {
+ "array-unique": "^0.3.2",
+ "define-property": "^1.0.0",
+ "expand-brackets": "^2.1.4",
+ "extend-shallow": "^2.0.1",
+ "fragment-cache": "^0.2.1",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.1"
+ },
+ "dependencies": {
+ "define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
+ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+ "dev": true,
+ "requires": {
+ "is-descriptor": "^1.0.0"
+ }
+ },
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "fill-range": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
+ "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
+ "dev": true,
+ "requires": {
+ "extend-shallow": "^2.0.1",
+ "is-number": "^3.0.0",
+ "repeat-string": "^1.6.1",
+ "to-regex-range": "^2.1.0"
+ },
+ "dependencies": {
+ "extend-shallow": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
+ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+ "dev": true,
+ "requires": {
+ "is-extendable": "^0.1.0"
+ }
+ }
+ }
+ },
+ "findup-sync": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz",
+ "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=",
+ "dev": true,
+ "requires": {
+ "detect-file": "^1.0.0",
+ "is-glob": "^3.1.0",
+ "micromatch": "^3.0.4",
+ "resolve-dir": "^1.0.1"
+ }
+ },
+ "is-accessor-descriptor": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
+ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-data-descriptor": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
+ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
+ "dev": true
+ },
+ "is-glob": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
+ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.0"
+ }
+ },
+ "is-number": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
+ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
+ "dev": true,
+ "requires": {
+ "kind-of": "^3.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "^1.1.5"
+ }
+ }
+ }
+ },
+ "isobject": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
+ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
+ "dev": true
+ },
+ "kind-of": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
+ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
+ "dev": true
+ },
+ "micromatch": {
+ "version": "3.1.10",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
+ "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
+ "dev": true,
+ "requires": {
+ "arr-diff": "^4.0.0",
+ "array-unique": "^0.3.2",
+ "braces": "^2.3.1",
+ "define-property": "^2.0.2",
+ "extend-shallow": "^3.0.2",
+ "extglob": "^2.0.4",
+ "fragment-cache": "^0.2.1",
+ "kind-of": "^6.0.2",
+ "nanomatch": "^1.2.9",
+ "object.pick": "^1.3.0",
+ "regex-not": "^1.0.0",
+ "snapdragon": "^0.8.1",
+ "to-regex": "^3.0.2"
+ }
+ }
+ }
+ },
"load-json-file": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
@@ -2911,9 +3265,9 @@
}
},
"lodash": {
- "version": "3.10.1",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
- "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=",
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"loud-rejection": {
@@ -2926,6 +3280,23 @@
"signal-exit": "3.0.2"
}
},
+ "make-iterator": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz",
+ "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==",
+ "dev": true,
+ "requires": {
+ "kind-of": "^6.0.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
+ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
+ "dev": true
+ }
+ }
+ },
"map-cache": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
@@ -3311,6 +3682,56 @@
}
}
},
+ "object.defaults": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz",
+ "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=",
+ "dev": true,
+ "requires": {
+ "array-each": "^1.0.1",
+ "array-slice": "^1.0.0",
+ "for-own": "^1.0.0",
+ "isobject": "^3.0.0"
+ },
+ "dependencies": {
+ "for-own": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz",
+ "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=",
+ "dev": true,
+ "requires": {
+ "for-in": "^1.0.1"
+ }
+ },
+ "isobject": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
+ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
+ "dev": true
+ }
+ }
+ },
+ "object.map": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz",
+ "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=",
+ "dev": true,
+ "requires": {
+ "for-own": "^1.0.0",
+ "make-iterator": "^1.0.0"
+ },
+ "dependencies": {
+ "for-own": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz",
+ "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=",
+ "dev": true,
+ "requires": {
+ "for-in": "^1.0.1"
+ }
+ }
+ }
+ },
"object.omit": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz",
@@ -3347,6 +3768,28 @@
"wrappy": "1.0.2"
}
},
+ "os-homedir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
+ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
+ "dev": true
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
+ "dev": true
+ },
+ "osenv": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
+ "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
+ "dev": true,
+ "requires": {
+ "os-homedir": "^1.0.0",
+ "os-tmpdir": "^1.0.0"
+ }
+ },
"package": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/package/-/package-1.0.1.tgz",
@@ -3359,6 +3802,17 @@
"integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=",
"dev": true
},
+ "parse-filepath": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz",
+ "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=",
+ "dev": true,
+ "requires": {
+ "is-absolute": "^1.0.0",
+ "map-cache": "^0.2.0",
+ "path-root": "^0.1.1"
+ }
+ },
"parse-glob": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz",
@@ -3413,6 +3867,21 @@
"integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=",
"dev": true
},
+ "path-root": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz",
+ "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=",
+ "dev": true,
+ "requires": {
+ "path-root-regex": "^0.1.0"
+ }
+ },
+ "path-root-regex": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz",
+ "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=",
+ "dev": true
+ },
"path-type": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
@@ -3983,6 +4452,15 @@
}
}
},
+ "rechoir": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
+ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
+ "dev": true,
+ "requires": {
+ "resolve": "^1.1.6"
+ }
+ },
"redent": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz",
@@ -4107,10 +4585,29 @@
"dev": true
},
"rimraf": {
- "version": "2.2.8",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz",
- "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=",
- "dev": true
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ },
+ "dependencies": {
+ "glob": {
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ }
+ }
},
"safe-buffer": {
"version": "5.1.1",
@@ -4127,6 +4624,12 @@
"ret": "0.1.15"
}
},
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
@@ -4404,9 +4907,9 @@
}
},
"sprintf-js": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
- "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz",
+ "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==",
"dev": true
},
"sshpk": {
@@ -4666,12 +5169,22 @@
}
}
},
- "underscore.string": {
- "version": "3.2.3",
- "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.2.3.tgz",
- "integrity": "sha1-gGmSYzZl1eX8tNsfs6hi62jp5to=",
+ "unc-path-regex": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz",
+ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=",
"dev": true
},
+ "underscore.string": {
+ "version": "3.3.5",
+ "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz",
+ "integrity": "sha512-g+dpmgn+XBneLmXXo+sGlW5xQEt4ErkS3mgeN2GFbremYeMBSJKr9Wf2KJplQVaiPY/f7FN6atosWYNm9ovrYg==",
+ "dev": true,
+ "requires": {
+ "sprintf-js": "^1.0.3",
+ "util-deprecate": "^1.0.2"
+ }
+ },
"union-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz",
@@ -4877,6 +5390,15 @@
"integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==",
"dev": true
},
+ "v8flags": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.3.tgz",
+ "integrity": "sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w==",
+ "dev": true,
+ "requires": {
+ "homedir-polyfill": "^1.0.1"
+ }
+ },
"validate-npm-package-license": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz",