You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by za...@apache.org on 2015/04/01 16:23:07 UTC
[40/52] [abbrv] [partial] cordova-firefoxos git commit: CB-4548
Install new node-firefox-* dependencies in node_modules
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.js b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.js
new file mode 100644
index 0000000..50059b7
--- /dev/null
+++ b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.js
@@ -0,0 +1,522 @@
+/*! Copyright (c) 2011, Lloyd Hilaiel, ISC License */
+/*
+ * This is the JSONSelect reference implementation, in javascript.
+ */
+(function(exports) {
+
+ var // localize references
+ toString = Object.prototype.toString;
+
+ function jsonParse(str) {
+ try {
+ if(JSON && JSON.parse){
+ return JSON.parse(str);
+ }
+ return (new Function("return " + str))();
+ } catch(e) {
+ te("ijs");
+ }
+ }
+
+ // emitted error codes.
+ var errorCodes = {
+ "bop": "binary operator expected",
+ "ee": "expression expected",
+ "epex": "closing paren expected ')'",
+ "ijs": "invalid json string",
+ "mcp": "missing closing paren",
+ "mepf": "malformed expression in pseudo-function",
+ "mexp": "multiple expressions not allowed",
+ "mpc": "multiple pseudo classes (:xxx) not allowed",
+ "nmi": "multiple ids not allowed",
+ "pex": "opening paren expected '('",
+ "se": "selector expected",
+ "sex": "string expected",
+ "sra": "string required after '.'",
+ "uc": "unrecognized char",
+ "ucp": "unexpected closing paren",
+ "ujs": "unclosed json string",
+ "upc": "unrecognized pseudo class"
+ };
+
+ // throw an error message
+ function te(ec) {
+ throw new Error(errorCodes[ec]);
+ }
+
+ // THE LEXER
+ var toks = {
+ psc: 1, // pseudo class
+ psf: 2, // pseudo class function
+ typ: 3, // type
+ str: 4, // string
+ ide: 5 // identifiers (or "classes", stuff after a dot)
+ };
+
+ // The primary lexing regular expression in jsonselect
+ var pat = new RegExp(
+ "^(?:" +
+ // (1) whitespace
+ "([\\r\\n\\t\\ ]+)|" +
+ // (2) one-char ops
+ "([~*,>\\)\\(])|" +
+ // (3) types names
+ "(string|boolean|null|array|object|number)|" +
+ // (4) pseudo classes
+ "(:(?:root|first-child|last-child|only-child))|" +
+ // (5) pseudo functions
+ "(:(?:nth-child|nth-last-child|has|expr|val|contains))|" +
+ // (6) bogusly named pseudo something or others
+ "(:\\w+)|" +
+ // (7 & 8) identifiers and JSON strings
+ "(?:(\\.)?(\\\"(?:[^\\\\]|\\\\[^\\\"])*\\\"))|" +
+ // (8) bogus JSON strings missing a trailing quote
+ "(\\\")|" +
+ // (9) identifiers (unquoted)
+ "\\.((?:[_a-zA-Z]|[^\\0-\\0177]|\\\\[^\\r\\n\\f0-9a-fA-F])(?:[_a-zA-Z0-9\\-]|[^\\u0000-\\u0177]|(?:\\\\[^\\r\\n\\f0-9a-fA-F]))*)" +
+ ")"
+ );
+
+ // A regular expression for matching "nth expressions" (see grammar, what :nth-child() eats)
+ var nthPat = /^\s*\(\s*(?:([+\-]?)([0-9]*)n\s*(?:([+\-])\s*([0-9]))?|(odd|even)|([+\-]?[0-9]+))\s*\)/;
+ function lex(str, off) {
+ if (!off) off = 0;
+ var m = pat.exec(str.substr(off));
+ if (!m) return undefined;
+ off+=m[0].length;
+ var a;
+ if (m[1]) a = [off, " "];
+ else if (m[2]) a = [off, m[0]];
+ else if (m[3]) a = [off, toks.typ, m[0]];
+ else if (m[4]) a = [off, toks.psc, m[0]];
+ else if (m[5]) a = [off, toks.psf, m[0]];
+ else if (m[6]) te("upc");
+ else if (m[8]) a = [off, m[7] ? toks.ide : toks.str, jsonParse(m[8])];
+ else if (m[9]) te("ujs");
+ else if (m[10]) a = [off, toks.ide, m[10].replace(/\\([^\r\n\f0-9a-fA-F])/g,"$1")];
+ return a;
+ }
+
+ // THE EXPRESSION SUBSYSTEM
+
+ var exprPat = new RegExp(
+ // skip and don't capture leading whitespace
+ "^\\s*(?:" +
+ // (1) simple vals
+ "(true|false|null)|" +
+ // (2) numbers
+ "(-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)|" +
+ // (3) strings
+ "(\"(?:[^\\]|\\[^\"])*\")|" +
+ // (4) the 'x' value placeholder
+ "(x)|" +
+ // (5) binops
+ "(&&|\\|\\||[\\$\\^<>!\\*]=|[=+\\-*/%<>])|" +
+ // (6) parens
+ "([\\(\\)])" +
+ ")"
+ );
+
+ function is(o, t) { return typeof o === t; }
+ var operators = {
+ '*': [ 9, function(lhs, rhs) { return lhs * rhs; } ],
+ '/': [ 9, function(lhs, rhs) { return lhs / rhs; } ],
+ '%': [ 9, function(lhs, rhs) { return lhs % rhs; } ],
+ '+': [ 7, function(lhs, rhs) { return lhs + rhs; } ],
+ '-': [ 7, function(lhs, rhs) { return lhs - rhs; } ],
+ '<=': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs <= rhs; } ],
+ '>=': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs >= rhs; } ],
+ '$=': [ 5, function(lhs, rhs) { return is(lhs, 'string') && is(rhs, 'string') && lhs.lastIndexOf(rhs) === lhs.length - rhs.length; } ],
+ '^=': [ 5, function(lhs, rhs) { return is(lhs, 'string') && is(rhs, 'string') && lhs.indexOf(rhs) === 0; } ],
+ '*=': [ 5, function(lhs, rhs) { return is(lhs, 'string') && is(rhs, 'string') && lhs.indexOf(rhs) !== -1; } ],
+ '>': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs > rhs; } ],
+ '<': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs < rhs; } ],
+ '=': [ 3, function(lhs, rhs) { return lhs === rhs; } ],
+ '!=': [ 3, function(lhs, rhs) { return lhs !== rhs; } ],
+ '&&': [ 2, function(lhs, rhs) { return lhs && rhs; } ],
+ '||': [ 1, function(lhs, rhs) { return lhs || rhs; } ]
+ };
+
+ function exprLex(str, off) {
+ var v, m = exprPat.exec(str.substr(off));
+ if (m) {
+ off += m[0].length;
+ v = m[1] || m[2] || m[3] || m[5] || m[6];
+ if (m[1] || m[2] || m[3]) return [off, 0, jsonParse(v)];
+ else if (m[4]) return [off, 0, undefined];
+ return [off, v];
+ }
+ }
+
+ function exprParse2(str, off) {
+ if (!off) off = 0;
+ // first we expect a value or a '('
+ var l = exprLex(str, off),
+ lhs;
+ if (l && l[1] === '(') {
+ lhs = exprParse2(str, l[0]);
+ var p = exprLex(str, lhs[0]);
+ if (!p || p[1] !== ')') te('epex');
+ off = p[0];
+ lhs = [ '(', lhs[1] ];
+ } else if (!l || (l[1] && l[1] != 'x')) {
+ te("ee");
+ } else {
+ lhs = ((l[1] === 'x') ? undefined : l[2]);
+ off = l[0];
+ }
+
+ // now we expect a binary operator or a ')'
+ var op = exprLex(str, off);
+ if (!op || op[1] == ')') return [off, lhs];
+ else if (op[1] == 'x' || !op[1]) {
+ te('bop');
+ }
+
+ // tail recursion to fetch the rhs expression
+ var rhs = exprParse2(str, op[0]);
+ off = rhs[0];
+ rhs = rhs[1];
+
+ // and now precedence! how shall we put everything together?
+ var v;
+ if (typeof rhs !== 'object' || rhs[0] === '(' || operators[op[1]][0] < operators[rhs[1]][0] ) {
+ v = [lhs, op[1], rhs];
+ }
+ else {
+ v = rhs;
+ while (typeof rhs[0] === 'object' && rhs[0][0] != '(' && operators[op[1]][0] >= operators[rhs[0][1]][0]) {
+ rhs = rhs[0];
+ }
+ rhs[0] = [lhs, op[1], rhs[0]];
+ }
+ return [off, v];
+ }
+
+ function exprParse(str, off) {
+ function deparen(v) {
+ if (typeof v !== 'object' || v === null) return v;
+ else if (v[0] === '(') return deparen(v[1]);
+ else return [deparen(v[0]), v[1], deparen(v[2])];
+ }
+ var e = exprParse2(str, off ? off : 0);
+ return [e[0], deparen(e[1])];
+ }
+
+ function exprEval(expr, x) {
+ if (expr === undefined) return x;
+ else if (expr === null || typeof expr !== 'object') {
+ return expr;
+ }
+ var lhs = exprEval(expr[0], x),
+ rhs = exprEval(expr[2], x);
+ return operators[expr[1]][1](lhs, rhs);
+ }
+
+ // THE PARSER
+
+ function parse(str, off, nested, hints) {
+ if (!nested) hints = {};
+
+ var a = [], am, readParen;
+ if (!off) off = 0;
+
+ while (true) {
+ var s = parse_selector(str, off, hints);
+ a.push(s[1]);
+ s = lex(str, off = s[0]);
+ if (s && s[1] === " ") s = lex(str, off = s[0]);
+ if (!s) break;
+ // now we've parsed a selector, and have something else...
+ if (s[1] === ">" || s[1] === "~") {
+ if (s[1] === "~") hints.usesSiblingOp = true;
+ a.push(s[1]);
+ off = s[0];
+ } else if (s[1] === ",") {
+ if (am === undefined) am = [ ",", a ];
+ else am.push(a);
+ a = [];
+ off = s[0];
+ } else if (s[1] === ")") {
+ if (!nested) te("ucp");
+ readParen = 1;
+ off = s[0];
+ break;
+ }
+ }
+ if (nested && !readParen) te("mcp");
+ if (am) am.push(a);
+ var rv;
+ if (!nested && hints.usesSiblingOp) {
+ rv = normalize(am ? am : a);
+ } else {
+ rv = am ? am : a;
+ }
+ return [off, rv];
+ }
+
+ function normalizeOne(sel) {
+ var sels = [], s;
+ for (var i = 0; i < sel.length; i++) {
+ if (sel[i] === '~') {
+ // `A ~ B` maps to `:has(:root > A) > B`
+ // `Z A ~ B` maps to `Z :has(:root > A) > B, Z:has(:root > A) > B`
+ // This first clause, takes care of the first case, and the first half of the latter case.
+ if (i < 2 || sel[i-2] != '>') {
+ s = sel.slice(0,i-1);
+ s = s.concat([{has:[[{pc: ":root"}, ">", sel[i-1]]]}, ">"]);
+ s = s.concat(sel.slice(i+1));
+ sels.push(s);
+ }
+ // here we take care of the second half of above:
+ // (`Z A ~ B` maps to `Z :has(:root > A) > B, Z :has(:root > A) > B`)
+ // and a new case:
+ // Z > A ~ B maps to Z:has(:root > A) > B
+ if (i > 1) {
+ var at = sel[i-2] === '>' ? i-3 : i-2;
+ s = sel.slice(0,at);
+ var z = {};
+ for (var k in sel[at]) if (sel[at].hasOwnProperty(k)) z[k] = sel[at][k];
+ if (!z.has) z.has = [];
+ z.has.push([{pc: ":root"}, ">", sel[i-1]]);
+ s = s.concat(z, '>', sel.slice(i+1));
+ sels.push(s);
+ }
+ break;
+ }
+ }
+ if (i == sel.length) return sel;
+ return sels.length > 1 ? [','].concat(sels) : sels[0];
+ }
+
+ function normalize(sels) {
+ if (sels[0] === ',') {
+ var r = [","];
+ for (var i = i; i < sels.length; i++) {
+ var s = normalizeOne(s[i]);
+ r = r.concat(s[0] === "," ? s.slice(1) : s);
+ }
+ return r;
+ } else {
+ return normalizeOne(sels);
+ }
+ }
+
+ function parse_selector(str, off, hints) {
+ var soff = off;
+ var s = { };
+ var l = lex(str, off);
+ // skip space
+ if (l && l[1] === " ") { soff = off = l[0]; l = lex(str, off); }
+ if (l && l[1] === toks.typ) {
+ s.type = l[2];
+ l = lex(str, (off = l[0]));
+ } else if (l && l[1] === "*") {
+ // don't bother representing the universal sel, '*' in the
+ // parse tree, cause it's the default
+ l = lex(str, (off = l[0]));
+ }
+
+ // now support either an id or a pc
+ while (true) {
+ if (l === undefined) {
+ break;
+ } else if (l[1] === toks.ide) {
+ if (s.id) te("nmi");
+ s.id = l[2];
+ } else if (l[1] === toks.psc) {
+ if (s.pc || s.pf) te("mpc");
+ // collapse first-child and last-child into nth-child expressions
+ if (l[2] === ":first-child") {
+ s.pf = ":nth-child";
+ s.a = 0;
+ s.b = 1;
+ } else if (l[2] === ":last-child") {
+ s.pf = ":nth-last-child";
+ s.a = 0;
+ s.b = 1;
+ } else {
+ s.pc = l[2];
+ }
+ } else if (l[1] === toks.psf) {
+ if (l[2] === ":val" || l[2] === ":contains") {
+ s.expr = [ undefined, l[2] === ":val" ? "=" : "*=", undefined];
+ // any amount of whitespace, followed by paren, string, paren
+ l = lex(str, (off = l[0]));
+ if (l && l[1] === " ") l = lex(str, off = l[0]);
+ if (!l || l[1] !== "(") te("pex");
+ l = lex(str, (off = l[0]));
+ if (l && l[1] === " ") l = lex(str, off = l[0]);
+ if (!l || l[1] !== toks.str) te("sex");
+ s.expr[2] = l[2];
+ l = lex(str, (off = l[0]));
+ if (l && l[1] === " ") l = lex(str, off = l[0]);
+ if (!l || l[1] !== ")") te("epex");
+ } else if (l[2] === ":has") {
+ // any amount of whitespace, followed by paren
+ l = lex(str, (off = l[0]));
+ if (l && l[1] === " ") l = lex(str, off = l[0]);
+ if (!l || l[1] !== "(") te("pex");
+ var h = parse(str, l[0], true);
+ l[0] = h[0];
+ if (!s.has) s.has = [];
+ s.has.push(h[1]);
+ } else if (l[2] === ":expr") {
+ if (s.expr) te("mexp");
+ var e = exprParse(str, l[0]);
+ l[0] = e[0];
+ s.expr = e[1];
+ } else {
+ if (s.pc || s.pf ) te("mpc");
+ s.pf = l[2];
+ var m = nthPat.exec(str.substr(l[0]));
+ if (!m) te("mepf");
+ if (m[5]) {
+ s.a = 2;
+ s.b = (m[5] === "odd") ? 1 : 0;
+ } else if (m[6]) {
+ s.a = 0;
+ s.b = parseInt(m[6], 10);
+ } else {
+ s.a = parseInt((m[1] ? m[1] : "+") + (m[2] ? m[2] : "1"),10);
+ s.b = m[3] ? parseInt(m[3] + m[4],10) : 0;
+ }
+ l[0] += m[0].length;
+ }
+ } else {
+ break;
+ }
+ l = lex(str, (off = l[0]));
+ }
+
+ // now if we didn't actually parse anything it's an error
+ if (soff === off) te("se");
+
+ return [off, s];
+ }
+
+ // THE EVALUATOR
+
+ function isArray(o) {
+ return Array.isArray ? Array.isArray(o) :
+ toString.call(o) === "[object Array]";
+ }
+
+ function mytypeof(o) {
+ if (o === null) return "null";
+ var to = typeof o;
+ if (to === "object" && isArray(o)) to = "array";
+ return to;
+ }
+
+ function mn(node, sel, id, num, tot) {
+ var sels = [];
+ var cs = (sel[0] === ">") ? sel[1] : sel[0];
+ var m = true, mod;
+ if (cs.type) m = m && (cs.type === mytypeof(node));
+ if (cs.id) m = m && (cs.id === id);
+ if (m && cs.pf) {
+ if (cs.pf === ":nth-last-child") num = tot - num;
+ else num++;
+ if (cs.a === 0) {
+ m = cs.b === num;
+ } else {
+ mod = ((num - cs.b) % cs.a);
+
+ m = (!mod && ((num*cs.a + cs.b) >= 0));
+ }
+ }
+ if (m && cs.has) {
+ // perhaps we should augment forEach to handle a return value
+ // that indicates "client cancels traversal"?
+ var bail = function() { throw 42; };
+ for (var i = 0; i < cs.has.length; i++) {
+ try {
+ forEach(cs.has[i], node, bail);
+ } catch (e) {
+ if (e === 42) continue;
+ }
+ m = false;
+ break;
+ }
+ }
+ if (m && cs.expr) {
+ m = exprEval(cs.expr, node);
+ }
+ // should we repeat this selector for descendants?
+ if (sel[0] !== ">" && sel[0].pc !== ":root") sels.push(sel);
+
+ if (m) {
+ // is there a fragment that we should pass down?
+ if (sel[0] === ">") { if (sel.length > 2) { m = false; sels.push(sel.slice(2)); } }
+ else if (sel.length > 1) { m = false; sels.push(sel.slice(1)); }
+ }
+
+ return [m, sels];
+ }
+
+ function forEach(sel, obj, fun, id, num, tot) {
+ var a = (sel[0] === ",") ? sel.slice(1) : [sel],
+ a0 = [],
+ call = false,
+ i = 0, j = 0, k, x;
+ for (i = 0; i < a.length; i++) {
+ x = mn(obj, a[i], id, num, tot);
+ if (x[0]) {
+ call = true;
+ }
+ for (j = 0; j < x[1].length; j++) {
+ a0.push(x[1][j]);
+ }
+ }
+ if (a0.length && typeof obj === "object") {
+ if (a0.length >= 1) {
+ a0.unshift(",");
+ }
+ if (isArray(obj)) {
+ for (i = 0; i < obj.length; i++) {
+ forEach(a0, obj[i], fun, undefined, i, obj.length);
+ }
+ } else {
+ for (k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ forEach(a0, obj[k], fun, k);
+ }
+ }
+ }
+ }
+ if (call && fun) {
+ fun(obj);
+ }
+ }
+
+ function match(sel, obj) {
+ var a = [];
+ forEach(sel, obj, function(x) {
+ a.push(x);
+ });
+ return a;
+ }
+
+ function compile(sel) {
+ return {
+ sel: parse(sel)[1],
+ match: function(obj){
+ return match(this.sel, obj);
+ },
+ forEach: function(obj, fun) {
+ return forEach(this.sel, obj, fun);
+ }
+ };
+ }
+
+ exports._lex = lex;
+ exports._parse = parse;
+ exports.match = function (sel, obj) {
+ return compile(sel).match(obj);
+ };
+ exports.forEach = function(sel, obj, fun) {
+ return compile(sel).forEach(obj, fun);
+ };
+ exports.compile = compile;
+})(typeof exports === "undefined" ? (window.JSONSelect = {}) : exports);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.min.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.min.js b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.min.js
new file mode 100644
index 0000000..ec5015f
--- /dev/null
+++ b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.min.js
@@ -0,0 +1 @@
+(function(a){function z(a){return{sel:q(a)[1],match:function(a){return y(this.sel,a)},forEach:function(a,b){return x(this.sel,a,b)}}}function y(a,b){var c=[];x(a,b,function(a){c.push(a)});return c}function x(a,b,c,d,e,f){var g=a[0]===","?a.slice(1):[a],h=[],i=!1,j=0,k=0,l,m;for(j=0;j<g.length;j++){m=w(b,g[j],d,e,f),m[0]&&(i=!0);for(k=0;k<m[1].length;k++)h.push(m[1][k])}if(h.length&&typeof b=="object"){h.length>=1&&h.unshift(",");if(u(b))for(j=0;j<b.length;j++)x(h,b[j],c,undefined,j,b.length);else for(l in b)b.hasOwnProperty(l)&&x(h,b[l],c,l)}i&&c&&c(b)}function w(a,b,c,d,e){var f=[],g=b[0]===">"?b[1]:b[0],h=!0,i;g.type&&(h=h&&g.type===v(a)),g.id&&(h=h&&g.id===c),h&&g.pf&&(g.pf===":nth-last-child"?d=e-d:d++,g.a===0?h=g.b===d:(i=(d-g.b)%g.a,h=!i&&d*g.a+g.b>=0));if(h&&g.has){var j=function(){throw 42};for(var k=0;k<g.has.length;k++){try{x(g.has[k],a,j)}catch(l){if(l===42)continue}h=!1;break}}h&&g.expr&&(h=p(g.expr,a)),b[0]!==">"&&b[0].pc!==":root"&&f.push(b),h&&(b[0]===">"?b.length>2&&
(h=!1,f.push(b.slice(2))):b.length>1&&(h=!1,f.push(b.slice(1))));return[h,f]}function v(a){if(a===null)return"null";var b=typeof a;b==="object"&&u(a)&&(b="array");return b}function u(a){return Array.isArray?Array.isArray(a):b.call(a)==="[object Array]"}function t(a,b,c){var d=b,g={},j=i(a,b);j&&j[1]===" "&&(d=b=j[0],j=i(a,b)),j&&j[1]===f.typ?(g.type=j[2],j=i(a,b=j[0])):j&&j[1]==="*"&&(j=i(a,b=j[0]));for(;;){if(j===undefined)break;if(j[1]===f.ide)g.id&&e("nmi"),g.id=j[2];else if(j[1]===f.psc)(g.pc||g.pf)&&e("mpc"),j[2]===":first-child"?(g.pf=":nth-child",g.a=0,g.b=1):j[2]===":last-child"?(g.pf=":nth-last-child",g.a=0,g.b=1):g.pc=j[2];else{if(j[1]!==f.psf)break;if(j[2]===":val"||j[2]===":contains")g.expr=[undefined,j[2]===":val"?"=":"*=",undefined],j=i(a,b=j[0]),j&&j[1]===" "&&(j=i(a,b=j[0])),(!j||j[1]!=="(")&&e("pex"),j=i(a,b=j[0]),j&&j[1]===" "&&(j=i(a,b=j[0])),(!j||j[1]!==f.str)&&e("sex"),g.expr[2]=j[2],j=i(a,b=j[0]),j&&j[1]===" "&&(j=i(a,b=j[0])),(!j||j[1]!==")")&&e("epex");else i
f(j[2]===":has"){j=i(a,b=j[0]),j&&j[1]===" "&&(j=i(a,b=j[0])),(!j||j[1]!=="(")&&e("pex");var k=q(a,j[0],!0);j[0]=k[0],g.has||(g.has=[]),g.has.push(k[1])}else if(j[2]===":expr"){g.expr&&e("mexp");var l=o(a,j[0]);j[0]=l[0],g.expr=l[1]}else{(g.pc||g.pf)&&e("mpc"),g.pf=j[2];var m=h.exec(a.substr(j[0]));m||e("mepf"),m[5]?(g.a=2,g.b=m[5]==="odd"?1:0):m[6]?(g.a=0,g.b=parseInt(m[6],10)):(g.a=parseInt((m[1]?m[1]:"+")+(m[2]?m[2]:"1"),10),g.b=m[3]?parseInt(m[3]+m[4],10):0),j[0]+=m[0].length}}j=i(a,b=j[0])}d===b&&e("se");return[b,g]}function s(a){if(a[0]===","){var b=[","];for(var c=c;c<a.length;c++){var d=r(d[c]);b=b.concat(d[0]===","?d.slice(1):d)}return b}return r(a)}function r(a){var b=[],c;for(var d=0;d<a.length;d++)if(a[d]==="~"){if(d<2||a[d-2]!=">")c=a.slice(0,d-1),c=c.concat([{has:[[{pc:":root"},">",a[d-1]]]},">"]),c=c.concat(a.slice(d+1)),b.push(c);if(d>1){var e=a[d-2]===">"?d-3:d-2;c=a.slice(0,e);var f={};for(var g in a[e])a[e].hasOwnProperty(g)&&(f[g]=a[e][g]);f.has||(f.has=[]),f.has
.push([{pc:":root"},">",a[d-1]]),c=c.concat(f,">",a.slice(d+1)),b.push(c)}break}if(d==a.length)return a;return b.length>1?[","].concat(b):b[0]}function q(a,b,c,d){c||(d={});var f=[],g,h;b||(b=0);for(;;){var j=t(a,b,d);f.push(j[1]),j=i(a,b=j[0]),j&&j[1]===" "&&(j=i(a,b=j[0]));if(!j)break;if(j[1]===">"||j[1]==="~")j[1]==="~"&&(d.usesSiblingOp=!0),f.push(j[1]),b=j[0];else if(j[1]===",")g===undefined?g=[",",f]:g.push(f),f=[],b=j[0];else if(j[1]===")"){c||e("ucp"),h=1,b=j[0];break}}c&&!h&&e("mcp"),g&&g.push(f);var k;!c&&d.usesSiblingOp?k=s(g?g:f):k=g?g:f;return[b,k]}function p(a,b){if(a===undefined)return b;if(a===null||typeof a!="object")return a;var c=p(a[0],b),d=p(a[2],b);return l[a[1]][1](c,d)}function o(a,b){function c(a){return typeof a!="object"||a===null?a:a[0]==="("?c(a[1]):[c(a[0]),a[1],c(a[2])]}var d=n(a,b?b:0);return[d[0],c(d[1])]}function n(a,b){b||(b=0);var c=m(a,b),d;if(c&&c[1]==="("){d=n(a,c[0]);var f=m(a,d[0]);(!f||f[1]!==")")&&e("epex"),b=f[0],d=["(",d[1]]}else!c||c[1]&
&c[1]!="x"?e("ee"):(d=c[1]==="x"?undefined:c[2],b=c[0]);var g=m(a,b);if(!g||g[1]==")")return[b,d];(g[1]=="x"||!g[1])&&e("bop");var h=n(a,g[0]);b=h[0],h=h[1];var i;if(typeof h!="object"||h[0]==="("||l[g[1]][0]<l[h[1]][0])i=[d,g[1],h];else{i=h;while(typeof h[0]=="object"&&h[0][0]!="("&&l[g[1]][0]>=l[h[0][1]][0])h=h[0];h[0]=[d,g[1],h[0]]}return[b,i]}function m(a,b){var d,e=j.exec(a.substr(b));if(e){b+=e[0].length,d=e[1]||e[2]||e[3]||e[5]||e[6];if(e[1]||e[2]||e[3])return[b,0,c(d)];if(e[4])return[b,0,undefined];return[b,d]}}function k(a,b){return typeof a===b}function i(a,b){b||(b=0);var d=g.exec(a.substr(b));if(!d)return undefined;b+=d[0].length;var h;d[1]?h=[b," "]:d[2]?h=[b,d[0]]:d[3]?h=[b,f.typ,d[0]]:d[4]?h=[b,f.psc,d[0]]:d[5]?h=[b,f.psf,d[0]]:d[6]?e("upc"):d[8]?h=[b,d[7]?f.ide:f.str,c(d[8])]:d[9]?e("ujs"):d[10]&&(h=[b,f.ide,d[10].replace(/\\([^\r\n\f0-9a-fA-F])/g,"$1")]);return h}function e(a){throw new Error(d[a])}function c(a){try{if(JSON&&JSON.parse)return JSON.parse(a);return(ne
w Function("return "+a))()}catch(b){e("ijs")}}var b=Object.prototype.toString,d={bop:"binary operator expected",ee:"expression expected",epex:"closing paren expected ')'",ijs:"invalid json string",mcp:"missing closing paren",mepf:"malformed expression in pseudo-function",mexp:"multiple expressions not allowed",mpc:"multiple pseudo classes (:xxx) not allowed",nmi:"multiple ids not allowed",pex:"opening paren expected '('",se:"selector expected",sex:"string expected",sra:"string required after '.'",uc:"unrecognized char",ucp:"unexpected closing paren",ujs:"unclosed json string",upc:"unrecognized pseudo class"},f={psc:1,psf:2,typ:3,str:4,ide:5},g=new RegExp('^(?:([\\r\\n\\t\\ ]+)|([~*,>\\)\\(])|(string|boolean|null|array|object|number)|(:(?:root|first-child|last-child|only-child))|(:(?:nth-child|nth-last-child|has|expr|val|contains))|(:\\w+)|(?:(\\.)?(\\"(?:[^\\\\]|\\\\[^\\"])*\\"))|(\\")|\\.((?:[_a-zA-Z]|[^\\0-\\0177]|\\\\[^\\r\\n\\f0-9a-fA-F])(?:[_a-zA-Z0-9\\-]|[^\\u0000-\\u0177]|(?:
\\\\[^\\r\\n\\f0-9a-fA-F]))*))'),h=/^\s*\(\s*(?:([+\-]?)([0-9]*)n\s*(?:([+\-])\s*([0-9]))?|(odd|even)|([+\-]?[0-9]+))\s*\)/,j=new RegExp('^\\s*(?:(true|false|null)|(-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)|("(?:[^\\]|\\[^"])*")|(x)|(&&|\\|\\||[\\$\\^<>!\\*]=|[=+\\-*/%<>])|([\\(\\)]))'),l={"*":[9,function(a,b){return a*b}],"/":[9,function(a,b){return a/b}],"%":[9,function(a,b){return a%b}],"+":[7,function(a,b){return a+b}],"-":[7,function(a,b){return a-b}],"<=":[5,function(a,b){return k(a,"number")&&k(b,"number")&&a<=b}],">=":[5,function(a,b){return k(a,"number")&&k(b,"number")&&a>=b}],"$=":[5,function(a,b){return k(a,"string")&&k(b,"string")&&a.lastIndexOf(b)===a.length-b.length}],"^=":[5,function(a,b){return k(a,"string")&&k(b,"string")&&a.indexOf(b)===0}],"*=":[5,function(a,b){return k(a,"string")&&k(b,"string")&&a.indexOf(b)!==-1}],">":[5,function(a,b){return k(a,"number")&&k(b,"number")&&a>b}],"<":[5,function(a,b){return k(a,"number")&&k(b,"number")&&a<b}],"=":[3,function(a,b){re
turn a===b}],"!=":[3,function(a,b){return a!==b}],"&&":[2,function(a,b){return a&&b}],"||":[1,function(a,b){return a||b}]};a._lex=i,a._parse=q,a.match=function(a,b){return z(a).match(b)},a.forEach=function(a,b,c){return z(a).forEach(b,c)},a.compile=z})(typeof exports=="undefined"?window.JSONSelect={}:exports)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.min.js.gz
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.min.js.gz b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.min.js.gz
new file mode 100644
index 0000000..4eb9b37
Binary files /dev/null and b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/dist/jsonselect.min.js.gz differ
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/jsonselect.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/jsonselect.js b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/jsonselect.js
new file mode 100644
index 0000000..f0611ea
--- /dev/null
+++ b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/jsonselect.js
@@ -0,0 +1,522 @@
+/*! Copyright (c) 2011, Lloyd Hilaiel, ISC License */
+/*
+ * This is the JSONSelect reference implementation, in javascript.
+ */
+(function(exports) {
+
+ var // localize references
+ toString = Object.prototype.toString;
+
+ function jsonParse(str) {
+ try {
+ if(JSON && JSON.parse){
+ return JSON.parse(str);
+ }
+ return (new Function("return " + str))();
+ } catch(e) {
+ te("ijs", e.message);
+ }
+ }
+
+ // emitted error codes.
+ var errorCodes = {
+ "bop": "binary operator expected",
+ "ee": "expression expected",
+ "epex": "closing paren expected ')'",
+ "ijs": "invalid json string",
+ "mcp": "missing closing paren",
+ "mepf": "malformed expression in pseudo-function",
+ "mexp": "multiple expressions not allowed",
+ "mpc": "multiple pseudo classes (:xxx) not allowed",
+ "nmi": "multiple ids not allowed",
+ "pex": "opening paren expected '('",
+ "se": "selector expected",
+ "sex": "string expected",
+ "sra": "string required after '.'",
+ "uc": "unrecognized char",
+ "ucp": "unexpected closing paren",
+ "ujs": "unclosed json string",
+ "upc": "unrecognized pseudo class"
+ };
+
+ // throw an error message
+ function te(ec, context) {
+ throw new Error(errorCodes[ec] + ( context && " in '" + context + "'"));
+ }
+
+ // THE LEXER
+ var toks = {
+ psc: 1, // pseudo class
+ psf: 2, // pseudo class function
+ typ: 3, // type
+ str: 4, // string
+ ide: 5 // identifiers (or "classes", stuff after a dot)
+ };
+
+ // The primary lexing regular expression in jsonselect
+ var pat = new RegExp(
+ "^(?:" +
+ // (1) whitespace
+ "([\\r\\n\\t\\ ]+)|" +
+ // (2) one-char ops
+ "([~*,>\\)\\(])|" +
+ // (3) types names
+ "(string|boolean|null|array|object|number)|" +
+ // (4) pseudo classes
+ "(:(?:root|first-child|last-child|only-child))|" +
+ // (5) pseudo functions
+ "(:(?:nth-child|nth-last-child|has|expr|val|contains))|" +
+ // (6) bogusly named pseudo something or others
+ "(:\\w+)|" +
+ // (7 & 8) identifiers and JSON strings
+ "(?:(\\.)?(\\\"(?:[^\\\\\\\"]|\\\\[^\\\"])*\\\"))|" +
+ // (8) bogus JSON strings missing a trailing quote
+ "(\\\")|" +
+ // (9) identifiers (unquoted)
+ "\\.((?:[_a-zA-Z]|[^\\0-\\0177]|\\\\[^\\r\\n\\f0-9a-fA-F])(?:[_a-zA-Z0-9\\-]|[^\\u0000-\\u0177]|(?:\\\\[^\\r\\n\\f0-9a-fA-F]))*)" +
+ ")"
+ );
+
+ // A regular expression for matching "nth expressions" (see grammar, what :nth-child() eats)
+ var nthPat = /^\s*\(\s*(?:([+\-]?)([0-9]*)n\s*(?:([+\-])\s*([0-9]))?|(odd|even)|([+\-]?[0-9]+))\s*\)/;
+ function lex(str, off) {
+ if (!off) off = 0;
+ var m = pat.exec(str.substr(off));
+ if (!m) return undefined;
+ off+=m[0].length;
+ var a;
+ if (m[1]) a = [off, " "];
+ else if (m[2]) a = [off, m[0]];
+ else if (m[3]) a = [off, toks.typ, m[0]];
+ else if (m[4]) a = [off, toks.psc, m[0]];
+ else if (m[5]) a = [off, toks.psf, m[0]];
+ else if (m[6]) te("upc", str);
+ else if (m[8]) a = [off, m[7] ? toks.ide : toks.str, jsonParse(m[8])];
+ else if (m[9]) te("ujs", str);
+ else if (m[10]) a = [off, toks.ide, m[10].replace(/\\([^\r\n\f0-9a-fA-F])/g,"$1")];
+ return a;
+ }
+
+ // THE EXPRESSION SUBSYSTEM
+
+ var exprPat = new RegExp(
+ // skip and don't capture leading whitespace
+ "^\\s*(?:" +
+ // (1) simple vals
+ "(true|false|null)|" +
+ // (2) numbers
+ "(-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)|" +
+ // (3) strings
+ "(\"(?:[^\\]|\\[^\"])*\")|" +
+ // (4) the 'x' value placeholder
+ "(x)|" +
+ // (5) binops
+ "(&&|\\|\\||[\\$\\^<>!\\*]=|[=+\\-*/%<>])|" +
+ // (6) parens
+ "([\\(\\)])" +
+ ")"
+ );
+
+ function is(o, t) { return typeof o === t; }
+ var operators = {
+ '*': [ 9, function(lhs, rhs) { return lhs * rhs; } ],
+ '/': [ 9, function(lhs, rhs) { return lhs / rhs; } ],
+ '%': [ 9, function(lhs, rhs) { return lhs % rhs; } ],
+ '+': [ 7, function(lhs, rhs) { return lhs + rhs; } ],
+ '-': [ 7, function(lhs, rhs) { return lhs - rhs; } ],
+ '<=': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs <= rhs; } ],
+ '>=': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs >= rhs; } ],
+ '$=': [ 5, function(lhs, rhs) { return is(lhs, 'string') && is(rhs, 'string') && lhs.lastIndexOf(rhs) === lhs.length - rhs.length; } ],
+ '^=': [ 5, function(lhs, rhs) { return is(lhs, 'string') && is(rhs, 'string') && lhs.indexOf(rhs) === 0; } ],
+ '*=': [ 5, function(lhs, rhs) { return is(lhs, 'string') && is(rhs, 'string') && lhs.indexOf(rhs) !== -1; } ],
+ '>': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs > rhs; } ],
+ '<': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs < rhs; } ],
+ '=': [ 3, function(lhs, rhs) { return lhs === rhs; } ],
+ '!=': [ 3, function(lhs, rhs) { return lhs !== rhs; } ],
+ '&&': [ 2, function(lhs, rhs) { return lhs && rhs; } ],
+ '||': [ 1, function(lhs, rhs) { return lhs || rhs; } ]
+ };
+
+ function exprLex(str, off) {
+ var v, m = exprPat.exec(str.substr(off));
+ if (m) {
+ off += m[0].length;
+ v = m[1] || m[2] || m[3] || m[5] || m[6];
+ if (m[1] || m[2] || m[3]) return [off, 0, jsonParse(v)];
+ else if (m[4]) return [off, 0, undefined];
+ return [off, v];
+ }
+ }
+
+ function exprParse2(str, off) {
+ if (!off) off = 0;
+ // first we expect a value or a '('
+ var l = exprLex(str, off),
+ lhs;
+ if (l && l[1] === '(') {
+ lhs = exprParse2(str, l[0]);
+ var p = exprLex(str, lhs[0]);
+ if (!p || p[1] !== ')') te('epex', str);
+ off = p[0];
+ lhs = [ '(', lhs[1] ];
+ } else if (!l || (l[1] && l[1] != 'x')) {
+ te("ee", str + " - " + ( l[1] && l[1] ));
+ } else {
+ lhs = ((l[1] === 'x') ? undefined : l[2]);
+ off = l[0];
+ }
+
+ // now we expect a binary operator or a ')'
+ var op = exprLex(str, off);
+ if (!op || op[1] == ')') return [off, lhs];
+ else if (op[1] == 'x' || !op[1]) {
+ te('bop', str + " - " + ( op[1] && op[1] ));
+ }
+
+ // tail recursion to fetch the rhs expression
+ var rhs = exprParse2(str, op[0]);
+ off = rhs[0];
+ rhs = rhs[1];
+
+ // and now precedence! how shall we put everything together?
+ var v;
+ if (typeof rhs !== 'object' || rhs[0] === '(' || operators[op[1]][0] < operators[rhs[1]][0] ) {
+ v = [lhs, op[1], rhs];
+ }
+ else {
+ v = rhs;
+ while (typeof rhs[0] === 'object' && rhs[0][0] != '(' && operators[op[1]][0] >= operators[rhs[0][1]][0]) {
+ rhs = rhs[0];
+ }
+ rhs[0] = [lhs, op[1], rhs[0]];
+ }
+ return [off, v];
+ }
+
+ function exprParse(str, off) {
+ function deparen(v) {
+ if (typeof v !== 'object' || v === null) return v;
+ else if (v[0] === '(') return deparen(v[1]);
+ else return [deparen(v[0]), v[1], deparen(v[2])];
+ }
+ var e = exprParse2(str, off ? off : 0);
+ return [e[0], deparen(e[1])];
+ }
+
+ function exprEval(expr, x) {
+ if (expr === undefined) return x;
+ else if (expr === null || typeof expr !== 'object') {
+ return expr;
+ }
+ var lhs = exprEval(expr[0], x),
+ rhs = exprEval(expr[2], x);
+ return operators[expr[1]][1](lhs, rhs);
+ }
+
+ // THE PARSER
+
+ function parse(str, off, nested, hints) {
+ if (!nested) hints = {};
+
+ var a = [], am, readParen;
+ if (!off) off = 0;
+
+ while (true) {
+ var s = parse_selector(str, off, hints);
+ a.push(s[1]);
+ s = lex(str, off = s[0]);
+ if (s && s[1] === " ") s = lex(str, off = s[0]);
+ if (!s) break;
+ // now we've parsed a selector, and have something else...
+ if (s[1] === ">" || s[1] === "~") {
+ if (s[1] === "~") hints.usesSiblingOp = true;
+ a.push(s[1]);
+ off = s[0];
+ } else if (s[1] === ",") {
+ if (am === undefined) am = [ ",", a ];
+ else am.push(a);
+ a = [];
+ off = s[0];
+ } else if (s[1] === ")") {
+ if (!nested) te("ucp", s[1]);
+ readParen = 1;
+ off = s[0];
+ break;
+ }
+ }
+ if (nested && !readParen) te("mcp", str);
+ if (am) am.push(a);
+ var rv;
+ if (!nested && hints.usesSiblingOp) {
+ rv = normalize(am ? am : a);
+ } else {
+ rv = am ? am : a;
+ }
+ return [off, rv];
+ }
+
+ function normalizeOne(sel) {
+ var sels = [], s;
+ for (var i = 0; i < sel.length; i++) {
+ if (sel[i] === '~') {
+ // `A ~ B` maps to `:has(:root > A) > B`
+ // `Z A ~ B` maps to `Z :has(:root > A) > B, Z:has(:root > A) > B`
+ // This first clause, takes care of the first case, and the first half of the latter case.
+ if (i < 2 || sel[i-2] != '>') {
+ s = sel.slice(0,i-1);
+ s = s.concat([{has:[[{pc: ":root"}, ">", sel[i-1]]]}, ">"]);
+ s = s.concat(sel.slice(i+1));
+ sels.push(s);
+ }
+ // here we take care of the second half of above:
+ // (`Z A ~ B` maps to `Z :has(:root > A) > B, Z :has(:root > A) > B`)
+ // and a new case:
+ // Z > A ~ B maps to Z:has(:root > A) > B
+ if (i > 1) {
+ var at = sel[i-2] === '>' ? i-3 : i-2;
+ s = sel.slice(0,at);
+ var z = {};
+ for (var k in sel[at]) if (sel[at].hasOwnProperty(k)) z[k] = sel[at][k];
+ if (!z.has) z.has = [];
+ z.has.push([{pc: ":root"}, ">", sel[i-1]]);
+ s = s.concat(z, '>', sel.slice(i+1));
+ sels.push(s);
+ }
+ break;
+ }
+ }
+ if (i == sel.length) return sel;
+ return sels.length > 1 ? [','].concat(sels) : sels[0];
+ }
+
+ function normalize(sels) {
+ if (sels[0] === ',') {
+ var r = [","];
+ for (var i = i; i < sels.length; i++) {
+ var s = normalizeOne(s[i]);
+ r = r.concat(s[0] === "," ? s.slice(1) : s);
+ }
+ return r;
+ } else {
+ return normalizeOne(sels);
+ }
+ }
+
+ function parse_selector(str, off, hints) {
+ var soff = off;
+ var s = { };
+ var l = lex(str, off);
+ // skip space
+ if (l && l[1] === " ") { soff = off = l[0]; l = lex(str, off); }
+ if (l && l[1] === toks.typ) {
+ s.type = l[2];
+ l = lex(str, (off = l[0]));
+ } else if (l && l[1] === "*") {
+ // don't bother representing the universal sel, '*' in the
+ // parse tree, cause it's the default
+ l = lex(str, (off = l[0]));
+ }
+
+ // now support either an id or a pc
+ while (true) {
+ if (l === undefined) {
+ break;
+ } else if (l[1] === toks.ide) {
+ if (s.id) te("nmi", l[1]);
+ s.id = l[2];
+ } else if (l[1] === toks.psc) {
+ if (s.pc || s.pf) te("mpc", l[1]);
+ // collapse first-child and last-child into nth-child expressions
+ if (l[2] === ":first-child") {
+ s.pf = ":nth-child";
+ s.a = 0;
+ s.b = 1;
+ } else if (l[2] === ":last-child") {
+ s.pf = ":nth-last-child";
+ s.a = 0;
+ s.b = 1;
+ } else {
+ s.pc = l[2];
+ }
+ } else if (l[1] === toks.psf) {
+ if (l[2] === ":val" || l[2] === ":contains") {
+ s.expr = [ undefined, l[2] === ":val" ? "=" : "*=", undefined];
+ // any amount of whitespace, followed by paren, string, paren
+ l = lex(str, (off = l[0]));
+ if (l && l[1] === " ") l = lex(str, off = l[0]);
+ if (!l || l[1] !== "(") te("pex", str);
+ l = lex(str, (off = l[0]));
+ if (l && l[1] === " ") l = lex(str, off = l[0]);
+ if (!l || l[1] !== toks.str) te("sex", str);
+ s.expr[2] = l[2];
+ l = lex(str, (off = l[0]));
+ if (l && l[1] === " ") l = lex(str, off = l[0]);
+ if (!l || l[1] !== ")") te("epex", str);
+ } else if (l[2] === ":has") {
+ // any amount of whitespace, followed by paren
+ l = lex(str, (off = l[0]));
+ if (l && l[1] === " ") l = lex(str, off = l[0]);
+ if (!l || l[1] !== "(") te("pex", str);
+ var h = parse(str, l[0], true);
+ l[0] = h[0];
+ if (!s.has) s.has = [];
+ s.has.push(h[1]);
+ } else if (l[2] === ":expr") {
+ if (s.expr) te("mexp", str);
+ var e = exprParse(str, l[0]);
+ l[0] = e[0];
+ s.expr = e[1];
+ } else {
+ if (s.pc || s.pf ) te("mpc", str);
+ s.pf = l[2];
+ var m = nthPat.exec(str.substr(l[0]));
+ if (!m) te("mepf", str);
+ if (m[5]) {
+ s.a = 2;
+ s.b = (m[5] === "odd") ? 1 : 0;
+ } else if (m[6]) {
+ s.a = 0;
+ s.b = parseInt(m[6], 10);
+ } else {
+ s.a = parseInt((m[1] ? m[1] : "+") + (m[2] ? m[2] : "1"),10);
+ s.b = m[3] ? parseInt(m[3] + m[4],10) : 0;
+ }
+ l[0] += m[0].length;
+ }
+ } else {
+ break;
+ }
+ l = lex(str, (off = l[0]));
+ }
+
+ // now if we didn't actually parse anything it's an error
+ if (soff === off) te("se", str);
+
+ return [off, s];
+ }
+
+ // THE EVALUATOR
+
+ function isArray(o) {
+ return Array.isArray ? Array.isArray(o) :
+ toString.call(o) === "[object Array]";
+ }
+
+ function mytypeof(o) {
+ if (o === null) return "null";
+ var to = typeof o;
+ if (to === "object" && isArray(o)) to = "array";
+ return to;
+ }
+
+ function mn(node, sel, id, num, tot) {
+ var sels = [];
+ var cs = (sel[0] === ">") ? sel[1] : sel[0];
+ var m = true, mod;
+ if (cs.type) m = m && (cs.type === mytypeof(node));
+ if (cs.id) m = m && (cs.id === id);
+ if (m && cs.pf) {
+ if (cs.pf === ":nth-last-child") num = tot - num;
+ else num++;
+ if (cs.a === 0) {
+ m = cs.b === num;
+ } else {
+ mod = ((num - cs.b) % cs.a);
+
+ m = (!mod && ((num*cs.a + cs.b) >= 0));
+ }
+ }
+ if (m && cs.has) {
+ // perhaps we should augment forEach to handle a return value
+ // that indicates "client cancels traversal"?
+ var bail = function() { throw 42; };
+ for (var i = 0; i < cs.has.length; i++) {
+ try {
+ forEach(cs.has[i], node, bail);
+ } catch (e) {
+ if (e === 42) continue;
+ }
+ m = false;
+ break;
+ }
+ }
+ if (m && cs.expr) {
+ m = exprEval(cs.expr, node);
+ }
+ // should we repeat this selector for descendants?
+ if (sel[0] !== ">" && sel[0].pc !== ":root") sels.push(sel);
+
+ if (m) {
+ // is there a fragment that we should pass down?
+ if (sel[0] === ">") { if (sel.length > 2) { m = false; sels.push(sel.slice(2)); } }
+ else if (sel.length > 1) { m = false; sels.push(sel.slice(1)); }
+ }
+
+ return [m, sels];
+ }
+
+ function forEach(sel, obj, fun, id, num, tot) {
+ var a = (sel[0] === ",") ? sel.slice(1) : [sel],
+ a0 = [],
+ call = false,
+ i = 0, j = 0, k, x;
+ for (i = 0; i < a.length; i++) {
+ x = mn(obj, a[i], id, num, tot);
+ if (x[0]) {
+ call = true;
+ }
+ for (j = 0; j < x[1].length; j++) {
+ a0.push(x[1][j]);
+ }
+ }
+ if (a0.length && typeof obj === "object") {
+ if (a0.length >= 1) {
+ a0.unshift(",");
+ }
+ if (isArray(obj)) {
+ for (i = 0; i < obj.length; i++) {
+ forEach(a0, obj[i], fun, undefined, i, obj.length);
+ }
+ } else {
+ for (k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ forEach(a0, obj[k], fun, k);
+ }
+ }
+ }
+ }
+ if (call && fun) {
+ fun(obj);
+ }
+ }
+
+ function match(sel, obj) {
+ var a = [];
+ forEach(sel, obj, function(x) {
+ a.push(x);
+ });
+ return a;
+ }
+
+ function compile(sel) {
+ return {
+ sel: parse(sel)[1],
+ match: function(obj){
+ return match(this.sel, obj);
+ },
+ forEach: function(obj, fun) {
+ return forEach(this.sel, obj, fun);
+ }
+ };
+ }
+
+ exports._lex = lex;
+ exports._parse = parse;
+ exports.match = function (sel, obj) {
+ return compile(sel).match(obj);
+ };
+ exports.forEach = function(sel, obj, fun) {
+ return compile(sel).forEach(obj, fun);
+ };
+ exports.compile = compile;
+})(typeof exports === "undefined" ? (window.JSONSelect = {}) : exports);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/conformance_tests.html
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/conformance_tests.html b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/conformance_tests.html
new file mode 100644
index 0000000..a53dfd0
--- /dev/null
+++ b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/conformance_tests.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title> JSONSelect conformance tests </title>
+ <link href='css/style.css' type='text/css' rel='stylesheet'>
+</head>
+<body>
+These are the the official JSONQuery conformance tests. <button id="runit">run tests</button>
+<div id="tests">
+</div>
+</body>
+<script src="../jsonselect.js"></script>
+<script src="js/jquery-1.6.1.min.js"></script>
+<script src="js/conf_tests.js"></script>
+</html>
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/css/style.css
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/css/style.css b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/css/style.css
new file mode 100644
index 0000000..f62cc9d
--- /dev/null
+++ b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/css/style.css
@@ -0,0 +1,43 @@
+pre {
+ color: #ddd;
+ background-color: #333;
+ padding: 1em;
+ border-radius: 1em;
+ -moz-border-radius: 1em;
+ -webkit-border-radius: 1em;
+}
+
+pre.selector {
+ text-align: center;
+ padding: .5em;
+ cursor: pointer;
+}
+
+pre.document {
+ max-height: 150px;
+ overflow: auto;
+}
+
+pre.success {
+ background-color: #363;
+}
+
+pre.failure {
+ background-color: #633;
+}
+
+table {
+ width: 100%;
+}
+
+table td {
+ width: 50%;
+}
+
+table pre {
+ height: 100%;
+}
+
+h1,h2 {
+ text-align: center;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/js/conf_tests.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/js/conf_tests.js b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/js/conf_tests.js
new file mode 100644
index 0000000..42711ea
--- /dev/null
+++ b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/js/conf_tests.js
@@ -0,0 +1,77 @@
+$(document).ready(function() {
+ var tests = {};
+
+ $("#runit").click(function() {
+ for (var k in tests) {
+ var obj = JSON.parse($("." + k + "_document").text());
+ for (var i = 0; i < tests[k].length; i++) {
+ var n = tests[k][i];
+ var cl = k + "_" + n;
+ var b = $("." + cl + "_output.before");
+ var a = $("." + cl + "_output.after");
+ var s = $("." + cl + "_selector.selector");
+ try {
+ a.text("");
+ JSONSelect.forEach(s.text(), obj, function(m) {
+ a.text($.trim(a.text() + "\n" + JSON.stringify(m, null, " ")));
+ });
+ } catch(e) {
+ a.text("Error: " + e);
+ }
+ if (a.text() === b.text()) s.addClass("success").removeClass("failure");
+ else s.addClass("failure").removeClass("success");
+ }
+ }
+ });
+
+ function fetchFile(p, c) {
+ $.get(p, function (data) {
+ $("." + c).text($.trim(data));
+ });
+ }
+
+ function renderTests() {
+ function setClickToggle(cTarget, node) {
+ cTarget.click(function() { node.toggle("medium"); });
+ }
+
+ var c = $("<div/>");
+ for (var k in tests) {
+ c.append($("<h1/>").text("document: " + k));
+ var cl = k + "_document";
+ c.append($("<pre/>").addClass(cl).addClass("document").text("loading document..."));
+ fetchFile("tests/" + k + ".json", cl);
+ for (var i = 0; i < tests[k].length; i++) {
+ var n = tests[k][i];
+ var cl = k + "_" + n + "_selector";
+ var s = $("<pre/>").addClass(cl).addClass("selector").text("loading selector...");
+ c.append(s);
+ fetchFile("tests/" + k + "_" + n + ".selector", cl);
+ cl = k + "_" + n + "_output";
+ var t = $("<table/>").append($("<tr/>").append(
+ $("<td/>").append($("<pre/>").addClass(cl).addClass("before").text("loading output..."))).append(
+ $("<td/>").append($("<pre/>").addClass(cl).addClass("after").text("... test output ..."))));
+
+ c.append(t);
+ t.hide();
+ setClickToggle(s, t);
+ fetchFile("tests/" + k + "_" + n + ".output", cl + ".before");
+ }
+ }
+ c.appendTo($("#tests"));
+ }
+
+ $.get("tests/alltests.txt", function (data) {
+ var lines = data.split("\n");
+ for (var i = 0; i < lines.length; i++) {
+ var f = $.trim(lines[i]);
+ if (f.length == 0) continue;
+ var m = /^([A-Za-z]+)_(.+)\.selector$/.exec(f);
+ if (m) {
+ if (!tests.hasOwnProperty(m[1])) tests[m[1]] = [];
+ tests[m[1]].push(m[2]);
+ }
+ }
+ renderTests();
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/js/doctest.css
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/js/doctest.css b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/js/doctest.css
new file mode 100644
index 0000000..7403feb
--- /dev/null
+++ b/node_modules/node-firefox-connect/node_modules/firefox-client/node_modules/js-select/node_modules/JSONSelect/src/test/js/doctest.css
@@ -0,0 +1,69 @@
+pre {
+ overflow: auto;
+}
+
+pre.doctest {
+ border-left: 3px solid #99f;
+ padding-left: 1em;
+}
+
+pre.output {
+ border-left: 3px solid #9f9;
+ padding-left: 1em;
+}
+
+.doctest-example-prompt {
+ color: #333;
+}
+
+.doctest-success {
+ color: #060;
+}
+
+.doctest-failure {
+ color: #600;
+}
+
+.doctest-example-detail {
+ color: #060;
+ font-weight: bold;
+}
+
+a.doctest-failure-link {
+ text-decoration: none;
+}
+
+a.doctest-failure-link:hover {
+ text-decoration: underline;
+}
+
+.doctest-example:target {
+ border-left: 3px solid #f00;
+}
+
+div.test:target {
+ border: 3px solid #ff0;
+}
+
+div.test {
+ border: 1px solid #999;
+ margin-bottom: 1em;
+}
+
+div.test .test-id {
+ position: relative;
+ float: right;
+ background-color: #000;
+ color: #bbb;
+ padding: 3px;
+}
+
+div.test .test-id a:link,
+div.test .test-id a:visited {
+ color: #bbb;
+ text-decoration: none;
+}
+
+div.test .test-id a:hover {
+ text-decoration: underline;
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org