From 21a6d9f4fae42bafc3e845070095bce4a05d7af3 Mon Sep 17 00:00:00 2001 From: Paolo Scanferla Date: Thu, 10 Jul 2014 22:33:58 +0200 Subject: [PATCH] Rerun karma tests. --- .../dist/asteroid.js.html | 3298 ---------------- .../dist/index.html | 350 -- .../index.html | 350 -- .../prettify.css | 1 - .../prettify.js | 1 - .../dist/asteroid.js.html | 3505 ----------------- .../dist/index.html | 350 -- .../index.html | 350 -- .../prettify.css | 1 - .../prettify.js | 1 - .../dist/asteroid.js.html | 114 +- .../dist/index.html | 2 +- .../index.html | 2 +- .../dist/asteroid.js.html | 3349 ---------------- .../dist/index.html | 350 -- .../Firefox 29.0.0 (Mac OS X 10.9)/index.html | 350 -- .../prettify.css | 1 - .../prettify.js | 1 - .../dist/asteroid.js.html | 116 +- .../dist/index.html | 2 +- .../Firefox 30.0.0 (Mac OS X 10.9)/index.html | 2 +- .../dist/asteroid.js.html | 3298 ---------------- .../dist/index.html | 350 -- .../Safari 7.0.3 (Mac OS X 10.9.2)/index.html | 350 -- .../prettify.css | 1 - .../prettify.js | 1 - .../dist/asteroid.js.html | 3505 ----------------- .../dist/index.html | 350 -- .../Safari 7.0.4 (Mac OS X 10.9.3)/index.html | 350 -- .../prettify.css | 1 - .../prettify.js | 1 - .../dist/asteroid.js.html | 116 +- .../dist/index.html | 2 +- .../Safari 7.0.5 (Mac OS X 10.9.4)/index.html | 2 +- 34 files changed, 179 insertions(+), 20644 deletions(-) delete mode 100644 test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/dist/asteroid.js.html delete mode 100644 test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/dist/index.html delete mode 100644 test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/index.html delete mode 100644 test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/prettify.css delete mode 100644 test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/prettify.js delete mode 100644 test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/dist/asteroid.js.html delete mode 100644 test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/dist/index.html delete mode 100644 test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/index.html delete mode 100644 test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/prettify.css delete mode 100644 test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/prettify.js delete mode 100644 test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/dist/asteroid.js.html delete mode 100644 test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/dist/index.html delete mode 100644 test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/index.html delete mode 100644 test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/prettify.css delete mode 100644 test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/prettify.js delete mode 100644 test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/dist/asteroid.js.html delete mode 100644 test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/dist/index.html delete mode 100644 test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/index.html delete mode 100644 test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/prettify.css delete mode 100644 test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/prettify.js delete mode 100644 test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/dist/asteroid.js.html delete mode 100644 test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/dist/index.html delete mode 100644 test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/index.html delete mode 100644 test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/prettify.css delete mode 100644 test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/prettify.js diff --git a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/dist/asteroid.js.html b/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/dist/asteroid.js.html deleted file mode 100644 index 527671d..0000000 --- a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/dist/asteroid.js.html +++ /dev/null @@ -1,3298 +0,0 @@ - - - - Code coverage report for dist/asteroid.js - - - - - - - -
-

Code coverage report for dist/asteroid.js

-

- - Statements: 65.34% (313 / 479)      - - - Branches: 52.55% (72 / 137)      - - - Functions: 61.46% (59 / 96)      - - - Lines: 65.47% (309 / 472)      - - Ignored: none      -

-
All files » dist/ » asteroid.js
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466 -467 -468 -469 -470 -471 -472 -473 -474 -475 -476 -477 -478 -479 -480 -481 -482 -483 -484 -485 -486 -487 -488 -489 -490 -491 -492 -493 -494 -495 -496 -497 -498 -499 -500 -501 -502 -503 -504 -505 -506 -507 -508 -509 -510 -511 -512 -513 -514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526 -527 -528 -529 -530 -531 -532 -533 -534 -535 -536 -537 -538 -539 -540 -541 -542 -543 -544 -545 -546 -547 -548 -549 -550 -551 -552 -553 -554 -555 -556 -557 -558 -559 -560 -561 -562 -563 -564 -565 -566 -567 -568 -569 -570 -571 -572 -573 -574 -575 -576 -577 -578 -579 -580 -581 -582 -583 -584 -585 -586 -587 -588 -589 -590 -591 -592 -593 -594 -595 -596 -597 -598 -599 -600 -601 -602 -603 -604 -605 -606 -607 -608 -609 -610 -611 -612 -613 -614 -615 -616 -617 -618 -619 -620 -621 -622 -623 -624 -625 -626 -627 -628 -629 -630 -631 -632 -633 -634 -635 -636 -637 -638 -639 -640 -641 -642 -643 -644 -645 -646 -647 -648 -649 -650 -651 -652 -653 -654 -655 -656 -657 -658 -659 -660 -661 -662 -663 -664 -665 -666 -667 -668 -669 -670 -671 -672 -673 -674 -675 -676 -677 -678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -695 -696 -697 -698 -699 -700 -701 -702 -703 -704 -705 -706 -707 -708 -709 -710 -711 -712 -713 -714 -715 -716 -717 -718 -719 -720 -721 -722 -723 -724 -725 -726 -727 -728 -729 -730 -731 -732 -733 -734 -735 -736 -737 -738 -739 -740 -741 -742 -743 -744 -745 -746 -747 -748 -749 -750 -751 -752 -753 -754 -755 -756 -757 -758 -759 -760 -761 -762 -763 -764 -765 -766 -767 -768 -769 -770 -771 -772 -773 -774 -775 -776 -777 -778 -779 -780 -781 -782 -783 -784 -785 -786 -787 -788 -789 -790 -791 -792 -793 -794 -795 -796 -797 -798 -799 -800 -801 -802 -803 -804 -805 -806 -807 -808 -809 -810 -811 -812 -813 -814 -815 -816 -817 -818 -819 -820 -821 -822 -823 -824 -825 -826 -827 -828 -829 -830 -831 -832 -833 -834 -835 -836 -837 -838 -839 -840 -841 -842 -843 -844 -845 -846 -847 -848 -849 -850 -851 -852 -853 -854 -855 -856 -857 -858 -859 -860 -861 -862 -863 -864 -865 -866 -867 -868 -869 -870 -871 -872 -873 -874 -875 -876 -877 -878 -879 -880 -881 -882 -883 -884 -885 -886 -887 -888 -889 -890 -891 -892 -893 -894 -895 -896 -897 -898 -899 -900 -901 -902 -903 -904 -905 -906 -907 -908 -909 -910 -911 -912 -913 -914 -915 -916 -917 -918 -919 -920 -921 -922 -923 -924 -925 -926 -927 -928 -929 -930 -931 -932 -933 -934 -935 -936 -937 -938 -939 -940 -941 -942 -943 -944 -945 -946 -947 -948 -949 -950 -951 -952 -953 -954 -955 -956 -957 -958 -959 -960 -961 -962 -963 -964 -965 -966 -967 -968 -969 -970 -971 -972 -973 -974 -975 -976 -977 -978 -979 -980 -981 -982 -983 -984 -985 -986 -987 -988 -989 -990 -991 -992 -9931 -1 -  -1 -  -  -1 -  -  -  -  -  -1 -1097 -  -  -1097 -1097 -  -  -9 -  -  -  -  -  -1088 -  -  -1088 -  -  -  -  -  -1 -  -1 -  -  -  -  -52 -52 -52 -  -  -  -  -  -  -  -  -  -316 -316 -4 -4 -4 -4 -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -47 -47 -376 -  -47 -  -  -1 -  -  -  -1 -  -  -  -  -  -1 -  -1 -766 -  -  -1 -463 -463 -7 -  -  -  -1 -  -  -  -  -  -  -1 -303 -303 -1 -  -  -  -  -  -  -  -1 -  -24 -  -23 -  -  -23 -1 -  -  -  -  -  -22 -  -  -  -  -  -  -  -23 -23 -  -23 -  -  -1 -1 -  -  -  -  -  -  -  -1 -17 -  -  -17 -  -17 -  -  -1 -  -  -  -1 -  -1 -  -17 -  -  -  -  -  -  -  -  -17 -  -  -17 -  -  -17 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -  -7 -  -6 -6 -  -  -6 -6 -6 -  -3 -  -2 -2 -  -  -1 -  -  -6 -  -1 -  -  -6 -  -6 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -552 -552 -552 -552 -552 -  -  -  -  -  -  -  -  -1 -33 -33 -33 -  -1 -  -  -  -  -  -  -  -1 -  -71 -2 -  -69 -  -69 -  -1 -  -1 -  -1 -69 -69 -  -69 -69 -49 -  -2 -2 -  -  -47 -  -  -69 -  -1 -  -71 -47 -  -71 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -8 -8 -  -2 -  -2 -  -  -8 -  -1 -  -1 -  -1 -8 -8 -  -8 -8 -3 -  -2 -  -2 -1 -1 -  -2 -  -  -1 -1 -  -  -8 -  -1 -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -10 -10 -1 -  -  -9 -2 -  -  -7 -  -7 -5 -  -7 -  -7 -  -1 -  -3 -3 -1 -1 -  -2 -  -2 -1 -1 -  -1 -  -  -1 -  -1 -7 -7 -  -7 -  -7 -  -  -  -7 -  -  -7 -3 -  -2 -2 -2 -2 -  -  -1 -1 -  -  -7 -  -1 -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -12 -12 -  -12 -12 -  -12 -  -  -  -12 -  -  -  -  -  -1 -1 -  -1 -12 -  -  -1 -  -12 -  -  -552 -  -  -  -  -  -552 -552 -690 -606 -606 -  -  -  -  -  -552 -552 -552 -475 -  -  -  -  -77 -  -  -  -  -1 -12 -12 -  -  -12 -  -12 -12 -  -  -  -  -1 -  -1 -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -1 -1 -1 -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -58 -  -15 -15 -  -15 -2 -  -  -58 -  -  -1 -1 -  -1 -  -304 -303 -  -302 -302 -  -302 -  -  -1 -  -18 -17 -17 -  -17 -  -  -1 -  -27 -  -26 -  -  -1 -  -74 -73 -  -  -1 -  -  -14 -  -  -14 -  -  -14 -14 -  -  -752 -752 -752 -177 -  -  -  -  -  -14 -  -  -2 -2 -2 -1 -  -  -14 -2 -  -  -  -14 -  -  -1 -15 -15 -15 -15 -228 -  -  -15 -  -  -1 -  -  -  -  -1 -  -  -  -  -  -1 -8 -8 -8 -  -8 -8 -  -8 -8 -8 -8 -  -1 -  -1 -2 -  -  -1 -1 -  -  -1 -2 -  -  -1 -1 -1 -  -1 -  -  -  -  -  -  -  -  -1 -  -9 -  -8 -8 -8 -8 -  -  -1 -  -  -  -  -  -  -1 -  -  - 
(function (root, factory) {
-    Iif (typeof define === "function" && define.amd) {
-        define(factory);
-    } else Iif (typeof exports === "object") {
-        module.exports = factory();
-    } else {
-        root.Asteroid = factory();
-    }
-}(this, function () {
- 
-"use strict";
- 
-function clone (obj) {
-	Iif (typeof EJSON !== "undefined") {
-		return EJSON.clone(obj);
-	}
-	var type = typeof obj;
-	switch (type) {
-		case "undefined":
-		case "function":
-			return undefined;
-		case "string":
-		case "number":
-		case "boolean":
-			return obj;
-		case "object":
-			Iif (obj === null) {
-				return null;
-			}
-			return JSON.parse(JSON.stringify(obj));
-		default:
-			return;
-	}
-}
- 
-var EventEmitter = function () {};
- 
-EventEmitter.prototype = {
- 
-	constructor: EventEmitter,
- 
-	on: function (name, handler) {
-		if (!this._events) this._events = {};
-		this._events[name] = this._events[name] || [];
-		this._events[name].push(handler);
-	},
- 
-	off: function (name, handler) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		this._events[name].splice(this._events[name].indexOf(handler), 1);
-	},
- 
-	_emit: function (name /* , arguments */) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		var args = arguments;
-		var self = this;
-		this._events[name].forEach(function (handler) {
-			handler.apply(self, Array.prototype.slice.call(args, 1));
-		});
-	}
- 
-};
- 
-function formQs (obj) {
-	var qs = "";
-	for (var key in obj) {
-		qs += key + "=" + obj[key] + "&";
-	}
-	qs = qs.slice(0, -1);
-	return qs;
-}
- 
-function guid () {
-	var ret = "";
-	for (var i=0; i<8; i++) {
-		ret += Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
-	}
-	return ret;
-}
- 
-function isEmail (string) {
-	return string.indexOf("@") !== -1;
-}
- 
-function isEqual (obj1, obj2) {
-	var str1 = JSON.stringify(obj1);
-	var str2 = JSON.stringify(obj2);
-	return str1 === str2;
-}
- 
-var must = {};
- 
-must._toString = function (thing) {
-	return Object.prototype.toString.call(thing).slice(8, -1);
-};
- 
-must.beString = function (s) {
-	var type = this._toString(s);
-	if (type !== "String") {
-		throw new Error("Assertion failed: expected String, instead got " + type);
-	}
-};
- 
-must.beArray = function (o) {
-	var type = this._toString(o);
-	if (type !== "Array") {
-		throw new Error("Assertion failed: expected Array, instead got " + type);
-	}
-};
- 
-must.beObject = function (o) {
-	var type = this._toString(o);
-	if (type !== "Object") {
-		throw new Error("Assertion failed: expected Object, instead got " + type);
-	}
-};
- 
-//////////////////////////
-// Asteroid constructor //
-//////////////////////////
- 
-var Asteroid = function (host, ssl, debug) {
-	// Assert arguments type
-	must.beString(host);
-	// Configure the instance
-	this._host = (ssl ? "https://" : "http://") + host;
-	// If SockJS is available, use it, otherwise, use WebSocket
-	// Note: SockJS is required for IE9 support
-	if (window.SockJS) {
-		this._ddpOptions = {
-			endpoint: (ssl ? "https://" : "http://") + host + "/sockjs",
-			SocketConstructor: window.SockJS,
-			debug: debug
-		};
-	} else {
-		this._ddpOptions = {
-			endpoint: (ssl ? "wss://" : "ws://") + host + "/websocket",
-			SocketConstructor: window.WebSocket,
-			debug: debug
-		};
-	}
- 
-	// Reference containers
-	this.collections = {};
-	this.subscriptions = {};
-	// Init the instance
-	this._init();
-};
-// Asteroid instances are EventEmitter-s
-Asteroid.prototype = Object.create(EventEmitter.prototype);
-Asteroid.prototype.constructor = Asteroid;
- 
- 
- 
-////////////////////////////////
-// Establishes the connection //
-////////////////////////////////
- 
-Asteroid.prototype._init = function () {
-	var self = this;
-	// Creates the DDP instance, that will automatically
-	// connect to the DDP server.
-	self.ddp = new DDP(this._ddpOptions);
-	// Register handlers
-	self.ddp.on("connected", function () {
-		// Upon connection, try resuming the login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Subscribe to the meteor.loginServiceConfiguration
-		// collection, which holds the configuration options
-		// to login via third party services (oauth).
-		self.ddp.sub("meteor.loginServiceConfiguration");
-		// Emit the connected event
-		self._emit("connected");
-	});
-	self.ddp.on("reconnected", function () {
-		// Upon reconnection, try resuming the login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Re-establish all previously established (and still active) subscriptions
-		self._reEstablishSubscriptions();
-		// Emit the reconnected event
-		self._emit("reconnected");
-	});
-	self.ddp.on("added", function (data) {
-		self._onAdded(data);
-	});
-	self.ddp.on("changed", function (data) {
-		self._onChanged(data);
-	});
-	self.ddp.on("removed", function (data) {
-		self._onRemoved(data);
-	});
-};
- 
- 
- 
-///////////////////////////////////////
-// Handler for the ddp "added" event //
-///////////////////////////////////////
- 
-Asteroid.prototype._onAdded = function (data) {
-	// Get the name of the collection
-	var cName = data.collection;
-	// If the collection does not exist yet, create it
-	if (!this.collections[cName]) {
-		this.collections[cName] = new Asteroid._Collection(cName, this);
-	}
-	// data.fields can be undefined if the item added has only
-	// the _id field . To avoid errors down the line, ensure item
-	// is an object.
-	var item = data.fields || {};
-	item._id = data.id;
-	// Perform the remote insert
-	this.collections[cName]._remoteToLocalInsert(item);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "removed" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onRemoved = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// Perform the reomte remove
-	this.collections[data.collection]._remoteToLocalRemove(data.id);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "changes" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onChanged = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// data.fields can be undefined if the update only
-	// removed some properties in the item. Make sure
-	// it's an object
-	if (!data.fields) {
-		data.fields = {};
-	}
-	// If there were cleared fields, explicitly set them
-	// to undefined in the data.fields object. This will
-	// cause those fields to be present in the for ... in
-	// loop the remote update method of the collection
-	// performs, causing then the fields to be actually
-	// cleared from the item
-	if (data.cleared) {
-		data.cleared.forEach(function (key) {
-			data.fields[key] = undefined;
-		});
-	}
-	// Perform the remote update
-	this.collections[data.collection]._remoteToLocalUpdate(data.id, data.fields);
-};
- 
- 
- 
- 
- 
- 
- 
-////////////////////////////
-// Call and apply methods //
-////////////////////////////
- 
-Asteroid.prototype.call = function (method /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(method);
-	// Get the parameters for apply
-	var params = Array.prototype.slice.call(arguments, 1);
-	// Call apply
-	return this.apply(method, params);
-};
- 
-Asteroid.prototype.apply = function (method, params) {
-	// Assert arguments type
-	must.beString(method);
-	// If no parameters are given, use an empty array
-	Eif (!Array.isArray(params)) {
-		params = [];
-	}
-	// Create the result and updated promises
-	var resultDeferred = Q.defer();
-	var updatedDeferred = Q.defer();
-	var onResult = function (err, res) {
-		// The onResult handler takes care of errors
-		if (err) {
-			// If errors ccur, reject both promises
-			resultDeferred.reject(err);
-			updatedDeferred.reject();
-		} else {
-			// Otherwise resolve the result one
-			resultDeferred.resolve(res);
-		}
-	};
-	var onUpdated = function () {
-		// Just resolve the updated promise
-		updatedDeferred.resolve();
-	};
-	// Perform the method call
-	this.ddp.method(method, params, onResult, onUpdated);
-	// Return an object containing both promises
-	return {
-		result: resultDeferred.promise,
-		updated: updatedDeferred.promise
-	};
-};
- 
- 
- 
-/////////////////////
-// Syntactic sugar //
-/////////////////////
- 
-Asteroid.prototype.createCollection = function (name) {
-	// Assert arguments type
-	must.beString(name);
-	// Only create the collection if it doesn't exist
-	if (!this.collections[name]) {
-		this.collections[name] = new Asteroid._Collection(name, this);
-	}
-	return this.collections[name];
-};
- 
-///////////////////////////////////////////
-// Removal and update suffix for backups //
-///////////////////////////////////////////
- 
-var mf_removal_suffix = "__del__";
-var mf_update_suffix = "__upd__";
-var is_backup = function (id) {
-	var l1 = mf_removal_suffix.length;
-	var l2 = mf_update_suffix.length;
-	var s1 = id.slice(-1 * l1);
-	var s2 = id.slice(-1 * l2);
-	return s1 === mf_removal_suffix || s2 === mf_update_suffix;
-};
- 
- 
- 
-/////////////////////////////////////////////
-// Collection class constructor definition //
-/////////////////////////////////////////////
- 
-var Collection = function (name, asteroidRef) {
-	this.name = name;
-	this.asteroid = asteroidRef;
-	this._set = new Set();
-};
-Collection.prototype.constructor = Collection;
- 
- 
- 
-///////////////////////////////////////////////
-// Insert-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalInsert = function (item) {
-	// If an item by that id already exists, raise an exception
-	if (this._set.contains(item._id)) {
-		throw new Error("Item " + item._id + " already exists");
-	}
-	this._set.put(item._id, item);
-	// Return a promise, just for api consistency
-	return Q(item._id);
-};
-Collection.prototype._remoteToLocalInsert = function (item) {
-	// The server is the SSOT, add directly
-	this._set.put(item._id, item);
-};
-Collection.prototype._localToRemoteInsert = function (item) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/insert";
-	self.asteroid.ddp.method(methodName, [item], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			self._set.del(item._id);
-			deferred.reject(err);
-		} else {
-			// Else resolve the promise
-			deferred.resolve(item._id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.insert = function (item) {
-	// If the time has no id, generate one for it
-	if (!item._id) {
-		item._id = guid();
-	}
-	return {
-		// Perform the local insert
-		local: this._localToLocalInsert(item),
-		// Send the insert request
-		remote: this._localToRemoteInsert(item)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Remove-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalRemove = function (id) {
-	// Check if the item exists in the database
-	var existing = this._set.get(id);
-	if (existing) {
-		// Create a backup of the object to delete
-		this._set.put(id + mf_removal_suffix, existing);
-		// Delete the object
-		this._set.del(id);
-	}
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalRemove = function (id) {
-	// The server is the SSOT, remove directly (item and backup)
-	this._set.del(id);
-};
-Collection.prototype._localToRemoteRemove = function (id) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/remove";
-	self.asteroid.ddp.method(methodName, [{_id: id}], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_removal_suffix);
-			// Ensure there is a backup
-			if (backup) {
-				self._set.put(id, backup);
-				self._set.del(id + mf_removal_suffix);
-			}
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_removal_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.remove = function (id) {
-	return {
-		// Perform the local remove
-		local: this._localToLocalRemove(id),
-		// Send the remove request
-		remote: this._localToRemoteRemove(id)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Update-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalUpdate = function (id, fields) {
-	// Ensure the item actually exists
-	var existing = this._set.get(id);
-	if (!existing) {
-		throw new Error("Item " + id + " doesn't exist");
-	}
-	// Ensure the _id property won't get modified
-	if (fields._id && fields._id !== id) {
-		throw new Error("Modifying the _id of a document is not allowed");
-	}
-	// Create a backup
-	this._set.put(id + mf_update_suffix, existing);
-	// Perform the update
-	for (var field in fields) {
-		existing[field] = fields[field];
-	}
-	this._set.put(id, existing);
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalUpdate = function (id, fields) {
-	// Ensure the item exixts in the database
-	var existing = this._set.get(id);
-	if (!existing) {
-		console.warn("Server misbehaviour: item " + id + " doesn't exist");
-		return;
-	}
-	for (var field in fields) {
-		// Ensure the server is not trying to moify the item _id
-		if (field === "_id" && fields._id !== id) {
-			console.warn("Server misbehaviour: modifying the _id of a document is not allowed");
-			return;
-		}
-		existing[field] = fields[field];
-	}
-	// Perform the update
-	this._set.put(id, existing);
-};
-Collection.prototype._localToRemoteUpdate = function (id, fields) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/update";
-	// Construct the selector
-	var sel = {
-		_id: id
-	};
-	// Construct the modifier
-	var mod = {
-		$set: fields
-	};
-	self.asteroid.ddp.method(methodName, [sel, mod], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_update_suffix);
-			self._set.put(id, backup);
-			self._set.del(id + mf_update_suffix);
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_update_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.update = function (id, fields) {
-	return {
-		// Perform the local update
-		local: this._localToLocalUpdate(id, fields),
-		// Send the update request
-		remote: this._localToRemoteUpdate(id, fields)
-	};
-};
- 
- 
- 
-//////////////////////////////
-// Reactive queries methods //
-//////////////////////////////
- 
-var ReactiveQuery = function (set) {
-	var self = this;
-	self.result = [];
- 
-	self._set = set;
-	self._getResult();
- 
-	self._set.on("put", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
-	self._set.on("del", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
- 
-};
-ReactiveQuery.prototype = Object.create(EventEmitter.prototype);
-ReactiveQuery.constructor = ReactiveQuery;
- 
-ReactiveQuery.prototype._getResult = function () {
-	this.result = this._set.toArray();
-};
- 
-var getFilterFromSelector = function (selector) {
-	// Return the filter function
-	return function (id, item) {
- 
-		// Filter out backups
-		Iif (is_backup(id)) {
-			return false;
-		}
- 
-		// Get the value of the object from a compund key
-		// (e.g. "profile.name.first")
-		var getItemVal = function (item, key) {
-			return key.split(".").reduce(function (prev, curr) {
-				if (!prev) return prev;
-				prev = prev[curr];
-				return prev;
-			}, item);
-		};
- 
-		// Iterate all the keys in the selector. The first that
-		// doesn't match causes the item to be filtered out.
-		for (var key in selector) {
-			var itemVal = getItemVal(item, key);
-			if (itemVal !== selector[key]) {
-				return false;
-			}
-		}
- 
-		// At this point the item matches the selector
-		return true;
- 
-	};
-};
- 
-Collection.prototype.reactiveQuery = function (selectorOrFilter) {
-	var filter;
-	Iif (typeof selectorOrFilter === "function") {
-		filter = selectorOrFilter;
-	} else {
-		filter = getFilterFromSelector(selectorOrFilter);
-	}
-	var subset = this._set.filter(filter);
-	return new ReactiveQuery(subset);
-};
- 
- 
- 
-Asteroid._Collection = Collection;
- 
-Asteroid.prototype._getOauthClientId = function (serviceName) {
-	var loginConfigCollectionName = "meteor_accounts_loginServiceConfiguration";
-	var loginConfigCollection = this.collections[loginConfigCollectionName];
-	var service = loginConfigCollection.reactiveQuery({service: serviceName}).result[0];
-	return service.clientId;
-};
- 
-Asteroid.prototype._initOauthLogin = function (service, credentialToken, loginUrl) {
-	var popup = window.open(loginUrl, "Login");
-	var self = this;
-	return Q()
-		.then(function () {
-			var deferred = Q.defer();
-			if (popup.focus) popup.focus();
-			var intervalId = setInterval(function () {
-				if (popup.closed || popup.closed === undefined) {
-					clearInterval(intervalId);
-					deferred.resolve();
-				}
-			}, 100);
-			return deferred.promise;
-		})
-		.then(function () {
-			var deferred = Q.defer();
-			var loginParameters = {
-				oauth: {
-					credentialToken: credentialToken
-				}
-			};
-			self.ddp.method("login", [loginParameters], function (err, res) {
-				if (err) {
-					delete self.userId;
-					delete self.loggedIn;
-					delete localStorage[self._host + "__login_token__"];
-					deferred.reject(err);
-					self._emit("loginError", err);
-				} else {
-					self.userId = res.id;
-					self.loggedIn = true;
-					localStorage[self._host + "__login_token__"] = res.token;
-					self._emit("login", res.id);
-					deferred.resolve(res.id);
-				}
-			});
-			return deferred.promise;
-		});
-};
- 
-Asteroid.prototype._tryResumeLogin = function () {
-	var self = this;
-	var deferred = Q.defer();
-	var token = localStorage[self._host + "__login_token__"];
-	Eif (!token) {
-		deferred.reject("No login token");
-		return deferred.promise;
-	}
-	var loginParameters = {
-		resume: token
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("loginError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithFacebook = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("facebook"),
-		redirect_uri:	this._host + "/_oauth/facebook?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://www.facebook.com/dialog/oauth?" + formQs(query);
-	return this._initOauthLogin("facebook", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGoogle = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		response_type:	"code",
-		client_id:		this._getOauthClientId("google"),
-		redirect_uri:	this._host + "/_oauth/google?close",
-		state:			credentialToken,
-		scope:			scope || "openid email"
-	};
-	var loginUrl = "https://accounts.google.com/o/oauth2/auth?" + formQs(query);
-	return this._initOauthLogin("google", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGithub = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("github"),
-		redirect_uri:	this._host + "/_oauth/github?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://github.com/login/oauth/authorize?" + formQs(query);
-	return this._initOauthLogin("github", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithTwitter = function (scope) {
-	var credentialToken = guid();
-	var callbackUrl = this._host + "/_oauth/twitter?close&state=" + credentialToken;
-	var query = {
-		requestTokenAndRedirect:	encodeURIComponent(callbackUrl),
-		state:						credentialToken
-	};
-	var loginUrl = this._host + "/_oauth/twitter/?" + formQs(query);
-	return this._initOauthLogin("twitter", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.createUser = function (usernameOrEmail, password, profile) {
-	var self = this;
-	var deferred = Q.defer();
-	var options = {
-		username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-		email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined,
-		password: password,
-		profile: profile
-	};
-	self.ddp.method("createUser", [options], function (err, res) {
-		if (err) {
-			self._emit("createUserError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("createUser", res.id);
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithPassword = function (usernameOrEmail, password) {
-	var self = this;
-	var deferred = Q.defer();
-	var loginParameters = {
-		password: password,
-		user: {
-			username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-			email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined
-		}
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			deferred.reject(err);
-			self._emit("loginError", err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.logout = function () {
-	var self = this;
-	var deferred = Q.defer();
-	self.ddp.method("logout", [], function (err, res) {
-		if (err) {
-			self._emit("logoutError", err);
-			deferred.reject(err);
-		} else {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("logout");
-			deferred.resolve();
-		}
-	});
-	return deferred.promise;
-};
- 
-var Set = function (readonly) {
-	// Allow readonly sets
-	if (readonly) {
-		// Make the put and del methods private
-		this._put = this.put;
-		this._del = this.del;
-		// Replace them with a throwy function
-		this.put = this.del = function () {
-			throw new Error("Attempt to modify readonly set");
-		};
-	}
-	this._items = {};
-};
-// Inherit from EventEmitter
-Set.prototype = Object.create(EventEmitter.prototype);
-Set.constructor = Set;
- 
-Set.prototype.put = function (id, item) {
-	// Assert arguments type
-	must.beString(id);
-	must.beObject(item);
-	// Save a clone to avoid collateral damage
-	this._items[id] = clone(item);
-	this._emit("put", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.del = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	delete this._items[id];
-	this._emit("del", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.get = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	// Return a clone to avoid collateral damage
-	return clone(this._items[id]);
-};
- 
-Set.prototype.contains = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	return !!this._items[id];
-};
- 
-Set.prototype.filter = function (belongFn) {
- 
-	// Creates the subset
-	var sub = new Set(true);
- 
-	// Keep a reference to the _items hash
-	var items = this._items;
- 
-	// Performs the initial puts
-	var ids = Object.keys(items);
-	ids.forEach(function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._items[id] = items[id];
-		}
-	});
- 
-	// Listens to the put and del events
-	// to automatically update the subset
-	this.on("put", function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._put(id, items[id]);
-		}
-	});
-	this.on("del", function (id) {
-		sub._del(id);
-	});
- 
-	// Returns the subset
-	return sub;
-};
- 
-Set.prototype.toArray = function () {
-	var array = [];
-	var items = this._items;
-	var ids = Object.keys(this._items);
-	ids.forEach(function (id) {
-		array.push(items[id]);
-	});
-	// Return a clone to avoid collateral damage
-	return clone(array);
-};
- 
-Set.prototype.toHash = function () {
-	// Return a clone to avoid collateral damage
-	return clone(this._items);
-};
- 
-Asteroid.Set = Set;
- 
-////////////////////////
-// Subscription class //
-////////////////////////
- 
-var Subscription = function (name, params, asteroid) {
-	this._name = name;
-	this._params = params;
-	this._asteroid = asteroid;
-	// Subscription promises
-	this._ready = Q.defer();
-	this.ready = this._ready.promise;
-	// Subscribe via DDP
-	var or = this._onReady.bind(this);
-	var os = this._onStop.bind(this);
-	var oe = this._onError.bind(this);
-	this.id = asteroid.ddp.sub(name, params, or, os, oe);
-};
-Subscription.constructor = Subscription;
- 
-Subscription.prototype.stop = function () {
-	this._asteroid.ddp.unsub(this.id);
-};
- 
-Subscription.prototype._onReady = function () {
-	this._ready.resolve();
-};
- 
-Subscription.prototype._onStop = function () {
-	delete this._asteroid.subscriptions[this.id];
-};
- 
-Subscription.prototype._onError = function (err) {
-	Eif (this.ready.isPending()) {
-		this._ready.reject(err);
-	}
-	delete this._asteroid.subscriptions[this.id];
-};
- 
- 
- 
-//////////////////////
-// Subscribe method //
-//////////////////////
- 
-Asteroid.prototype.subscribe = function (name /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(name);
-	// Collect arguments into array
-	var params = Array.prototype.slice.call(arguments, 1);
-	var sub = new Subscription(name, params, this);
-	this.subscriptions[sub.id] = sub;
-	return sub;
-};
- 
-Asteroid.prototype._reEstablishSubscriptions = function () {
-	var subs = this.subscriptions;
-	for (var id in subs) {
-		subs[id] = new Subscription(subs[id]._name, subs[id]._params, this);
-	}
-};
- 
-return Asteroid;
- 
-}));
- 
- -
- - - - - - - - diff --git a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/dist/index.html b/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/dist/index.html deleted file mode 100644 index 3e2119c..0000000 --- a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/dist/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for dist/ - - - - - - - -
-

Code coverage report for dist/

-

- - Statements: 65.34% (313 / 479)      - - - Branches: 52.55% (72 / 137)      - - - Functions: 61.46% (59 / 96)      - - - Lines: 65.47% (309 / 472)      - - Ignored: none      -

-
All files » dist/
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
asteroid.js65.34%(313 / 479)52.55%(72 / 137)61.46%(59 / 96)65.47%(309 / 472)
-
-
- - - - - - - - diff --git a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/index.html b/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/index.html deleted file mode 100644 index 677914e..0000000 --- a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for All files - - - - - - - -
-

Code coverage report for All files

-

- - Statements: 65.34% (313 / 479)      - - - Branches: 52.55% (72 / 137)      - - - Functions: 61.46% (59 / 96)      - - - Lines: 65.47% (309 / 472)      - - Ignored: none      -

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
dist/65.34%(313 / 479)52.55%(72 / 137)61.46%(59 / 96)65.47%(309 / 472)
-
-
- - - - - - - - diff --git a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/prettify.css b/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/prettify.js b/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/prettify.js deleted file mode 100644 index ef51e03..0000000 --- a/test/coverage/Chrome 34.0.1847 (Mac OS X 10.9.2)/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/dist/asteroid.js.html b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/dist/asteroid.js.html deleted file mode 100644 index eb020d7..0000000 --- a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/dist/asteroid.js.html +++ /dev/null @@ -1,3505 +0,0 @@ - - - - Code coverage report for dist/asteroid.js - - - - - - - -
-

Code coverage report for dist/asteroid.js

-

- - Statements: 62.4% (317 / 508)      - - - Branches: 46.84% (74 / 158)      - - - Functions: 60.2% (59 / 98)      - - - Lines: 62.48% (313 / 501)      - - Ignored: none      -

-
All files » dist/ » asteroid.js
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466 -467 -468 -469 -470 -471 -472 -473 -474 -475 -476 -477 -478 -479 -480 -481 -482 -483 -484 -485 -486 -487 -488 -489 -490 -491 -492 -493 -494 -495 -496 -497 -498 -499 -500 -501 -502 -503 -504 -505 -506 -507 -508 -509 -510 -511 -512 -513 -514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526 -527 -528 -529 -530 -531 -532 -533 -534 -535 -536 -537 -538 -539 -540 -541 -542 -543 -544 -545 -546 -547 -548 -549 -550 -551 -552 -553 -554 -555 -556 -557 -558 -559 -560 -561 -562 -563 -564 -565 -566 -567 -568 -569 -570 -571 -572 -573 -574 -575 -576 -577 -578 -579 -580 -581 -582 -583 -584 -585 -586 -587 -588 -589 -590 -591 -592 -593 -594 -595 -596 -597 -598 -599 -600 -601 -602 -603 -604 -605 -606 -607 -608 -609 -610 -611 -612 -613 -614 -615 -616 -617 -618 -619 -620 -621 -622 -623 -624 -625 -626 -627 -628 -629 -630 -631 -632 -633 -634 -635 -636 -637 -638 -639 -640 -641 -642 -643 -644 -645 -646 -647 -648 -649 -650 -651 -652 -653 -654 -655 -656 -657 -658 -659 -660 -661 -662 -663 -664 -665 -666 -667 -668 -669 -670 -671 -672 -673 -674 -675 -676 -677 -678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -695 -696 -697 -698 -699 -700 -701 -702 -703 -704 -705 -706 -707 -708 -709 -710 -711 -712 -713 -714 -715 -716 -717 -718 -719 -720 -721 -722 -723 -724 -725 -726 -727 -728 -729 -730 -731 -732 -733 -734 -735 -736 -737 -738 -739 -740 -741 -742 -743 -744 -745 -746 -747 -748 -749 -750 -751 -752 -753 -754 -755 -756 -757 -758 -759 -760 -761 -762 -763 -764 -765 -766 -767 -768 -769 -770 -771 -772 -773 -774 -775 -776 -777 -778 -779 -780 -781 -782 -783 -784 -785 -786 -787 -788 -789 -790 -791 -792 -793 -794 -795 -796 -797 -798 -799 -800 -801 -802 -803 -804 -805 -806 -807 -808 -809 -810 -811 -812 -813 -814 -815 -816 -817 -818 -819 -820 -821 -822 -823 -824 -825 -826 -827 -828 -829 -830 -831 -832 -833 -834 -835 -836 -837 -838 -839 -840 -841 -842 -843 -844 -845 -846 -847 -848 -849 -850 -851 -852 -853 -854 -855 -856 -857 -858 -859 -860 -861 -862 -863 -864 -865 -866 -867 -868 -869 -870 -871 -872 -873 -874 -875 -876 -877 -878 -879 -880 -881 -882 -883 -884 -885 -886 -887 -888 -889 -890 -891 -892 -893 -894 -895 -896 -897 -898 -899 -900 -901 -902 -903 -904 -905 -906 -907 -908 -909 -910 -911 -912 -913 -914 -915 -916 -917 -918 -919 -920 -921 -922 -923 -924 -925 -926 -927 -928 -929 -930 -931 -932 -933 -934 -935 -936 -937 -938 -939 -940 -941 -942 -943 -944 -945 -946 -947 -948 -949 -950 -951 -952 -953 -954 -955 -956 -957 -958 -959 -960 -961 -962 -963 -964 -965 -966 -967 -968 -969 -970 -971 -972 -973 -974 -975 -976 -977 -978 -979 -980 -981 -982 -983 -984 -985 -986 -987 -988 -989 -990 -991 -992 -993 -994 -995 -996 -997 -998 -999 -1000 -1001 -1002 -1003 -1004 -1005 -1006 -1007 -1008 -1009 -1010 -1011 -1012 -1013 -1014 -1015 -1016 -1017 -1018 -1019 -1020 -1021 -1022 -1023 -1024 -1025 -1026 -1027 -1028 -1029 -1030 -1031 -1032 -1033 -1034 -1035 -1036 -1037 -1038 -1039 -1040 -1041 -1042 -1043 -1044 -1045 -1046 -1047 -1048 -1049 -1050 -1051 -1052 -1053 -1054 -1055 -1056 -1057 -1058 -1059 -1060 -1061 -10621 -1 -  -1 -  -  -1 -  -  -  -  -1 -889 -  -  -889 -889 -  -  -9 -  -  -  -  -  -880 -  -  -880 -  -  -  -  -  -1 -  -1 -  -  -  -  -52 -52 -52 -  -  -  -  -  -  -  -  -  -300 -300 -4 -4 -4 -4 -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -31 -31 -248 -  -31 -  -  -1 -  -  -  -1 -  -  -  -  -  -1 -  -1 -725 -  -  -1 -438 -438 -7 -  -  -  -1 -  -  -  -  -  -  -1 -287 -287 -1 -  -  -  -  -  -  -  -1 -  -26 -  -25 -  -  -25 -1 -  -  -  -  -  -24 -  -  -  -  -  -  -25 -25 -25 -  -25 -  -  -1 -1 -  -  -  -  -  -  -  -1 -19 -  -  -19 -  -19 -  -  -1 -  -  -  -1 -  -1 -  -19 -  -  -  -  -  -  -  -  -19 -  -  -19 -  -  -19 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -  -7 -  -6 -6 -  -  -6 -6 -6 -  -3 -  -2 -2 -  -  -1 -  -  -6 -  -1 -  -  -6 -  -6 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -360 -360 -360 -360 -360 -  -  -  -  -  -  -  -  -1 -33 -33 -33 -  -1 -  -  -  -  -  -  -  -1 -  -55 -2 -  -53 -  -53 -  -1 -  -1 -  -1 -53 -53 -  -53 -53 -33 -  -2 -2 -  -  -31 -  -  -53 -  -1 -  -55 -31 -  -55 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -8 -8 -  -2 -  -2 -  -  -8 -  -1 -  -1 -  -1 -8 -8 -  -8 -8 -3 -  -2 -  -2 -1 -1 -  -2 -  -  -1 -1 -  -  -8 -  -1 -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -10 -10 -1 -  -  -9 -2 -  -  -7 -  -7 -5 -  -7 -  -7 -  -1 -  -3 -3 -1 -1 -  -2 -  -2 -1 -1 -  -1 -  -  -1 -  -1 -7 -7 -  -7 -  -7 -  -  -  -7 -  -  -7 -3 -  -2 -2 -2 -2 -  -  -1 -1 -  -  -7 -  -1 -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -12 -12 -  -12 -12 -  -12 -  -  -  -12 -  -  -  -  -  -1 -1 -  -1 -12 -  -  -1 -  -12 -  -  -360 -  -  -  -  -  -360 -360 -450 -390 -390 -  -  -  -  -  -360 -360 -360 -310 -  -  -  -  -50 -  -  -  -  -1 -12 -12 -  -  -12 -  -12 -12 -  -  -  -  -1 -  -1 -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -1 -1 -1 -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -58 -  -15 -15 -  -15 -2 -  -  -58 -  -  -1 -1 -  -1 -  -288 -287 -  -286 -286 -  -286 -  -  -1 -  -18 -17 -17 -  -17 -  -  -1 -  -27 -  -26 -  -  -1 -  -58 -57 -  -  -1 -  -  -14 -  -  -14 -  -  -14 -14 -  -  -560 -560 -560 -150 -  -  -  -  -  -14 -  -  -2 -2 -2 -1 -  -  -14 -2 -  -  -  -14 -  -  -1 -15 -15 -15 -15 -201 -  -  -15 -  -  -1 -  -  -  -  -1 -  -  -  -  -  -1 -12 -12 -12 -  -12 -12 -  -12 -12 -12 -12 -  -1 -  -1 -2 -  -  -1 -1 -  -  -1 -2 -  -  -1 -1 -1 -  -1 -  -  -  -  -  -  -  -  -1 -  -14 -  -13 -  -13 -  -12 -12 -12 -12 -  -13 -  -  -1 -  -  -  -  -  -  -  -  -1 -  -  - 
(function (root, factory) {
-    Iif (typeof define === "function" && define.amd) {
-        define(factory);
-    } else Iif (typeof exports === "object") {
-        module.exports = factory();
-    } else {
-        root.Asteroid = factory();
-    }
-}(this, function () {
-"use strict";
- 
-function clone (obj) {
-	Iif (typeof EJSON !== "undefined") {
-		return EJSON.clone(obj);
-	}
-	var type = typeof obj;
-	switch (type) {
-		case "undefined":
-		case "function":
-			return undefined;
-		case "string":
-		case "number":
-		case "boolean":
-			return obj;
-		case "object":
-			Iif (obj === null) {
-				return null;
-			}
-			return JSON.parse(JSON.stringify(obj));
-		default:
-			return;
-	}
-}
- 
-var EventEmitter = function () {};
- 
-EventEmitter.prototype = {
- 
-	constructor: EventEmitter,
- 
-	on: function (name, handler) {
-		if (!this._events) this._events = {};
-		this._events[name] = this._events[name] || [];
-		this._events[name].push(handler);
-	},
- 
-	off: function (name, handler) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		this._events[name].splice(this._events[name].indexOf(handler), 1);
-	},
- 
-	_emit: function (name /* , arguments */) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		var args = arguments;
-		var self = this;
-		this._events[name].forEach(function (handler) {
-			handler.apply(self, Array.prototype.slice.call(args, 1));
-		});
-	}
- 
-};
- 
-function formQs (obj) {
-	var qs = "";
-	for (var key in obj) {
-		qs += key + "=" + obj[key] + "&";
-	}
-	qs = qs.slice(0, -1);
-	return qs;
-}
- 
-function guid () {
-	var ret = "";
-	for (var i=0; i<8; i++) {
-		ret += Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
-	}
-	return ret;
-}
- 
-function isEmail (string) {
-	return string.indexOf("@") !== -1;
-}
- 
-function isEqual (obj1, obj2) {
-	var str1 = JSON.stringify(obj1);
-	var str2 = JSON.stringify(obj2);
-	return str1 === str2;
-}
- 
-var must = {};
- 
-must._toString = function (thing) {
-	return Object.prototype.toString.call(thing).slice(8, -1);
-};
- 
-must.beString = function (s) {
-	var type = this._toString(s);
-	if (type !== "String") {
-		throw new Error("Assertion failed: expected String, instead got " + type);
-	}
-};
- 
-must.beArray = function (o) {
-	var type = this._toString(o);
-	if (type !== "Array") {
-		throw new Error("Assertion failed: expected Array, instead got " + type);
-	}
-};
- 
-must.beObject = function (o) {
-	var type = this._toString(o);
-	if (type !== "Object") {
-		throw new Error("Assertion failed: expected Object, instead got " + type);
-	}
-};
- 
-//////////////////////////
-// Asteroid constructor //
-//////////////////////////
- 
-var Asteroid = function (host, ssl, socketInterceptFunction) {
-	// Assert arguments type
-	must.beString(host);
-	// Configure the instance
-	this._host = (ssl ? "https://" : "http://") + host;
-	// If SockJS is available, use it, otherwise, use WebSocket
-	// Note: SockJS is required for IE9 support
-	if (typeof SockJS === "function") {
-		this._ddpOptions = {
-			endpoint: (ssl ? "https://" : "http://") + host + "/sockjs",
-			SocketConstructor: SockJS,
-			socketInterceptFunction: socketInterceptFunction
-		};
-	} else {
-		this._ddpOptions = {
-			endpoint: (ssl ? "wss://" : "ws://") + host + "/websocket",
-			SocketConstructor: WebSocket,
-			socketInterceptFunction: socketInterceptFunction
-		};
-	}
-	// Reference containers
-	this.collections = {};
-	this.subscriptions = {};
-	this._subscriptionsCache = {};
-	// Init the instance
-	this._init();
-};
-// Asteroid instances are EventEmitter-s
-Asteroid.prototype = Object.create(EventEmitter.prototype);
-Asteroid.prototype.constructor = Asteroid;
- 
- 
- 
-////////////////////////////////
-// Establishes the connection //
-////////////////////////////////
- 
-Asteroid.prototype._init = function () {
-	var self = this;
-	// Creates the DDP instance, that will automatically
-	// connect to the DDP server.
-	self.ddp = new DDP(this._ddpOptions);
-	// Register handlers
-	self.ddp.on("connected", function () {
-		// Upon connection try resuming login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Subscribe to the meteor.loginServiceConfiguration
-		// collection, which holds the configuration options
-		// to login via third party services (oauth).
-		self.subscribe("meteor.loginServiceConfiguration");
-		// Emit the connected event
-		self._emit("connected");
-	});
-	self.ddp.on("reconnected", function () {
-		// Upon reconnection try resuming login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Re-establish all previously established (and still active) subscriptions
-		self._reEstablishSubscriptions();
-		// Emit the reconnected event
-		self._emit("reconnected");
-	});
-	self.ddp.on("added", function (data) {
-		self._onAdded(data);
-	});
-	self.ddp.on("changed", function (data) {
-		self._onChanged(data);
-	});
-	self.ddp.on("removed", function (data) {
-		self._onRemoved(data);
-	});
-};
- 
- 
- 
-///////////////////////////////////////
-// Handler for the ddp "added" event //
-///////////////////////////////////////
- 
-Asteroid.prototype._onAdded = function (data) {
-	// Get the name of the collection
-	var cName = data.collection;
-	// If the collection does not exist yet, create it
-	if (!this.collections[cName]) {
-		this.collections[cName] = new Asteroid._Collection(cName, this);
-	}
-	// data.fields can be undefined if the item added has only
-	// the _id field . To avoid errors down the line, ensure item
-	// is an object.
-	var item = data.fields || {};
-	item._id = data.id;
-	// Perform the remote insert
-	this.collections[cName]._remoteToLocalInsert(item);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "removed" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onRemoved = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// Perform the reomte remove
-	this.collections[data.collection]._remoteToLocalRemove(data.id);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "changes" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onChanged = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// data.fields can be undefined if the update only
-	// removed some properties in the item. Make sure
-	// it's an object
-	if (!data.fields) {
-		data.fields = {};
-	}
-	// If there were cleared fields, explicitly set them
-	// to undefined in the data.fields object. This will
-	// cause those fields to be present in the for ... in
-	// loop the remote update method of the collection
-	// performs, causing then the fields to be actually
-	// cleared from the item
-	if (data.cleared) {
-		data.cleared.forEach(function (key) {
-			data.fields[key] = undefined;
-		});
-	}
-	// Perform the remote update
-	this.collections[data.collection]._remoteToLocalUpdate(data.id, data.fields);
-};
- 
- 
- 
- 
- 
- 
- 
-////////////////////////////
-// Call and apply methods //
-////////////////////////////
- 
-Asteroid.prototype.call = function (method /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(method);
-	// Get the parameters for apply
-	var params = Array.prototype.slice.call(arguments, 1);
-	// Call apply
-	return this.apply(method, params);
-};
- 
-Asteroid.prototype.apply = function (method, params) {
-	// Assert arguments type
-	must.beString(method);
-	// If no parameters are given, use an empty array
-	Eif (!Array.isArray(params)) {
-		params = [];
-	}
-	// Create the result and updated promises
-	var resultDeferred = Q.defer();
-	var updatedDeferred = Q.defer();
-	var onResult = function (err, res) {
-		// The onResult handler takes care of errors
-		if (err) {
-			// If errors ccur, reject both promises
-			resultDeferred.reject(err);
-			updatedDeferred.reject();
-		} else {
-			// Otherwise resolve the result one
-			resultDeferred.resolve(res);
-		}
-	};
-	var onUpdated = function () {
-		// Just resolve the updated promise
-		updatedDeferred.resolve();
-	};
-	// Perform the method call
-	this.ddp.method(method, params, onResult, onUpdated);
-	// Return an object containing both promises
-	return {
-		result: resultDeferred.promise,
-		updated: updatedDeferred.promise
-	};
-};
- 
- 
- 
-/////////////////////
-// Syntactic sugar //
-/////////////////////
- 
-Asteroid.prototype.getCollection = function (name) {
-	// Assert arguments type
-	must.beString(name);
-	// Only create the collection if it doesn't exist
-	if (!this.collections[name]) {
-		this.collections[name] = new Asteroid._Collection(name, this);
-	}
-	return this.collections[name];
-};
- 
-///////////////////////////////////////////
-// Removal and update suffix for backups //
-///////////////////////////////////////////
- 
-var mf_removal_suffix = "__del__";
-var mf_update_suffix = "__upd__";
-var is_backup = function (id) {
-	var l1 = mf_removal_suffix.length;
-	var l2 = mf_update_suffix.length;
-	var s1 = id.slice(-1 * l1);
-	var s2 = id.slice(-1 * l2);
-	return s1 === mf_removal_suffix || s2 === mf_update_suffix;
-};
- 
- 
- 
-/////////////////////////////////////////////
-// Collection class constructor definition //
-/////////////////////////////////////////////
- 
-var Collection = function (name, asteroidRef) {
-	this.name = name;
-	this.asteroid = asteroidRef;
-	this._set = new Set();
-};
-Collection.prototype.constructor = Collection;
- 
- 
- 
-///////////////////////////////////////////////
-// Insert-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalInsert = function (item) {
-	// If an item by that id already exists, raise an exception
-	if (this._set.contains(item._id)) {
-		throw new Error("Item " + item._id + " already exists");
-	}
-	this._set.put(item._id, item);
-	// Return a promise, just for api consistency
-	return Q(item._id);
-};
-Collection.prototype._remoteToLocalInsert = function (item) {
-	// The server is the SSOT, add directly
-	this._set.put(item._id, item);
-};
-Collection.prototype._localToRemoteInsert = function (item) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/insert";
-	self.asteroid.ddp.method(methodName, [item], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			self._set.del(item._id);
-			deferred.reject(err);
-		} else {
-			// Else resolve the promise
-			deferred.resolve(item._id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.insert = function (item) {
-	// If the time has no id, generate one for it
-	if (!item._id) {
-		item._id = guid();
-	}
-	return {
-		// Perform the local insert
-		local: this._localToLocalInsert(item),
-		// Send the insert request
-		remote: this._localToRemoteInsert(item)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Remove-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalRemove = function (id) {
-	// Check if the item exists in the database
-	var existing = this._set.get(id);
-	if (existing) {
-		// Create a backup of the object to delete
-		this._set.put(id + mf_removal_suffix, existing);
-		// Delete the object
-		this._set.del(id);
-	}
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalRemove = function (id) {
-	// The server is the SSOT, remove directly (item and backup)
-	this._set.del(id);
-};
-Collection.prototype._localToRemoteRemove = function (id) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/remove";
-	self.asteroid.ddp.method(methodName, [{_id: id}], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_removal_suffix);
-			// Ensure there is a backup
-			if (backup) {
-				self._set.put(id, backup);
-				self._set.del(id + mf_removal_suffix);
-			}
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_removal_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.remove = function (id) {
-	return {
-		// Perform the local remove
-		local: this._localToLocalRemove(id),
-		// Send the remove request
-		remote: this._localToRemoteRemove(id)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Update-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalUpdate = function (id, fields) {
-	// Ensure the item actually exists
-	var existing = this._set.get(id);
-	if (!existing) {
-		throw new Error("Item " + id + " doesn't exist");
-	}
-	// Ensure the _id property won't get modified
-	if (fields._id && fields._id !== id) {
-		throw new Error("Modifying the _id of a document is not allowed");
-	}
-	// Create a backup
-	this._set.put(id + mf_update_suffix, existing);
-	// Perform the update
-	for (var field in fields) {
-		existing[field] = fields[field];
-	}
-	this._set.put(id, existing);
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalUpdate = function (id, fields) {
-	// Ensure the item exixts in the database
-	var existing = this._set.get(id);
-	if (!existing) {
-		console.warn("Server misbehaviour: item " + id + " doesn't exist");
-		return;
-	}
-	for (var field in fields) {
-		// Ensure the server is not trying to moify the item _id
-		if (field === "_id" && fields._id !== id) {
-			console.warn("Server misbehaviour: modifying the _id of a document is not allowed");
-			return;
-		}
-		existing[field] = fields[field];
-	}
-	// Perform the update
-	this._set.put(id, existing);
-};
-Collection.prototype._localToRemoteUpdate = function (id, fields) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/update";
-	// Construct the selector
-	var sel = {
-		_id: id
-	};
-	// Construct the modifier
-	var mod = {
-		$set: fields
-	};
-	self.asteroid.ddp.method(methodName, [sel, mod], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_update_suffix);
-			self._set.put(id, backup);
-			self._set.del(id + mf_update_suffix);
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_update_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.update = function (id, fields) {
-	return {
-		// Perform the local update
-		local: this._localToLocalUpdate(id, fields),
-		// Send the update request
-		remote: this._localToRemoteUpdate(id, fields)
-	};
-};
- 
- 
- 
-//////////////////////////////
-// Reactive queries methods //
-//////////////////////////////
- 
-var ReactiveQuery = function (set) {
-	var self = this;
-	self.result = [];
- 
-	self._set = set;
-	self._getResult();
- 
-	self._set.on("put", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
-	self._set.on("del", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
- 
-};
-ReactiveQuery.prototype = Object.create(EventEmitter.prototype);
-ReactiveQuery.constructor = ReactiveQuery;
- 
-ReactiveQuery.prototype._getResult = function () {
-	this.result = this._set.toArray();
-};
- 
-var getFilterFromSelector = function (selector) {
-	// Return the filter function
-	return function (id, item) {
- 
-		// Filter out backups
-		Iif (is_backup(id)) {
-			return false;
-		}
- 
-		// Get the value of the object from a compund key
-		// (e.g. "profile.name.first")
-		var getItemVal = function (item, key) {
-			return key.split(".").reduce(function (prev, curr) {
-				if (!prev) return prev;
-				prev = prev[curr];
-				return prev;
-			}, item);
-		};
- 
-		// Iterate all the keys in the selector. The first that
-		// doesn't match causes the item to be filtered out.
-		for (var key in selector) {
-			var itemVal = getItemVal(item, key);
-			if (itemVal !== selector[key]) {
-				return false;
-			}
-		}
- 
-		// At this point the item matches the selector
-		return true;
- 
-	};
-};
- 
-Collection.prototype.reactiveQuery = function (selectorOrFilter) {
-	var filter;
-	Iif (typeof selectorOrFilter === "function") {
-		filter = selectorOrFilter;
-	} else {
-		filter = getFilterFromSelector(selectorOrFilter);
-	}
-	var subset = this._set.filter(filter);
-	return new ReactiveQuery(subset);
-};
- 
- 
- 
-Asteroid._Collection = Collection;
- 
-Asteroid.prototype._getOauthClientId = function (serviceName) {
-	var loginConfigCollectionName = "meteor_accounts_loginServiceConfiguration";
-	var loginConfigCollection = this.collections[loginConfigCollectionName];
-	var service = loginConfigCollection.reactiveQuery({service: serviceName}).result[0];
-	return service.clientId || service.consumerKey || service.appId;
-};
- 
-Asteroid.prototype._initOauthLogin = function (service, credentialToken, loginUrl) {
-	// Open the oauth oauth
-	var popup = window.open(loginUrl, "_blank", "location=no,toolbar=no");	
-	if (popup.focus) popup.focus();
-	var self = this;
-	return Q()
-		.then(function () {
-			var deferred = Q.defer();
-			if (window.cordova) {
-				// We're using Cordova's InAppBrowser plugin.
-				// Each time the popup fires the loadstop event,
-				// check if the hash fragment contains the
-				// credentialSecret we need to complete the
-				// authentication flow
-				popup.addEventListener("loadstop", function (e) { 
-					// If the url does not contain the # character
-					// it means the loadstop event refers to an
-					// intermediate page, therefore we ignore it
-					if (e.url.indexOf("#") === -1) {
-						return;
-					}
-					// Find the position of the # character
-					var hashPosition = e.url.indexOf("#");
-					var hashes = e.url.slice(hashPosition).split("&");
-					// Once again, check that the fragment belongs to the
-					// final oauth page (the one we're looking for)
-					if (
-						!hashes[0] ||
-						hashes[0].split("=")[0] !== "credentialToken" ||
-						!hashes[1] ||
-						hashes[1].split("=")[0] !== "credentialSecret"
-					) {
-						return;
-					}
-					// Retrieve the two tokens
-					var hashCredentialToken = hashes[0].split("=")[1];
-					var hashCredentialSecret = hashes[1].split("=")[1];
-					// Check if the credentialToken corresponds. We could
-					// use this as a way to communicate possible errors by
-					// purposefully mismatching the credentialToken with
-					// the error message. Too much of a hack?
-					if (hashCredentialToken === credentialToken) {
-						// Resolve the promise with the secret
-						deferred.resolve(hashCredentialSecret);
-						// Close the popup
-						popup.close();
-					}
-				});
-			} else {
-				var request = JSON.stringify({
-					credentialToken: credentialToken
-				});
-				var intervalId = setInterval(function () {
-					popup.postMessage(request, self._host);
-				}, 100);
-				window.addEventListener("message", function (e) {
-					var message;
-					try {
-						message = JSON.parse(e.data);
-					} catch (err) {
-						return;
-					}
-					if (e.origin === self._host) {
-						if (message.credentialToken === credentialToken) {
-							clearInterval(intervalId);
-							deferred.resolve(message.credentialSecret);
-						}
-						if (message.error) {
-							clearInterval(intervalId);
-							deferred.reject(message.error);
-						}
-					}
-				});
-			}
-			return deferred.promise;
-		})
-		.then(function (credentialSecret) {
-			var deferred = Q.defer();
-			var loginParameters = {
-				oauth: {
-					credentialToken: credentialToken,
-					credentialSecret: credentialSecret
-				}
-			};
-			self.ddp.method("login", [loginParameters], function (err, res) {
-				if (err) {
-					delete self.userId;
-					delete self.loggedIn;
-					delete localStorage[self._host + "__login_token__"];
-					deferred.reject(err);
-					self._emit("loginError", err);
-				} else {
-					self.userId = res.id;
-					self.loggedIn = true;
-					localStorage[self._host + "__login_token__"] = res.token;
-					self._emit("login", res.id);
-					deferred.resolve(res.id);
-				}
-			});
-			return deferred.promise;
-		});
-};
- 
-Asteroid.prototype._tryResumeLogin = function () {
-	var self = this;
-	var deferred = Q.defer();
-	var token = localStorage[self._host + "__login_token__"];
-	Eif (!token) {
-		deferred.reject("No login token");
-		return deferred.promise;
-	}
-	var loginParameters = {
-		resume: token
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("loginError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithFacebook = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("facebook"),
-		redirect_uri:	this._host + "/_oauth/facebook?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://www.facebook.com/dialog/oauth?" + formQs(query);
-	return this._initOauthLogin("facebook", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGoogle = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		response_type:	"code",
-		client_id:		this._getOauthClientId("google"),
-		redirect_uri:	this._host + "/_oauth/google?close",
-		state:			credentialToken,
-		scope:			scope || "openid email"
-	};
-	var loginUrl = "https://accounts.google.com/o/oauth2/auth?" + formQs(query);
-	return this._initOauthLogin("google", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGithub = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("github"),
-		redirect_uri:	this._host + "/_oauth/github?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://github.com/login/oauth/authorize?" + formQs(query);
-	return this._initOauthLogin("github", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithTwitter = function (scope) {
-	var credentialToken = guid();
-	var callbackUrl = this._host + "/_oauth/twitter?close&state=" + credentialToken;
-	var query = {
-		requestTokenAndRedirect:	encodeURIComponent(callbackUrl),
-		state:						credentialToken
-	};
-	var loginUrl = this._host + "/_oauth/twitter/?" + formQs(query);
-	return this._initOauthLogin("twitter", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.createUser = function (usernameOrEmail, password, profile) {
-	var self = this;
-	var deferred = Q.defer();
-	var options = {
-		username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-		email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined,
-		password: password,
-		profile: profile
-	};
-	self.ddp.method("createUser", [options], function (err, res) {
-		if (err) {
-			self._emit("createUserError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("createUser", res.id);
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithPassword = function (usernameOrEmail, password) {
-	var self = this;
-	var deferred = Q.defer();
-	var loginParameters = {
-		password: password,
-		user: {
-			username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-			email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined
-		}
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			deferred.reject(err);
-			self._emit("loginError", err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.logout = function () {
-	var self = this;
-	var deferred = Q.defer();
-	self.ddp.method("logout", [], function (err, res) {
-		if (err) {
-			self._emit("logoutError", err);
-			deferred.reject(err);
-		} else {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("logout");
-			deferred.resolve();
-		}
-	});
-	return deferred.promise;
-};
- 
-var Set = function (readonly) {
-	// Allow readonly sets
-	if (readonly) {
-		// Make the put and del methods private
-		this._put = this.put;
-		this._del = this.del;
-		// Replace them with a throwy function
-		this.put = this.del = function () {
-			throw new Error("Attempt to modify readonly set");
-		};
-	}
-	this._items = {};
-};
-// Inherit from EventEmitter
-Set.prototype = Object.create(EventEmitter.prototype);
-Set.constructor = Set;
- 
-Set.prototype.put = function (id, item) {
-	// Assert arguments type
-	must.beString(id);
-	must.beObject(item);
-	// Save a clone to avoid collateral damage
-	this._items[id] = clone(item);
-	this._emit("put", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.del = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	delete this._items[id];
-	this._emit("del", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.get = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	// Return a clone to avoid collateral damage
-	return clone(this._items[id]);
-};
- 
-Set.prototype.contains = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	return !!this._items[id];
-};
- 
-Set.prototype.filter = function (belongFn) {
- 
-	// Creates the subset
-	var sub = new Set(true);
- 
-	// Keep a reference to the _items hash
-	var items = this._items;
- 
-	// Performs the initial puts
-	var ids = Object.keys(items);
-	ids.forEach(function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._items[id] = items[id];
-		}
-	});
- 
-	// Listens to the put and del events
-	// to automatically update the subset
-	this.on("put", function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._put(id, items[id]);
-		}
-	});
-	this.on("del", function (id) {
-		sub._del(id);
-	});
- 
-	// Returns the subset
-	return sub;
-};
- 
-Set.prototype.toArray = function () {
-	var array = [];
-	var items = this._items;
-	var ids = Object.keys(this._items);
-	ids.forEach(function (id) {
-		array.push(items[id]);
-	});
-	// Return a clone to avoid collateral damage
-	return clone(array);
-};
- 
-Set.prototype.toHash = function () {
-	// Return a clone to avoid collateral damage
-	return clone(this._items);
-};
- 
-Asteroid.Set = Set;
- 
-////////////////////////
-// Subscription class //
-////////////////////////
- 
-var Subscription = function (name, params, asteroid) {
-	this._name = name;
-	this._params = params;
-	this._asteroid = asteroid;
-	// Subscription promises
-	this._ready = Q.defer();
-	this.ready = this._ready.promise;
-	// Subscribe via DDP
-	var or = this._onReady.bind(this);
-	var os = this._onStop.bind(this);
-	var oe = this._onError.bind(this);
-	this.id = asteroid.ddp.sub(name, params, or, os, oe);
-};
-Subscription.constructor = Subscription;
- 
-Subscription.prototype.stop = function () {
-	this._asteroid.ddp.unsub(this.id);
-};
- 
-Subscription.prototype._onReady = function () {
-	this._ready.resolve(this.id);
-};
- 
-Subscription.prototype._onStop = function () {
-	delete this._asteroid.subscriptions[this.id];
-};
- 
-Subscription.prototype._onError = function (err) {
-	Eif (this.ready.isPending()) {
-		this._ready.reject(err);
-	}
-	delete this._asteroid.subscriptions[this.id];
-};
- 
- 
- 
-//////////////////////
-// Subscribe method //
-//////////////////////
- 
-Asteroid.prototype.subscribe = function (name /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(name);
-	// Hash the arguments to get a key for _subscriptionsCache
-	var hash = JSON.stringify(arguments);
-	// Only subscribe if there is no cached subscription
-	if (!this._subscriptionsCache[hash]) {
-		// Collect arguments into array
-		var params = Array.prototype.slice.call(arguments, 1);
-		var sub = new Subscription(name, params, this);
-		this._subscriptionsCache[hash] = sub;
-		this.subscriptions[sub.id] = sub;
-	}
-	return this._subscriptionsCache[hash];
-};
- 
-Asteroid.prototype._reEstablishSubscriptions = function () {
-	var subs = this.subscriptions;
-	for (var id in subs) {
-		if (subs.hasOwnProperty(id)) {
-			subs[id] = new Subscription(subs[id]._name, subs[id]._params, this);
-		}
-	}
-};
- 
-return Asteroid;
- 
-}));
- 
- -
- - - - - - - - diff --git a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/dist/index.html b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/dist/index.html deleted file mode 100644 index a87ba42..0000000 --- a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/dist/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for dist/ - - - - - - - -
-

Code coverage report for dist/

-

- - Statements: 62.4% (317 / 508)      - - - Branches: 46.84% (74 / 158)      - - - Functions: 60.2% (59 / 98)      - - - Lines: 62.48% (313 / 501)      - - Ignored: none      -

-
All files » dist/
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
asteroid.js62.4%(317 / 508)46.84%(74 / 158)60.2%(59 / 98)62.48%(313 / 501)
-
-
- - - - - - - - diff --git a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/index.html b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/index.html deleted file mode 100644 index 4605337..0000000 --- a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for All files - - - - - - - -
-

Code coverage report for All files

-

- - Statements: 62.4% (317 / 508)      - - - Branches: 46.84% (74 / 158)      - - - Functions: 60.2% (59 / 98)      - - - Lines: 62.48% (313 / 501)      - - Ignored: none      -

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
dist/62.4%(317 / 508)46.84%(74 / 158)60.2%(59 / 98)62.48%(313 / 501)
-
-
- - - - - - - - diff --git a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/prettify.css b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/prettify.js b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/prettify.js deleted file mode 100644 index ef51e03..0000000 --- a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.3)/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/dist/asteroid.js.html b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/dist/asteroid.js.html index 0a475d9..fbe57d9 100644 --- a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/dist/asteroid.js.html +++ b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/dist/asteroid.js.html @@ -1290,11 +1290,11 @@

    1 -1214 +1071     -1214 -1214 +1071 +1071     9 @@ -1303,10 +1303,10 @@

      -1205 +1062     -1205 +1062       @@ -1331,8 +1331,8 @@

      -325 -325 +314 +314 4 4 4 @@ -1352,11 +1352,11 @@

    1 -56 -56 -448 +45 +45 +360   -56 +45     1 @@ -1372,12 +1372,12 @@

1   1 -800 +767     1 -488 -488 +466 +466 7     @@ -1390,8 +1390,8 @@

    1 -312 -312 +301 +301 1     @@ -1619,11 +1619,11 @@

1 1 1 -660 -660 -660 -660 -660 +528 +528 +528 +528 +528       @@ -1647,40 +1647,40 @@

  1   -80 +69 2   -78 +67   -78 +67   1   1   1 -78 -78 +67 +67   -78 -78 -58 +67 +67 +47   2 2     -56 +45     -78 +67   1   -80 -56 +69 +45   -80 +69       @@ -1858,31 +1858,31 @@

12     -660 +528           +528 +528 660 -660 -825 -720 -720 +570 +570           -660 -660 -660 -572 +528 +528 +528 +461         -88 +67       @@ -2180,13 +2180,13 @@

  1   -313 -312 +302 +301   -311 -311 +300 +300   -311 +300     1 @@ -2207,8 +2207,8 @@

  1   -83 -82 +72 +71     1 @@ -2224,10 +2224,10 @@

14     -860 -860 -860 -188 +728 +728 +728 +167       @@ -2255,7 +2255,7 @@

15 15 15 -239 +218     15 @@ -3407,7 +3407,7 @@

diff --git a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/dist/index.html b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/dist/index.html index 8400f0b..dcdff1a 100644 --- a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/dist/index.html +++ b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/dist/index.html @@ -249,7 +249,7 @@

diff --git a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/index.html b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/index.html index 79d64c2..57a8fd3 100644 --- a/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/index.html +++ b/test/coverage/Chrome 35.0.1916 (Mac OS X 10.9.4)/index.html @@ -249,7 +249,7 @@

diff --git a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/dist/asteroid.js.html b/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/dist/asteroid.js.html deleted file mode 100644 index fbaa8cb..0000000 --- a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/dist/asteroid.js.html +++ /dev/null @@ -1,3349 +0,0 @@ - - - - Code coverage report for dist/asteroid.js - - - - - - - -
-

Code coverage report for dist/asteroid.js

-

- - Statements: 64.27% (313 / 487)      - - - Branches: 49.66% (72 / 145)      - - - Functions: 59.6% (59 / 99)      - - - Lines: 64.38% (309 / 480)      - - Ignored: none      -

-
All files » dist/ » asteroid.js
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466 -467 -468 -469 -470 -471 -472 -473 -474 -475 -476 -477 -478 -479 -480 -481 -482 -483 -484 -485 -486 -487 -488 -489 -490 -491 -492 -493 -494 -495 -496 -497 -498 -499 -500 -501 -502 -503 -504 -505 -506 -507 -508 -509 -510 -511 -512 -513 -514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526 -527 -528 -529 -530 -531 -532 -533 -534 -535 -536 -537 -538 -539 -540 -541 -542 -543 -544 -545 -546 -547 -548 -549 -550 -551 -552 -553 -554 -555 -556 -557 -558 -559 -560 -561 -562 -563 -564 -565 -566 -567 -568 -569 -570 -571 -572 -573 -574 -575 -576 -577 -578 -579 -580 -581 -582 -583 -584 -585 -586 -587 -588 -589 -590 -591 -592 -593 -594 -595 -596 -597 -598 -599 -600 -601 -602 -603 -604 -605 -606 -607 -608 -609 -610 -611 -612 -613 -614 -615 -616 -617 -618 -619 -620 -621 -622 -623 -624 -625 -626 -627 -628 -629 -630 -631 -632 -633 -634 -635 -636 -637 -638 -639 -640 -641 -642 -643 -644 -645 -646 -647 -648 -649 -650 -651 -652 -653 -654 -655 -656 -657 -658 -659 -660 -661 -662 -663 -664 -665 -666 -667 -668 -669 -670 -671 -672 -673 -674 -675 -676 -677 -678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -695 -696 -697 -698 -699 -700 -701 -702 -703 -704 -705 -706 -707 -708 -709 -710 -711 -712 -713 -714 -715 -716 -717 -718 -719 -720 -721 -722 -723 -724 -725 -726 -727 -728 -729 -730 -731 -732 -733 -734 -735 -736 -737 -738 -739 -740 -741 -742 -743 -744 -745 -746 -747 -748 -749 -750 -751 -752 -753 -754 -755 -756 -757 -758 -759 -760 -761 -762 -763 -764 -765 -766 -767 -768 -769 -770 -771 -772 -773 -774 -775 -776 -777 -778 -779 -780 -781 -782 -783 -784 -785 -786 -787 -788 -789 -790 -791 -792 -793 -794 -795 -796 -797 -798 -799 -800 -801 -802 -803 -804 -805 -806 -807 -808 -809 -810 -811 -812 -813 -814 -815 -816 -817 -818 -819 -820 -821 -822 -823 -824 -825 -826 -827 -828 -829 -830 -831 -832 -833 -834 -835 -836 -837 -838 -839 -840 -841 -842 -843 -844 -845 -846 -847 -848 -849 -850 -851 -852 -853 -854 -855 -856 -857 -858 -859 -860 -861 -862 -863 -864 -865 -866 -867 -868 -869 -870 -871 -872 -873 -874 -875 -876 -877 -878 -879 -880 -881 -882 -883 -884 -885 -886 -887 -888 -889 -890 -891 -892 -893 -894 -895 -896 -897 -898 -899 -900 -901 -902 -903 -904 -905 -906 -907 -908 -909 -910 -911 -912 -913 -914 -915 -916 -917 -918 -919 -920 -921 -922 -923 -924 -925 -926 -927 -928 -929 -930 -931 -932 -933 -934 -935 -936 -937 -938 -939 -940 -941 -942 -943 -944 -945 -946 -947 -948 -949 -950 -951 -952 -953 -954 -955 -956 -957 -958 -959 -960 -961 -962 -963 -964 -965 -966 -967 -968 -969 -970 -971 -972 -973 -974 -975 -976 -977 -978 -979 -980 -981 -982 -983 -984 -985 -986 -987 -988 -989 -990 -991 -992 -993 -994 -995 -996 -997 -998 -999 -1000 -1001 -1002 -1003 -1004 -1005 -1006 -1007 -1008 -1009 -10101 -1 -  -1 -  -  -1 -  -  -  -  -1 -980 -  -  -980 -980 -  -  -9 -  -  -  -  -  -971 -  -  -971 -  -  -  -  -  -1 -  -1 -  -  -  -  -52 -52 -52 -  -  -  -  -  -  -  -  -  -307 -307 -4 -4 -4 -4 -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -38 -38 -304 -  -38 -  -  -1 -  -  -  -1 -  -  -  -  -  -1 -  -1 -739 -  -  -1 -445 -445 -7 -  -  -  -1 -  -  -  -  -  -  -1 -294 -294 -1 -  -  -  -  -  -  -  -1 -  -24 -  -23 -  -  -23 -1 -  -  -  -  -  -22 -  -  -  -  -  -  -23 -23 -  -23 -  -  -1 -1 -  -  -  -  -  -  -  -1 -17 -  -  -17 -  -17 -  -  -1 -  -  -  -1 -  -1 -  -17 -  -  -  -  -  -  -  -  -17 -  -  -17 -  -  -17 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -  -7 -  -6 -6 -  -  -6 -6 -6 -  -3 -  -2 -2 -  -  -1 -  -  -6 -  -1 -  -  -6 -  -6 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -444 -444 -444 -444 -444 -  -  -  -  -  -  -  -  -1 -33 -33 -33 -  -1 -  -  -  -  -  -  -  -1 -  -62 -2 -  -60 -  -60 -  -1 -  -1 -  -1 -60 -60 -  -60 -60 -40 -  -2 -2 -  -  -38 -  -  -60 -  -1 -  -62 -38 -  -62 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -8 -8 -  -2 -  -2 -  -  -8 -  -1 -  -1 -  -1 -8 -8 -  -8 -8 -3 -  -2 -  -2 -1 -1 -  -2 -  -  -1 -1 -  -  -8 -  -1 -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -10 -10 -1 -  -  -9 -2 -  -  -7 -  -7 -5 -  -7 -  -7 -  -1 -  -3 -3 -1 -1 -  -2 -  -2 -1 -1 -  -1 -  -  -1 -  -1 -7 -7 -  -7 -  -7 -  -  -  -7 -  -  -7 -3 -  -2 -2 -2 -2 -  -  -1 -1 -  -  -7 -  -1 -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -12 -12 -  -12 -12 -  -12 -  -  -  -12 -  -  -  -  -  -1 -1 -  -1 -12 -  -  -1 -  -12 -  -  -444 -  -  -  -  -  -444 -444 -555 -471 -471 -  -  -  -  -  -444 -444 -444 -377 -  -  -  -  -67 -  -  -  -  -1 -12 -12 -  -  -12 -  -12 -12 -  -  -  -  -1 -  -1 -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -1 -1 -1 -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -58 -  -15 -15 -  -15 -2 -  -  -58 -  -  -1 -1 -  -1 -  -295 -294 -  -293 -293 -  -293 -  -  -1 -  -18 -17 -17 -  -17 -  -  -1 -  -27 -  -26 -  -  -1 -  -65 -64 -  -  -1 -  -  -14 -  -  -14 -  -  -14 -14 -  -  -644 -644 -644 -167 -  -  -  -  -  -14 -  -  -2 -2 -2 -1 -  -  -14 -2 -  -  -  -14 -  -  -1 -15 -15 -15 -15 -218 -  -  -15 -  -  -1 -  -  -  -  -1 -  -  -  -  -  -1 -8 -8 -8 -  -8 -8 -  -8 -8 -8 -8 -  -1 -  -1 -2 -  -  -1 -1 -  -  -1 -2 -  -  -1 -1 -1 -  -1 -  -  -  -  -  -  -  -  -1 -  -9 -  -8 -8 -8 -8 -  -  -1 -  -  -  -  -  -  -1 -  -  - 
(function (root, factory) {
-    Iif (typeof define === "function" && define.amd) {
-        define(factory);
-    } else Iif (typeof exports === "object") {
-        module.exports = factory();
-    } else {
-        root.Asteroid = factory();
-    }
-}(this, function () {
-"use strict";
- 
-function clone (obj) {
-	Iif (typeof EJSON !== "undefined") {
-		return EJSON.clone(obj);
-	}
-	var type = typeof obj;
-	switch (type) {
-		case "undefined":
-		case "function":
-			return undefined;
-		case "string":
-		case "number":
-		case "boolean":
-			return obj;
-		case "object":
-			Iif (obj === null) {
-				return null;
-			}
-			return JSON.parse(JSON.stringify(obj));
-		default:
-			return;
-	}
-}
- 
-var EventEmitter = function () {};
- 
-EventEmitter.prototype = {
- 
-	constructor: EventEmitter,
- 
-	on: function (name, handler) {
-		if (!this._events) this._events = {};
-		this._events[name] = this._events[name] || [];
-		this._events[name].push(handler);
-	},
- 
-	off: function (name, handler) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		this._events[name].splice(this._events[name].indexOf(handler), 1);
-	},
- 
-	_emit: function (name /* , arguments */) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		var args = arguments;
-		var self = this;
-		this._events[name].forEach(function (handler) {
-			handler.apply(self, Array.prototype.slice.call(args, 1));
-		});
-	}
- 
-};
- 
-function formQs (obj) {
-	var qs = "";
-	for (var key in obj) {
-		qs += key + "=" + obj[key] + "&";
-	}
-	qs = qs.slice(0, -1);
-	return qs;
-}
- 
-function guid () {
-	var ret = "";
-	for (var i=0; i<8; i++) {
-		ret += Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
-	}
-	return ret;
-}
- 
-function isEmail (string) {
-	return string.indexOf("@") !== -1;
-}
- 
-function isEqual (obj1, obj2) {
-	var str1 = JSON.stringify(obj1);
-	var str2 = JSON.stringify(obj2);
-	return str1 === str2;
-}
- 
-var must = {};
- 
-must._toString = function (thing) {
-	return Object.prototype.toString.call(thing).slice(8, -1);
-};
- 
-must.beString = function (s) {
-	var type = this._toString(s);
-	if (type !== "String") {
-		throw new Error("Assertion failed: expected String, instead got " + type);
-	}
-};
- 
-must.beArray = function (o) {
-	var type = this._toString(o);
-	if (type !== "Array") {
-		throw new Error("Assertion failed: expected Array, instead got " + type);
-	}
-};
- 
-must.beObject = function (o) {
-	var type = this._toString(o);
-	if (type !== "Object") {
-		throw new Error("Assertion failed: expected Object, instead got " + type);
-	}
-};
- 
-//////////////////////////
-// Asteroid constructor //
-//////////////////////////
- 
-var Asteroid = function (host, ssl, debug) {
-	// Assert arguments type
-	must.beString(host);
-	// Configure the instance
-	this._host = (ssl ? "https://" : "http://") + host;
-	// If SockJS is available, use it, otherwise, use WebSocket
-	// Note: SockJS is required for IE9 support
-	if (typeof SockJS === "function") {
-		this._ddpOptions = {
-			endpoint: (ssl ? "https://" : "http://") + host + "/sockjs",
-			SocketConstructor: SockJS,
-			debug: debug
-		};
-	} else {
-		this._ddpOptions = {
-			endpoint: (ssl ? "wss://" : "ws://") + host + "/websocket",
-			SocketConstructor: WebSocket,
-			debug: debug
-		};
-	}
-	// Reference containers
-	this.collections = {};
-	this.subscriptions = {};
-	// Init the instance
-	this._init();
-};
-// Asteroid instances are EventEmitter-s
-Asteroid.prototype = Object.create(EventEmitter.prototype);
-Asteroid.prototype.constructor = Asteroid;
- 
- 
- 
-////////////////////////////////
-// Establishes the connection //
-////////////////////////////////
- 
-Asteroid.prototype._init = function () {
-	var self = this;
-	// Creates the DDP instance, that will automatically
-	// connect to the DDP server.
-	self.ddp = new DDP(this._ddpOptions);
-	// Register handlers
-	self.ddp.on("connected", function () {
-		// Upon connection try resuming login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Subscribe to the meteor.loginServiceConfiguration
-		// collection, which holds the configuration options
-		// to login via third party services (oauth).
-		self.ddp.sub("meteor.loginServiceConfiguration");
-		// Emit the connected event
-		self._emit("connected");
-	});
-	self.ddp.on("reconnected", function () {
-		// Upon reconnection try resuming login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Re-establish all previously established (and still active) subscriptions
-		self._reEstablishSubscriptions();
-		// Emit the reconnected event
-		self._emit("reconnected");
-	});
-	self.ddp.on("added", function (data) {
-		self._onAdded(data);
-	});
-	self.ddp.on("changed", function (data) {
-		self._onChanged(data);
-	});
-	self.ddp.on("removed", function (data) {
-		self._onRemoved(data);
-	});
-};
- 
- 
- 
-///////////////////////////////////////
-// Handler for the ddp "added" event //
-///////////////////////////////////////
- 
-Asteroid.prototype._onAdded = function (data) {
-	// Get the name of the collection
-	var cName = data.collection;
-	// If the collection does not exist yet, create it
-	if (!this.collections[cName]) {
-		this.collections[cName] = new Asteroid._Collection(cName, this);
-	}
-	// data.fields can be undefined if the item added has only
-	// the _id field . To avoid errors down the line, ensure item
-	// is an object.
-	var item = data.fields || {};
-	item._id = data.id;
-	// Perform the remote insert
-	this.collections[cName]._remoteToLocalInsert(item);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "removed" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onRemoved = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// Perform the reomte remove
-	this.collections[data.collection]._remoteToLocalRemove(data.id);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "changes" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onChanged = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// data.fields can be undefined if the update only
-	// removed some properties in the item. Make sure
-	// it's an object
-	if (!data.fields) {
-		data.fields = {};
-	}
-	// If there were cleared fields, explicitly set them
-	// to undefined in the data.fields object. This will
-	// cause those fields to be present in the for ... in
-	// loop the remote update method of the collection
-	// performs, causing then the fields to be actually
-	// cleared from the item
-	if (data.cleared) {
-		data.cleared.forEach(function (key) {
-			data.fields[key] = undefined;
-		});
-	}
-	// Perform the remote update
-	this.collections[data.collection]._remoteToLocalUpdate(data.id, data.fields);
-};
- 
- 
- 
- 
- 
- 
- 
-////////////////////////////
-// Call and apply methods //
-////////////////////////////
- 
-Asteroid.prototype.call = function (method /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(method);
-	// Get the parameters for apply
-	var params = Array.prototype.slice.call(arguments, 1);
-	// Call apply
-	return this.apply(method, params);
-};
- 
-Asteroid.prototype.apply = function (method, params) {
-	// Assert arguments type
-	must.beString(method);
-	// If no parameters are given, use an empty array
-	Eif (!Array.isArray(params)) {
-		params = [];
-	}
-	// Create the result and updated promises
-	var resultDeferred = Q.defer();
-	var updatedDeferred = Q.defer();
-	var onResult = function (err, res) {
-		// The onResult handler takes care of errors
-		if (err) {
-			// If errors ccur, reject both promises
-			resultDeferred.reject(err);
-			updatedDeferred.reject();
-		} else {
-			// Otherwise resolve the result one
-			resultDeferred.resolve(res);
-		}
-	};
-	var onUpdated = function () {
-		// Just resolve the updated promise
-		updatedDeferred.resolve();
-	};
-	// Perform the method call
-	this.ddp.method(method, params, onResult, onUpdated);
-	// Return an object containing both promises
-	return {
-		result: resultDeferred.promise,
-		updated: updatedDeferred.promise
-	};
-};
- 
- 
- 
-/////////////////////
-// Syntactic sugar //
-/////////////////////
- 
-Asteroid.prototype.createCollection = function (name) {
-	// Assert arguments type
-	must.beString(name);
-	// Only create the collection if it doesn't exist
-	if (!this.collections[name]) {
-		this.collections[name] = new Asteroid._Collection(name, this);
-	}
-	return this.collections[name];
-};
- 
-///////////////////////////////////////////
-// Removal and update suffix for backups //
-///////////////////////////////////////////
- 
-var mf_removal_suffix = "__del__";
-var mf_update_suffix = "__upd__";
-var is_backup = function (id) {
-	var l1 = mf_removal_suffix.length;
-	var l2 = mf_update_suffix.length;
-	var s1 = id.slice(-1 * l1);
-	var s2 = id.slice(-1 * l2);
-	return s1 === mf_removal_suffix || s2 === mf_update_suffix;
-};
- 
- 
- 
-/////////////////////////////////////////////
-// Collection class constructor definition //
-/////////////////////////////////////////////
- 
-var Collection = function (name, asteroidRef) {
-	this.name = name;
-	this.asteroid = asteroidRef;
-	this._set = new Set();
-};
-Collection.prototype.constructor = Collection;
- 
- 
- 
-///////////////////////////////////////////////
-// Insert-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalInsert = function (item) {
-	// If an item by that id already exists, raise an exception
-	if (this._set.contains(item._id)) {
-		throw new Error("Item " + item._id + " already exists");
-	}
-	this._set.put(item._id, item);
-	// Return a promise, just for api consistency
-	return Q(item._id);
-};
-Collection.prototype._remoteToLocalInsert = function (item) {
-	// The server is the SSOT, add directly
-	this._set.put(item._id, item);
-};
-Collection.prototype._localToRemoteInsert = function (item) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/insert";
-	self.asteroid.ddp.method(methodName, [item], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			self._set.del(item._id);
-			deferred.reject(err);
-		} else {
-			// Else resolve the promise
-			deferred.resolve(item._id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.insert = function (item) {
-	// If the time has no id, generate one for it
-	if (!item._id) {
-		item._id = guid();
-	}
-	return {
-		// Perform the local insert
-		local: this._localToLocalInsert(item),
-		// Send the insert request
-		remote: this._localToRemoteInsert(item)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Remove-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalRemove = function (id) {
-	// Check if the item exists in the database
-	var existing = this._set.get(id);
-	if (existing) {
-		// Create a backup of the object to delete
-		this._set.put(id + mf_removal_suffix, existing);
-		// Delete the object
-		this._set.del(id);
-	}
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalRemove = function (id) {
-	// The server is the SSOT, remove directly (item and backup)
-	this._set.del(id);
-};
-Collection.prototype._localToRemoteRemove = function (id) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/remove";
-	self.asteroid.ddp.method(methodName, [{_id: id}], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_removal_suffix);
-			// Ensure there is a backup
-			if (backup) {
-				self._set.put(id, backup);
-				self._set.del(id + mf_removal_suffix);
-			}
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_removal_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.remove = function (id) {
-	return {
-		// Perform the local remove
-		local: this._localToLocalRemove(id),
-		// Send the remove request
-		remote: this._localToRemoteRemove(id)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Update-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalUpdate = function (id, fields) {
-	// Ensure the item actually exists
-	var existing = this._set.get(id);
-	if (!existing) {
-		throw new Error("Item " + id + " doesn't exist");
-	}
-	// Ensure the _id property won't get modified
-	if (fields._id && fields._id !== id) {
-		throw new Error("Modifying the _id of a document is not allowed");
-	}
-	// Create a backup
-	this._set.put(id + mf_update_suffix, existing);
-	// Perform the update
-	for (var field in fields) {
-		existing[field] = fields[field];
-	}
-	this._set.put(id, existing);
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalUpdate = function (id, fields) {
-	// Ensure the item exixts in the database
-	var existing = this._set.get(id);
-	if (!existing) {
-		console.warn("Server misbehaviour: item " + id + " doesn't exist");
-		return;
-	}
-	for (var field in fields) {
-		// Ensure the server is not trying to moify the item _id
-		if (field === "_id" && fields._id !== id) {
-			console.warn("Server misbehaviour: modifying the _id of a document is not allowed");
-			return;
-		}
-		existing[field] = fields[field];
-	}
-	// Perform the update
-	this._set.put(id, existing);
-};
-Collection.prototype._localToRemoteUpdate = function (id, fields) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/update";
-	// Construct the selector
-	var sel = {
-		_id: id
-	};
-	// Construct the modifier
-	var mod = {
-		$set: fields
-	};
-	self.asteroid.ddp.method(methodName, [sel, mod], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_update_suffix);
-			self._set.put(id, backup);
-			self._set.del(id + mf_update_suffix);
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_update_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.update = function (id, fields) {
-	return {
-		// Perform the local update
-		local: this._localToLocalUpdate(id, fields),
-		// Send the update request
-		remote: this._localToRemoteUpdate(id, fields)
-	};
-};
- 
- 
- 
-//////////////////////////////
-// Reactive queries methods //
-//////////////////////////////
- 
-var ReactiveQuery = function (set) {
-	var self = this;
-	self.result = [];
- 
-	self._set = set;
-	self._getResult();
- 
-	self._set.on("put", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
-	self._set.on("del", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
- 
-};
-ReactiveQuery.prototype = Object.create(EventEmitter.prototype);
-ReactiveQuery.constructor = ReactiveQuery;
- 
-ReactiveQuery.prototype._getResult = function () {
-	this.result = this._set.toArray();
-};
- 
-var getFilterFromSelector = function (selector) {
-	// Return the filter function
-	return function (id, item) {
- 
-		// Filter out backups
-		Iif (is_backup(id)) {
-			return false;
-		}
- 
-		// Get the value of the object from a compund key
-		// (e.g. "profile.name.first")
-		var getItemVal = function (item, key) {
-			return key.split(".").reduce(function (prev, curr) {
-				if (!prev) return prev;
-				prev = prev[curr];
-				return prev;
-			}, item);
-		};
- 
-		// Iterate all the keys in the selector. The first that
-		// doesn't match causes the item to be filtered out.
-		for (var key in selector) {
-			var itemVal = getItemVal(item, key);
-			if (itemVal !== selector[key]) {
-				return false;
-			}
-		}
- 
-		// At this point the item matches the selector
-		return true;
- 
-	};
-};
- 
-Collection.prototype.reactiveQuery = function (selectorOrFilter) {
-	var filter;
-	Iif (typeof selectorOrFilter === "function") {
-		filter = selectorOrFilter;
-	} else {
-		filter = getFilterFromSelector(selectorOrFilter);
-	}
-	var subset = this._set.filter(filter);
-	return new ReactiveQuery(subset);
-};
- 
- 
- 
-Asteroid._Collection = Collection;
- 
-Asteroid.prototype._getOauthClientId = function (serviceName) {
-	var loginConfigCollectionName = "meteor_accounts_loginServiceConfiguration";
-	var loginConfigCollection = this.collections[loginConfigCollectionName];
-	var service = loginConfigCollection.reactiveQuery({service: serviceName}).result[0];
-	return service.clientId || service.consumerKey || service.appId;
-};
- 
-Asteroid.prototype._initOauthLogin = function (service, credentialToken, loginUrl) {
-        var popup = window.open(loginUrl, '_blank', 'location=no,toolbar=no');	
-        var self = this;
-        var isCordovaApp = !!window.cordova;
-        var popupclosed = false;
-	
-        if(isCordovaApp){
-		popup.addEventListener('loaderror', function(e) {
-		    setTimeout(function() {
-                        popup.close();
-                    }, 100);
-                });
- 
-                popup.addEventListener('exit', function(e) { 
-                    popupclosed = true;
-                });
-        }
- 
-	return Q()
-		.then(function () {
-			var deferred = Q.defer();
-			if (popup.focus) popup.focus();
-			var intervalId = setInterval(function () {
-				if (
-					( !isCordovaApp && (popup.closed || popup.closed === undefined) ) ||
-					( isCordovaApp && popupclosed )
-				) 
-				{
-					clearInterval(intervalId);
-					deferred.resolve();
-				}
-			}, 100);
-			return deferred.promise;
-		})
-		.then(function () {
-			var deferred = Q.defer();
-			var loginParameters = {
-				oauth: {
-					credentialToken: credentialToken
-				}
-			};
-			self.ddp.method("login", [loginParameters], function (err, res) {
-				if (err) {
-					delete self.userId;
-					delete self.loggedIn;
-					delete localStorage[self._host + "__login_token__"];
-					deferred.reject(err);
-					self._emit("loginError", err);
-				} else {
-					self.userId = res.id;
-					self.loggedIn = true;
-					localStorage[self._host + "__login_token__"] = res.token;
-					self._emit("login", res.id);
-					deferred.resolve(res.id);
-				}
-			});
-			return deferred.promise;
-		});
-};
- 
-Asteroid.prototype._tryResumeLogin = function () {
-	var self = this;
-	var deferred = Q.defer();
-	var token = localStorage[self._host + "__login_token__"];
-	Eif (!token) {
-		deferred.reject("No login token");
-		return deferred.promise;
-	}
-	var loginParameters = {
-		resume: token
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("loginError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithFacebook = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("facebook"),
-		redirect_uri:	this._host + "/_oauth/facebook?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://www.facebook.com/dialog/oauth?" + formQs(query);
-	return this._initOauthLogin("facebook", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGoogle = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		response_type:	"code",
-		client_id:		this._getOauthClientId("google"),
-		redirect_uri:	this._host + "/_oauth/google?close",
-		state:			credentialToken,
-		scope:			scope || "openid email"
-	};
-	var loginUrl = "https://accounts.google.com/o/oauth2/auth?" + formQs(query);
-	return this._initOauthLogin("google", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGithub = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("github"),
-		redirect_uri:	this._host + "/_oauth/github?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://github.com/login/oauth/authorize?" + formQs(query);
-	return this._initOauthLogin("github", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithTwitter = function (scope) {
-	var credentialToken = guid();
-	var callbackUrl = this._host + "/_oauth/twitter?close&state=" + credentialToken;
-	var query = {
-		requestTokenAndRedirect:	encodeURIComponent(callbackUrl),
-		state:						credentialToken
-	};
-	var loginUrl = this._host + "/_oauth/twitter/?" + formQs(query);
-	return this._initOauthLogin("twitter", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.createUser = function (usernameOrEmail, password, profile) {
-	var self = this;
-	var deferred = Q.defer();
-	var options = {
-		username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-		email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined,
-		password: password,
-		profile: profile
-	};
-	self.ddp.method("createUser", [options], function (err, res) {
-		if (err) {
-			self._emit("createUserError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("createUser", res.id);
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithPassword = function (usernameOrEmail, password) {
-	var self = this;
-	var deferred = Q.defer();
-	var loginParameters = {
-		password: password,
-		user: {
-			username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-			email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined
-		}
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			deferred.reject(err);
-			self._emit("loginError", err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.logout = function () {
-	var self = this;
-	var deferred = Q.defer();
-	self.ddp.method("logout", [], function (err, res) {
-		if (err) {
-			self._emit("logoutError", err);
-			deferred.reject(err);
-		} else {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("logout");
-			deferred.resolve();
-		}
-	});
-	return deferred.promise;
-};
- 
-var Set = function (readonly) {
-	// Allow readonly sets
-	if (readonly) {
-		// Make the put and del methods private
-		this._put = this.put;
-		this._del = this.del;
-		// Replace them with a throwy function
-		this.put = this.del = function () {
-			throw new Error("Attempt to modify readonly set");
-		};
-	}
-	this._items = {};
-};
-// Inherit from EventEmitter
-Set.prototype = Object.create(EventEmitter.prototype);
-Set.constructor = Set;
- 
-Set.prototype.put = function (id, item) {
-	// Assert arguments type
-	must.beString(id);
-	must.beObject(item);
-	// Save a clone to avoid collateral damage
-	this._items[id] = clone(item);
-	this._emit("put", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.del = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	delete this._items[id];
-	this._emit("del", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.get = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	// Return a clone to avoid collateral damage
-	return clone(this._items[id]);
-};
- 
-Set.prototype.contains = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	return !!this._items[id];
-};
- 
-Set.prototype.filter = function (belongFn) {
- 
-	// Creates the subset
-	var sub = new Set(true);
- 
-	// Keep a reference to the _items hash
-	var items = this._items;
- 
-	// Performs the initial puts
-	var ids = Object.keys(items);
-	ids.forEach(function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._items[id] = items[id];
-		}
-	});
- 
-	// Listens to the put and del events
-	// to automatically update the subset
-	this.on("put", function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._put(id, items[id]);
-		}
-	});
-	this.on("del", function (id) {
-		sub._del(id);
-	});
- 
-	// Returns the subset
-	return sub;
-};
- 
-Set.prototype.toArray = function () {
-	var array = [];
-	var items = this._items;
-	var ids = Object.keys(this._items);
-	ids.forEach(function (id) {
-		array.push(items[id]);
-	});
-	// Return a clone to avoid collateral damage
-	return clone(array);
-};
- 
-Set.prototype.toHash = function () {
-	// Return a clone to avoid collateral damage
-	return clone(this._items);
-};
- 
-Asteroid.Set = Set;
- 
-////////////////////////
-// Subscription class //
-////////////////////////
- 
-var Subscription = function (name, params, asteroid) {
-	this._name = name;
-	this._params = params;
-	this._asteroid = asteroid;
-	// Subscription promises
-	this._ready = Q.defer();
-	this.ready = this._ready.promise;
-	// Subscribe via DDP
-	var or = this._onReady.bind(this);
-	var os = this._onStop.bind(this);
-	var oe = this._onError.bind(this);
-	this.id = asteroid.ddp.sub(name, params, or, os, oe);
-};
-Subscription.constructor = Subscription;
- 
-Subscription.prototype.stop = function () {
-	this._asteroid.ddp.unsub(this.id);
-};
- 
-Subscription.prototype._onReady = function () {
-	this._ready.resolve(this.id);
-};
- 
-Subscription.prototype._onStop = function () {
-	delete this._asteroid.subscriptions[this.id];
-};
- 
-Subscription.prototype._onError = function (err) {
-	Eif (this.ready.isPending()) {
-		this._ready.reject(err);
-	}
-	delete this._asteroid.subscriptions[this.id];
-};
- 
- 
- 
-//////////////////////
-// Subscribe method //
-//////////////////////
- 
-Asteroid.prototype.subscribe = function (name /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(name);
-	// Collect arguments into array
-	var params = Array.prototype.slice.call(arguments, 1);
-	var sub = new Subscription(name, params, this);
-	this.subscriptions[sub.id] = sub;
-	return sub;
-};
- 
-Asteroid.prototype._reEstablishSubscriptions = function () {
-	var subs = this.subscriptions;
-	for (var id in subs) {
-		subs[id] = new Subscription(subs[id]._name, subs[id]._params, this);
-	}
-};
- 
-return Asteroid;
- 
-}));
- 
- -
- - - - - - - - diff --git a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/dist/index.html b/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/dist/index.html deleted file mode 100644 index e680d8d..0000000 --- a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/dist/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for dist/ - - - - - - - -
-

Code coverage report for dist/

-

- - Statements: 64.27% (313 / 487)      - - - Branches: 49.66% (72 / 145)      - - - Functions: 59.6% (59 / 99)      - - - Lines: 64.38% (309 / 480)      - - Ignored: none      -

-
All files » dist/
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
asteroid.js64.27%(313 / 487)49.66%(72 / 145)59.6%(59 / 99)64.38%(309 / 480)
-
-
- - - - - - - - diff --git a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/index.html b/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/index.html deleted file mode 100644 index c05e9b2..0000000 --- a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for All files - - - - - - - -
-

Code coverage report for All files

-

- - Statements: 64.27% (313 / 487)      - - - Branches: 49.66% (72 / 145)      - - - Functions: 59.6% (59 / 99)      - - - Lines: 64.38% (309 / 480)      - - Ignored: none      -

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
dist/64.27%(313 / 487)49.66%(72 / 145)59.6%(59 / 99)64.38%(309 / 480)
-
-
- - - - - - - - diff --git a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/prettify.css b/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/prettify.js b/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/prettify.js deleted file mode 100644 index ef51e03..0000000 --- a/test/coverage/Firefox 29.0.0 (Mac OS X 10.9)/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/dist/asteroid.js.html b/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/dist/asteroid.js.html index 301eabf..41fbba9 100644 --- a/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/dist/asteroid.js.html +++ b/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/dist/asteroid.js.html @@ -1290,11 +1290,11 @@

    1 -1019 +1110     -1019 -1019 +1110 +1110     9 @@ -1303,10 +1303,10 @@

      -1010 +1101     -1010 +1101       @@ -1331,8 +1331,8 @@

      -310 -310 +317 +317 4 4 4 @@ -1352,11 +1352,11 @@

    1 -41 -41 -328 +48 +48 +384   -41 +48     1 @@ -1372,12 +1372,12 @@

1   1 -755 +776     1 -458 -458 +472 +472 7     @@ -1390,8 +1390,8 @@

    1 -297 -297 +304 +304 1     @@ -1619,11 +1619,11 @@

1 1 1 -480 -480 -480 -480 -480 +564 +564 +564 +564 +564       @@ -1647,40 +1647,40 @@

  1   -65 +72 2   -63 +70   -63 +70   1   1   1 -63 -63 +70 +70   -63 -63 -43 +70 +70 +50   2 2     -41 +48     -63 +70   1   -65 -41 +72 +48   -65 +72       @@ -1858,31 +1858,31 @@

12     -480 +564           -480 -480 -600 -531 -531 +564 +564 +705 +621 +621           -480 -480 -480 -407 +564 +564 +564 +481         -73 +83       @@ -2180,13 +2180,13 @@

  1   -298 -297 +305 +304   -296 -296 +303 +303   -296 +303     1 @@ -2207,8 +2207,8 @@

  1   -68 -67 +75 +74     1 @@ -2224,10 +2224,10 @@

14     -680 -680 -680 -173 +764 +764 +764 +183       @@ -2255,7 +2255,7 @@

15 15 15 -224 +234     15 @@ -3407,7 +3407,7 @@

diff --git a/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/dist/index.html b/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/dist/index.html index 8400f0b..dcdff1a 100644 --- a/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/dist/index.html +++ b/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/dist/index.html @@ -249,7 +249,7 @@

diff --git a/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/index.html b/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/index.html index 79d64c2..57a8fd3 100644 --- a/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/index.html +++ b/test/coverage/Firefox 30.0.0 (Mac OS X 10.9)/index.html @@ -249,7 +249,7 @@

diff --git a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/dist/asteroid.js.html b/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/dist/asteroid.js.html deleted file mode 100644 index c8730a5..0000000 --- a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/dist/asteroid.js.html +++ /dev/null @@ -1,3298 +0,0 @@ - - - - Code coverage report for dist/asteroid.js - - - - - - - -
-

Code coverage report for dist/asteroid.js

-

- - Statements: 65.34% (313 / 479)      - - - Branches: 52.55% (72 / 137)      - - - Functions: 61.46% (59 / 96)      - - - Lines: 65.47% (309 / 472)      - - Ignored: none      -

-
All files » dist/ » asteroid.js
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466 -467 -468 -469 -470 -471 -472 -473 -474 -475 -476 -477 -478 -479 -480 -481 -482 -483 -484 -485 -486 -487 -488 -489 -490 -491 -492 -493 -494 -495 -496 -497 -498 -499 -500 -501 -502 -503 -504 -505 -506 -507 -508 -509 -510 -511 -512 -513 -514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526 -527 -528 -529 -530 -531 -532 -533 -534 -535 -536 -537 -538 -539 -540 -541 -542 -543 -544 -545 -546 -547 -548 -549 -550 -551 -552 -553 -554 -555 -556 -557 -558 -559 -560 -561 -562 -563 -564 -565 -566 -567 -568 -569 -570 -571 -572 -573 -574 -575 -576 -577 -578 -579 -580 -581 -582 -583 -584 -585 -586 -587 -588 -589 -590 -591 -592 -593 -594 -595 -596 -597 -598 -599 -600 -601 -602 -603 -604 -605 -606 -607 -608 -609 -610 -611 -612 -613 -614 -615 -616 -617 -618 -619 -620 -621 -622 -623 -624 -625 -626 -627 -628 -629 -630 -631 -632 -633 -634 -635 -636 -637 -638 -639 -640 -641 -642 -643 -644 -645 -646 -647 -648 -649 -650 -651 -652 -653 -654 -655 -656 -657 -658 -659 -660 -661 -662 -663 -664 -665 -666 -667 -668 -669 -670 -671 -672 -673 -674 -675 -676 -677 -678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -695 -696 -697 -698 -699 -700 -701 -702 -703 -704 -705 -706 -707 -708 -709 -710 -711 -712 -713 -714 -715 -716 -717 -718 -719 -720 -721 -722 -723 -724 -725 -726 -727 -728 -729 -730 -731 -732 -733 -734 -735 -736 -737 -738 -739 -740 -741 -742 -743 -744 -745 -746 -747 -748 -749 -750 -751 -752 -753 -754 -755 -756 -757 -758 -759 -760 -761 -762 -763 -764 -765 -766 -767 -768 -769 -770 -771 -772 -773 -774 -775 -776 -777 -778 -779 -780 -781 -782 -783 -784 -785 -786 -787 -788 -789 -790 -791 -792 -793 -794 -795 -796 -797 -798 -799 -800 -801 -802 -803 -804 -805 -806 -807 -808 -809 -810 -811 -812 -813 -814 -815 -816 -817 -818 -819 -820 -821 -822 -823 -824 -825 -826 -827 -828 -829 -830 -831 -832 -833 -834 -835 -836 -837 -838 -839 -840 -841 -842 -843 -844 -845 -846 -847 -848 -849 -850 -851 -852 -853 -854 -855 -856 -857 -858 -859 -860 -861 -862 -863 -864 -865 -866 -867 -868 -869 -870 -871 -872 -873 -874 -875 -876 -877 -878 -879 -880 -881 -882 -883 -884 -885 -886 -887 -888 -889 -890 -891 -892 -893 -894 -895 -896 -897 -898 -899 -900 -901 -902 -903 -904 -905 -906 -907 -908 -909 -910 -911 -912 -913 -914 -915 -916 -917 -918 -919 -920 -921 -922 -923 -924 -925 -926 -927 -928 -929 -930 -931 -932 -933 -934 -935 -936 -937 -938 -939 -940 -941 -942 -943 -944 -945 -946 -947 -948 -949 -950 -951 -952 -953 -954 -955 -956 -957 -958 -959 -960 -961 -962 -963 -964 -965 -966 -967 -968 -969 -970 -971 -972 -973 -974 -975 -976 -977 -978 -979 -980 -981 -982 -983 -984 -985 -986 -987 -988 -989 -990 -991 -992 -9931 -1 -  -1 -  -  -1 -  -  -  -  -  -1 -889 -  -  -889 -889 -  -  -9 -  -  -  -  -  -880 -  -  -880 -  -  -  -  -  -1 -  -1 -  -  -  -  -52 -52 -52 -  -  -  -  -  -  -  -  -  -300 -300 -4 -4 -4 -4 -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -31 -31 -248 -  -31 -  -  -1 -  -  -  -1 -  -  -  -  -  -1 -  -1 -718 -  -  -1 -431 -431 -7 -  -  -  -1 -  -  -  -  -  -  -1 -287 -287 -1 -  -  -  -  -  -  -  -1 -  -24 -  -23 -  -  -23 -1 -  -  -  -  -  -22 -  -  -  -  -  -  -  -23 -23 -  -23 -  -  -1 -1 -  -  -  -  -  -  -  -1 -17 -  -  -17 -  -17 -  -  -1 -  -  -  -1 -  -1 -  -17 -  -  -  -  -  -  -  -  -17 -  -  -17 -  -  -17 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -  -7 -  -6 -6 -  -  -6 -6 -6 -  -3 -  -2 -2 -  -  -1 -  -  -6 -  -1 -  -  -6 -  -6 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -360 -360 -360 -360 -360 -  -  -  -  -  -  -  -  -1 -33 -33 -33 -  -1 -  -  -  -  -  -  -  -1 -  -55 -2 -  -53 -  -53 -  -1 -  -1 -  -1 -53 -53 -  -53 -53 -33 -  -2 -2 -  -  -31 -  -  -53 -  -1 -  -55 -31 -  -55 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -8 -8 -  -2 -  -2 -  -  -8 -  -1 -  -1 -  -1 -8 -8 -  -8 -8 -3 -  -2 -  -2 -1 -1 -  -2 -  -  -1 -1 -  -  -8 -  -1 -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -10 -10 -1 -  -  -9 -2 -  -  -7 -  -7 -5 -  -7 -  -7 -  -1 -  -3 -3 -1 -1 -  -2 -  -2 -1 -1 -  -1 -  -  -1 -  -1 -7 -7 -  -7 -  -7 -  -  -  -7 -  -  -7 -3 -  -2 -2 -2 -2 -  -  -1 -1 -  -  -7 -  -1 -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -12 -12 -  -12 -12 -  -12 -  -  -  -12 -  -  -  -  -  -1 -1 -  -1 -12 -  -  -1 -  -12 -  -  -360 -  -  -  -  -  -360 -360 -450 -390 -390 -  -  -  -  -  -360 -360 -360 -316 -  -  -  -  -44 -  -  -  -  -1 -12 -12 -  -  -12 -  -12 -12 -  -  -  -  -1 -  -1 -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -1 -1 -1 -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -58 -  -15 -15 -  -15 -2 -  -  -58 -  -  -1 -1 -  -1 -  -288 -287 -  -286 -286 -  -286 -  -  -1 -  -18 -17 -17 -  -17 -  -  -1 -  -27 -  -26 -  -  -1 -  -58 -57 -  -  -1 -  -  -14 -  -  -14 -  -  -14 -14 -  -  -560 -560 -560 -144 -  -  -  -  -  -14 -  -  -2 -2 -2 -1 -  -  -14 -2 -  -  -  -14 -  -  -1 -15 -15 -15 -15 -195 -  -  -15 -  -  -1 -  -  -  -  -1 -  -  -  -  -  -1 -8 -8 -8 -  -8 -8 -  -8 -8 -8 -8 -  -1 -  -1 -2 -  -  -1 -1 -  -  -1 -2 -  -  -1 -1 -1 -  -1 -  -  -  -  -  -  -  -  -1 -  -9 -  -8 -8 -8 -8 -  -  -1 -  -  -  -  -  -  -1 -  -  - 
(function (root, factory) {
-    Iif (typeof define === "function" && define.amd) {
-        define(factory);
-    } else Iif (typeof exports === "object") {
-        module.exports = factory();
-    } else {
-        root.Asteroid = factory();
-    }
-}(this, function () {
- 
-"use strict";
- 
-function clone (obj) {
-	Iif (typeof EJSON !== "undefined") {
-		return EJSON.clone(obj);
-	}
-	var type = typeof obj;
-	switch (type) {
-		case "undefined":
-		case "function":
-			return undefined;
-		case "string":
-		case "number":
-		case "boolean":
-			return obj;
-		case "object":
-			Iif (obj === null) {
-				return null;
-			}
-			return JSON.parse(JSON.stringify(obj));
-		default:
-			return;
-	}
-}
- 
-var EventEmitter = function () {};
- 
-EventEmitter.prototype = {
- 
-	constructor: EventEmitter,
- 
-	on: function (name, handler) {
-		if (!this._events) this._events = {};
-		this._events[name] = this._events[name] || [];
-		this._events[name].push(handler);
-	},
- 
-	off: function (name, handler) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		this._events[name].splice(this._events[name].indexOf(handler), 1);
-	},
- 
-	_emit: function (name /* , arguments */) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		var args = arguments;
-		var self = this;
-		this._events[name].forEach(function (handler) {
-			handler.apply(self, Array.prototype.slice.call(args, 1));
-		});
-	}
- 
-};
- 
-function formQs (obj) {
-	var qs = "";
-	for (var key in obj) {
-		qs += key + "=" + obj[key] + "&";
-	}
-	qs = qs.slice(0, -1);
-	return qs;
-}
- 
-function guid () {
-	var ret = "";
-	for (var i=0; i<8; i++) {
-		ret += Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
-	}
-	return ret;
-}
- 
-function isEmail (string) {
-	return string.indexOf("@") !== -1;
-}
- 
-function isEqual (obj1, obj2) {
-	var str1 = JSON.stringify(obj1);
-	var str2 = JSON.stringify(obj2);
-	return str1 === str2;
-}
- 
-var must = {};
- 
-must._toString = function (thing) {
-	return Object.prototype.toString.call(thing).slice(8, -1);
-};
- 
-must.beString = function (s) {
-	var type = this._toString(s);
-	if (type !== "String") {
-		throw new Error("Assertion failed: expected String, instead got " + type);
-	}
-};
- 
-must.beArray = function (o) {
-	var type = this._toString(o);
-	if (type !== "Array") {
-		throw new Error("Assertion failed: expected Array, instead got " + type);
-	}
-};
- 
-must.beObject = function (o) {
-	var type = this._toString(o);
-	if (type !== "Object") {
-		throw new Error("Assertion failed: expected Object, instead got " + type);
-	}
-};
- 
-//////////////////////////
-// Asteroid constructor //
-//////////////////////////
- 
-var Asteroid = function (host, ssl, debug) {
-	// Assert arguments type
-	must.beString(host);
-	// Configure the instance
-	this._host = (ssl ? "https://" : "http://") + host;
-	// If SockJS is available, use it, otherwise, use WebSocket
-	// Note: SockJS is required for IE9 support
-	if (window.SockJS) {
-		this._ddpOptions = {
-			endpoint: (ssl ? "https://" : "http://") + host + "/sockjs",
-			SocketConstructor: window.SockJS,
-			debug: debug
-		};
-	} else {
-		this._ddpOptions = {
-			endpoint: (ssl ? "wss://" : "ws://") + host + "/websocket",
-			SocketConstructor: window.WebSocket,
-			debug: debug
-		};
-	}
- 
-	// Reference containers
-	this.collections = {};
-	this.subscriptions = {};
-	// Init the instance
-	this._init();
-};
-// Asteroid instances are EventEmitter-s
-Asteroid.prototype = Object.create(EventEmitter.prototype);
-Asteroid.prototype.constructor = Asteroid;
- 
- 
- 
-////////////////////////////////
-// Establishes the connection //
-////////////////////////////////
- 
-Asteroid.prototype._init = function () {
-	var self = this;
-	// Creates the DDP instance, that will automatically
-	// connect to the DDP server.
-	self.ddp = new DDP(this._ddpOptions);
-	// Register handlers
-	self.ddp.on("connected", function () {
-		// Upon connection, try resuming the login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Subscribe to the meteor.loginServiceConfiguration
-		// collection, which holds the configuration options
-		// to login via third party services (oauth).
-		self.ddp.sub("meteor.loginServiceConfiguration");
-		// Emit the connected event
-		self._emit("connected");
-	});
-	self.ddp.on("reconnected", function () {
-		// Upon reconnection, try resuming the login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Re-establish all previously established (and still active) subscriptions
-		self._reEstablishSubscriptions();
-		// Emit the reconnected event
-		self._emit("reconnected");
-	});
-	self.ddp.on("added", function (data) {
-		self._onAdded(data);
-	});
-	self.ddp.on("changed", function (data) {
-		self._onChanged(data);
-	});
-	self.ddp.on("removed", function (data) {
-		self._onRemoved(data);
-	});
-};
- 
- 
- 
-///////////////////////////////////////
-// Handler for the ddp "added" event //
-///////////////////////////////////////
- 
-Asteroid.prototype._onAdded = function (data) {
-	// Get the name of the collection
-	var cName = data.collection;
-	// If the collection does not exist yet, create it
-	if (!this.collections[cName]) {
-		this.collections[cName] = new Asteroid._Collection(cName, this);
-	}
-	// data.fields can be undefined if the item added has only
-	// the _id field . To avoid errors down the line, ensure item
-	// is an object.
-	var item = data.fields || {};
-	item._id = data.id;
-	// Perform the remote insert
-	this.collections[cName]._remoteToLocalInsert(item);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "removed" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onRemoved = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// Perform the reomte remove
-	this.collections[data.collection]._remoteToLocalRemove(data.id);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "changes" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onChanged = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// data.fields can be undefined if the update only
-	// removed some properties in the item. Make sure
-	// it's an object
-	if (!data.fields) {
-		data.fields = {};
-	}
-	// If there were cleared fields, explicitly set them
-	// to undefined in the data.fields object. This will
-	// cause those fields to be present in the for ... in
-	// loop the remote update method of the collection
-	// performs, causing then the fields to be actually
-	// cleared from the item
-	if (data.cleared) {
-		data.cleared.forEach(function (key) {
-			data.fields[key] = undefined;
-		});
-	}
-	// Perform the remote update
-	this.collections[data.collection]._remoteToLocalUpdate(data.id, data.fields);
-};
- 
- 
- 
- 
- 
- 
- 
-////////////////////////////
-// Call and apply methods //
-////////////////////////////
- 
-Asteroid.prototype.call = function (method /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(method);
-	// Get the parameters for apply
-	var params = Array.prototype.slice.call(arguments, 1);
-	// Call apply
-	return this.apply(method, params);
-};
- 
-Asteroid.prototype.apply = function (method, params) {
-	// Assert arguments type
-	must.beString(method);
-	// If no parameters are given, use an empty array
-	Eif (!Array.isArray(params)) {
-		params = [];
-	}
-	// Create the result and updated promises
-	var resultDeferred = Q.defer();
-	var updatedDeferred = Q.defer();
-	var onResult = function (err, res) {
-		// The onResult handler takes care of errors
-		if (err) {
-			// If errors ccur, reject both promises
-			resultDeferred.reject(err);
-			updatedDeferred.reject();
-		} else {
-			// Otherwise resolve the result one
-			resultDeferred.resolve(res);
-		}
-	};
-	var onUpdated = function () {
-		// Just resolve the updated promise
-		updatedDeferred.resolve();
-	};
-	// Perform the method call
-	this.ddp.method(method, params, onResult, onUpdated);
-	// Return an object containing both promises
-	return {
-		result: resultDeferred.promise,
-		updated: updatedDeferred.promise
-	};
-};
- 
- 
- 
-/////////////////////
-// Syntactic sugar //
-/////////////////////
- 
-Asteroid.prototype.createCollection = function (name) {
-	// Assert arguments type
-	must.beString(name);
-	// Only create the collection if it doesn't exist
-	if (!this.collections[name]) {
-		this.collections[name] = new Asteroid._Collection(name, this);
-	}
-	return this.collections[name];
-};
- 
-///////////////////////////////////////////
-// Removal and update suffix for backups //
-///////////////////////////////////////////
- 
-var mf_removal_suffix = "__del__";
-var mf_update_suffix = "__upd__";
-var is_backup = function (id) {
-	var l1 = mf_removal_suffix.length;
-	var l2 = mf_update_suffix.length;
-	var s1 = id.slice(-1 * l1);
-	var s2 = id.slice(-1 * l2);
-	return s1 === mf_removal_suffix || s2 === mf_update_suffix;
-};
- 
- 
- 
-/////////////////////////////////////////////
-// Collection class constructor definition //
-/////////////////////////////////////////////
- 
-var Collection = function (name, asteroidRef) {
-	this.name = name;
-	this.asteroid = asteroidRef;
-	this._set = new Set();
-};
-Collection.prototype.constructor = Collection;
- 
- 
- 
-///////////////////////////////////////////////
-// Insert-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalInsert = function (item) {
-	// If an item by that id already exists, raise an exception
-	if (this._set.contains(item._id)) {
-		throw new Error("Item " + item._id + " already exists");
-	}
-	this._set.put(item._id, item);
-	// Return a promise, just for api consistency
-	return Q(item._id);
-};
-Collection.prototype._remoteToLocalInsert = function (item) {
-	// The server is the SSOT, add directly
-	this._set.put(item._id, item);
-};
-Collection.prototype._localToRemoteInsert = function (item) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/insert";
-	self.asteroid.ddp.method(methodName, [item], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			self._set.del(item._id);
-			deferred.reject(err);
-		} else {
-			// Else resolve the promise
-			deferred.resolve(item._id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.insert = function (item) {
-	// If the time has no id, generate one for it
-	if (!item._id) {
-		item._id = guid();
-	}
-	return {
-		// Perform the local insert
-		local: this._localToLocalInsert(item),
-		// Send the insert request
-		remote: this._localToRemoteInsert(item)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Remove-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalRemove = function (id) {
-	// Check if the item exists in the database
-	var existing = this._set.get(id);
-	if (existing) {
-		// Create a backup of the object to delete
-		this._set.put(id + mf_removal_suffix, existing);
-		// Delete the object
-		this._set.del(id);
-	}
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalRemove = function (id) {
-	// The server is the SSOT, remove directly (item and backup)
-	this._set.del(id);
-};
-Collection.prototype._localToRemoteRemove = function (id) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/remove";
-	self.asteroid.ddp.method(methodName, [{_id: id}], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_removal_suffix);
-			// Ensure there is a backup
-			if (backup) {
-				self._set.put(id, backup);
-				self._set.del(id + mf_removal_suffix);
-			}
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_removal_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.remove = function (id) {
-	return {
-		// Perform the local remove
-		local: this._localToLocalRemove(id),
-		// Send the remove request
-		remote: this._localToRemoteRemove(id)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Update-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalUpdate = function (id, fields) {
-	// Ensure the item actually exists
-	var existing = this._set.get(id);
-	if (!existing) {
-		throw new Error("Item " + id + " doesn't exist");
-	}
-	// Ensure the _id property won't get modified
-	if (fields._id && fields._id !== id) {
-		throw new Error("Modifying the _id of a document is not allowed");
-	}
-	// Create a backup
-	this._set.put(id + mf_update_suffix, existing);
-	// Perform the update
-	for (var field in fields) {
-		existing[field] = fields[field];
-	}
-	this._set.put(id, existing);
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalUpdate = function (id, fields) {
-	// Ensure the item exixts in the database
-	var existing = this._set.get(id);
-	if (!existing) {
-		console.warn("Server misbehaviour: item " + id + " doesn't exist");
-		return;
-	}
-	for (var field in fields) {
-		// Ensure the server is not trying to moify the item _id
-		if (field === "_id" && fields._id !== id) {
-			console.warn("Server misbehaviour: modifying the _id of a document is not allowed");
-			return;
-		}
-		existing[field] = fields[field];
-	}
-	// Perform the update
-	this._set.put(id, existing);
-};
-Collection.prototype._localToRemoteUpdate = function (id, fields) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/update";
-	// Construct the selector
-	var sel = {
-		_id: id
-	};
-	// Construct the modifier
-	var mod = {
-		$set: fields
-	};
-	self.asteroid.ddp.method(methodName, [sel, mod], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_update_suffix);
-			self._set.put(id, backup);
-			self._set.del(id + mf_update_suffix);
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_update_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.update = function (id, fields) {
-	return {
-		// Perform the local update
-		local: this._localToLocalUpdate(id, fields),
-		// Send the update request
-		remote: this._localToRemoteUpdate(id, fields)
-	};
-};
- 
- 
- 
-//////////////////////////////
-// Reactive queries methods //
-//////////////////////////////
- 
-var ReactiveQuery = function (set) {
-	var self = this;
-	self.result = [];
- 
-	self._set = set;
-	self._getResult();
- 
-	self._set.on("put", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
-	self._set.on("del", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
- 
-};
-ReactiveQuery.prototype = Object.create(EventEmitter.prototype);
-ReactiveQuery.constructor = ReactiveQuery;
- 
-ReactiveQuery.prototype._getResult = function () {
-	this.result = this._set.toArray();
-};
- 
-var getFilterFromSelector = function (selector) {
-	// Return the filter function
-	return function (id, item) {
- 
-		// Filter out backups
-		Iif (is_backup(id)) {
-			return false;
-		}
- 
-		// Get the value of the object from a compund key
-		// (e.g. "profile.name.first")
-		var getItemVal = function (item, key) {
-			return key.split(".").reduce(function (prev, curr) {
-				if (!prev) return prev;
-				prev = prev[curr];
-				return prev;
-			}, item);
-		};
- 
-		// Iterate all the keys in the selector. The first that
-		// doesn't match causes the item to be filtered out.
-		for (var key in selector) {
-			var itemVal = getItemVal(item, key);
-			if (itemVal !== selector[key]) {
-				return false;
-			}
-		}
- 
-		// At this point the item matches the selector
-		return true;
- 
-	};
-};
- 
-Collection.prototype.reactiveQuery = function (selectorOrFilter) {
-	var filter;
-	Iif (typeof selectorOrFilter === "function") {
-		filter = selectorOrFilter;
-	} else {
-		filter = getFilterFromSelector(selectorOrFilter);
-	}
-	var subset = this._set.filter(filter);
-	return new ReactiveQuery(subset);
-};
- 
- 
- 
-Asteroid._Collection = Collection;
- 
-Asteroid.prototype._getOauthClientId = function (serviceName) {
-	var loginConfigCollectionName = "meteor_accounts_loginServiceConfiguration";
-	var loginConfigCollection = this.collections[loginConfigCollectionName];
-	var service = loginConfigCollection.reactiveQuery({service: serviceName}).result[0];
-	return service.clientId;
-};
- 
-Asteroid.prototype._initOauthLogin = function (service, credentialToken, loginUrl) {
-	var popup = window.open(loginUrl, "Login");
-	var self = this;
-	return Q()
-		.then(function () {
-			var deferred = Q.defer();
-			if (popup.focus) popup.focus();
-			var intervalId = setInterval(function () {
-				if (popup.closed || popup.closed === undefined) {
-					clearInterval(intervalId);
-					deferred.resolve();
-				}
-			}, 100);
-			return deferred.promise;
-		})
-		.then(function () {
-			var deferred = Q.defer();
-			var loginParameters = {
-				oauth: {
-					credentialToken: credentialToken
-				}
-			};
-			self.ddp.method("login", [loginParameters], function (err, res) {
-				if (err) {
-					delete self.userId;
-					delete self.loggedIn;
-					delete localStorage[self._host + "__login_token__"];
-					deferred.reject(err);
-					self._emit("loginError", err);
-				} else {
-					self.userId = res.id;
-					self.loggedIn = true;
-					localStorage[self._host + "__login_token__"] = res.token;
-					self._emit("login", res.id);
-					deferred.resolve(res.id);
-				}
-			});
-			return deferred.promise;
-		});
-};
- 
-Asteroid.prototype._tryResumeLogin = function () {
-	var self = this;
-	var deferred = Q.defer();
-	var token = localStorage[self._host + "__login_token__"];
-	Eif (!token) {
-		deferred.reject("No login token");
-		return deferred.promise;
-	}
-	var loginParameters = {
-		resume: token
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("loginError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithFacebook = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("facebook"),
-		redirect_uri:	this._host + "/_oauth/facebook?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://www.facebook.com/dialog/oauth?" + formQs(query);
-	return this._initOauthLogin("facebook", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGoogle = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		response_type:	"code",
-		client_id:		this._getOauthClientId("google"),
-		redirect_uri:	this._host + "/_oauth/google?close",
-		state:			credentialToken,
-		scope:			scope || "openid email"
-	};
-	var loginUrl = "https://accounts.google.com/o/oauth2/auth?" + formQs(query);
-	return this._initOauthLogin("google", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGithub = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("github"),
-		redirect_uri:	this._host + "/_oauth/github?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://github.com/login/oauth/authorize?" + formQs(query);
-	return this._initOauthLogin("github", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithTwitter = function (scope) {
-	var credentialToken = guid();
-	var callbackUrl = this._host + "/_oauth/twitter?close&state=" + credentialToken;
-	var query = {
-		requestTokenAndRedirect:	encodeURIComponent(callbackUrl),
-		state:						credentialToken
-	};
-	var loginUrl = this._host + "/_oauth/twitter/?" + formQs(query);
-	return this._initOauthLogin("twitter", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.createUser = function (usernameOrEmail, password, profile) {
-	var self = this;
-	var deferred = Q.defer();
-	var options = {
-		username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-		email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined,
-		password: password,
-		profile: profile
-	};
-	self.ddp.method("createUser", [options], function (err, res) {
-		if (err) {
-			self._emit("createUserError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("createUser", res.id);
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithPassword = function (usernameOrEmail, password) {
-	var self = this;
-	var deferred = Q.defer();
-	var loginParameters = {
-		password: password,
-		user: {
-			username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-			email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined
-		}
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			deferred.reject(err);
-			self._emit("loginError", err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.logout = function () {
-	var self = this;
-	var deferred = Q.defer();
-	self.ddp.method("logout", [], function (err, res) {
-		if (err) {
-			self._emit("logoutError", err);
-			deferred.reject(err);
-		} else {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("logout");
-			deferred.resolve();
-		}
-	});
-	return deferred.promise;
-};
- 
-var Set = function (readonly) {
-	// Allow readonly sets
-	if (readonly) {
-		// Make the put and del methods private
-		this._put = this.put;
-		this._del = this.del;
-		// Replace them with a throwy function
-		this.put = this.del = function () {
-			throw new Error("Attempt to modify readonly set");
-		};
-	}
-	this._items = {};
-};
-// Inherit from EventEmitter
-Set.prototype = Object.create(EventEmitter.prototype);
-Set.constructor = Set;
- 
-Set.prototype.put = function (id, item) {
-	// Assert arguments type
-	must.beString(id);
-	must.beObject(item);
-	// Save a clone to avoid collateral damage
-	this._items[id] = clone(item);
-	this._emit("put", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.del = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	delete this._items[id];
-	this._emit("del", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.get = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	// Return a clone to avoid collateral damage
-	return clone(this._items[id]);
-};
- 
-Set.prototype.contains = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	return !!this._items[id];
-};
- 
-Set.prototype.filter = function (belongFn) {
- 
-	// Creates the subset
-	var sub = new Set(true);
- 
-	// Keep a reference to the _items hash
-	var items = this._items;
- 
-	// Performs the initial puts
-	var ids = Object.keys(items);
-	ids.forEach(function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._items[id] = items[id];
-		}
-	});
- 
-	// Listens to the put and del events
-	// to automatically update the subset
-	this.on("put", function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._put(id, items[id]);
-		}
-	});
-	this.on("del", function (id) {
-		sub._del(id);
-	});
- 
-	// Returns the subset
-	return sub;
-};
- 
-Set.prototype.toArray = function () {
-	var array = [];
-	var items = this._items;
-	var ids = Object.keys(this._items);
-	ids.forEach(function (id) {
-		array.push(items[id]);
-	});
-	// Return a clone to avoid collateral damage
-	return clone(array);
-};
- 
-Set.prototype.toHash = function () {
-	// Return a clone to avoid collateral damage
-	return clone(this._items);
-};
- 
-Asteroid.Set = Set;
- 
-////////////////////////
-// Subscription class //
-////////////////////////
- 
-var Subscription = function (name, params, asteroid) {
-	this._name = name;
-	this._params = params;
-	this._asteroid = asteroid;
-	// Subscription promises
-	this._ready = Q.defer();
-	this.ready = this._ready.promise;
-	// Subscribe via DDP
-	var or = this._onReady.bind(this);
-	var os = this._onStop.bind(this);
-	var oe = this._onError.bind(this);
-	this.id = asteroid.ddp.sub(name, params, or, os, oe);
-};
-Subscription.constructor = Subscription;
- 
-Subscription.prototype.stop = function () {
-	this._asteroid.ddp.unsub(this.id);
-};
- 
-Subscription.prototype._onReady = function () {
-	this._ready.resolve();
-};
- 
-Subscription.prototype._onStop = function () {
-	delete this._asteroid.subscriptions[this.id];
-};
- 
-Subscription.prototype._onError = function (err) {
-	Eif (this.ready.isPending()) {
-		this._ready.reject(err);
-	}
-	delete this._asteroid.subscriptions[this.id];
-};
- 
- 
- 
-//////////////////////
-// Subscribe method //
-//////////////////////
- 
-Asteroid.prototype.subscribe = function (name /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(name);
-	// Collect arguments into array
-	var params = Array.prototype.slice.call(arguments, 1);
-	var sub = new Subscription(name, params, this);
-	this.subscriptions[sub.id] = sub;
-	return sub;
-};
- 
-Asteroid.prototype._reEstablishSubscriptions = function () {
-	var subs = this.subscriptions;
-	for (var id in subs) {
-		subs[id] = new Subscription(subs[id]._name, subs[id]._params, this);
-	}
-};
- 
-return Asteroid;
- 
-}));
- 
- -
- - - - - - - - diff --git a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/dist/index.html b/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/dist/index.html deleted file mode 100644 index 3e2119c..0000000 --- a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/dist/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for dist/ - - - - - - - -
-

Code coverage report for dist/

-

- - Statements: 65.34% (313 / 479)      - - - Branches: 52.55% (72 / 137)      - - - Functions: 61.46% (59 / 96)      - - - Lines: 65.47% (309 / 472)      - - Ignored: none      -

-
All files » dist/
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
asteroid.js65.34%(313 / 479)52.55%(72 / 137)61.46%(59 / 96)65.47%(309 / 472)
-
-
- - - - - - - - diff --git a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/index.html b/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/index.html deleted file mode 100644 index 677914e..0000000 --- a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for All files - - - - - - - -
-

Code coverage report for All files

-

- - Statements: 65.34% (313 / 479)      - - - Branches: 52.55% (72 / 137)      - - - Functions: 61.46% (59 / 96)      - - - Lines: 65.47% (309 / 472)      - - Ignored: none      -

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
dist/65.34%(313 / 479)52.55%(72 / 137)61.46%(59 / 96)65.47%(309 / 472)
-
-
- - - - - - - - diff --git a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/prettify.css b/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/prettify.js b/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/prettify.js deleted file mode 100644 index ef51e03..0000000 --- a/test/coverage/Safari 7.0.3 (Mac OS X 10.9.2)/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/dist/asteroid.js.html b/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/dist/asteroid.js.html deleted file mode 100644 index d5c7a60..0000000 --- a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/dist/asteroid.js.html +++ /dev/null @@ -1,3505 +0,0 @@ - - - - Code coverage report for dist/asteroid.js - - - - - - - -
-

Code coverage report for dist/asteroid.js

-

- - Statements: 62.4% (317 / 508)      - - - Branches: 46.84% (74 / 158)      - - - Functions: 60.2% (59 / 98)      - - - Lines: 62.48% (313 / 501)      - - Ignored: none      -

-
All files » dist/ » asteroid.js
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466 -467 -468 -469 -470 -471 -472 -473 -474 -475 -476 -477 -478 -479 -480 -481 -482 -483 -484 -485 -486 -487 -488 -489 -490 -491 -492 -493 -494 -495 -496 -497 -498 -499 -500 -501 -502 -503 -504 -505 -506 -507 -508 -509 -510 -511 -512 -513 -514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526 -527 -528 -529 -530 -531 -532 -533 -534 -535 -536 -537 -538 -539 -540 -541 -542 -543 -544 -545 -546 -547 -548 -549 -550 -551 -552 -553 -554 -555 -556 -557 -558 -559 -560 -561 -562 -563 -564 -565 -566 -567 -568 -569 -570 -571 -572 -573 -574 -575 -576 -577 -578 -579 -580 -581 -582 -583 -584 -585 -586 -587 -588 -589 -590 -591 -592 -593 -594 -595 -596 -597 -598 -599 -600 -601 -602 -603 -604 -605 -606 -607 -608 -609 -610 -611 -612 -613 -614 -615 -616 -617 -618 -619 -620 -621 -622 -623 -624 -625 -626 -627 -628 -629 -630 -631 -632 -633 -634 -635 -636 -637 -638 -639 -640 -641 -642 -643 -644 -645 -646 -647 -648 -649 -650 -651 -652 -653 -654 -655 -656 -657 -658 -659 -660 -661 -662 -663 -664 -665 -666 -667 -668 -669 -670 -671 -672 -673 -674 -675 -676 -677 -678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -695 -696 -697 -698 -699 -700 -701 -702 -703 -704 -705 -706 -707 -708 -709 -710 -711 -712 -713 -714 -715 -716 -717 -718 -719 -720 -721 -722 -723 -724 -725 -726 -727 -728 -729 -730 -731 -732 -733 -734 -735 -736 -737 -738 -739 -740 -741 -742 -743 -744 -745 -746 -747 -748 -749 -750 -751 -752 -753 -754 -755 -756 -757 -758 -759 -760 -761 -762 -763 -764 -765 -766 -767 -768 -769 -770 -771 -772 -773 -774 -775 -776 -777 -778 -779 -780 -781 -782 -783 -784 -785 -786 -787 -788 -789 -790 -791 -792 -793 -794 -795 -796 -797 -798 -799 -800 -801 -802 -803 -804 -805 -806 -807 -808 -809 -810 -811 -812 -813 -814 -815 -816 -817 -818 -819 -820 -821 -822 -823 -824 -825 -826 -827 -828 -829 -830 -831 -832 -833 -834 -835 -836 -837 -838 -839 -840 -841 -842 -843 -844 -845 -846 -847 -848 -849 -850 -851 -852 -853 -854 -855 -856 -857 -858 -859 -860 -861 -862 -863 -864 -865 -866 -867 -868 -869 -870 -871 -872 -873 -874 -875 -876 -877 -878 -879 -880 -881 -882 -883 -884 -885 -886 -887 -888 -889 -890 -891 -892 -893 -894 -895 -896 -897 -898 -899 -900 -901 -902 -903 -904 -905 -906 -907 -908 -909 -910 -911 -912 -913 -914 -915 -916 -917 -918 -919 -920 -921 -922 -923 -924 -925 -926 -927 -928 -929 -930 -931 -932 -933 -934 -935 -936 -937 -938 -939 -940 -941 -942 -943 -944 -945 -946 -947 -948 -949 -950 -951 -952 -953 -954 -955 -956 -957 -958 -959 -960 -961 -962 -963 -964 -965 -966 -967 -968 -969 -970 -971 -972 -973 -974 -975 -976 -977 -978 -979 -980 -981 -982 -983 -984 -985 -986 -987 -988 -989 -990 -991 -992 -993 -994 -995 -996 -997 -998 -999 -1000 -1001 -1002 -1003 -1004 -1005 -1006 -1007 -1008 -1009 -1010 -1011 -1012 -1013 -1014 -1015 -1016 -1017 -1018 -1019 -1020 -1021 -1022 -1023 -1024 -1025 -1026 -1027 -1028 -1029 -1030 -1031 -1032 -1033 -1034 -1035 -1036 -1037 -1038 -1039 -1040 -1041 -1042 -1043 -1044 -1045 -1046 -1047 -1048 -1049 -1050 -1051 -1052 -1053 -1054 -1055 -1056 -1057 -1058 -1059 -1060 -1061 -10621 -1 -  -1 -  -  -1 -  -  -  -  -1 -1084 -  -  -1084 -1084 -  -  -9 -  -  -  -  -  -1075 -  -  -1075 -  -  -  -  -  -1 -  -1 -  -  -  -  -52 -52 -52 -  -  -  -  -  -  -  -  -  -315 -315 -4 -4 -4 -4 -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -46 -46 -368 -  -46 -  -  -1 -  -  -  -1 -  -  -  -  -  -1 -  -1 -770 -  -  -1 -468 -468 -7 -  -  -  -1 -  -  -  -  -  -  -1 -302 -302 -1 -  -  -  -  -  -  -  -1 -  -26 -  -25 -  -  -25 -1 -  -  -  -  -  -24 -  -  -  -  -  -  -25 -25 -25 -  -25 -  -  -1 -1 -  -  -  -  -  -  -  -1 -19 -  -  -19 -  -19 -  -  -1 -  -  -  -1 -  -1 -  -19 -  -  -  -  -  -  -  -  -19 -  -  -19 -  -  -19 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -1 -  -7 -  -6 -6 -  -  -6 -6 -6 -  -3 -  -2 -2 -  -  -1 -  -  -6 -  -1 -  -  -6 -  -6 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -540 -540 -540 -540 -540 -  -  -  -  -  -  -  -  -1 -33 -33 -33 -  -1 -  -  -  -  -  -  -  -1 -  -70 -2 -  -68 -  -68 -  -1 -  -1 -  -1 -68 -68 -  -68 -68 -48 -  -2 -2 -  -  -46 -  -  -68 -  -1 -  -70 -46 -  -70 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -8 -8 -  -2 -  -2 -  -  -8 -  -1 -  -1 -  -1 -8 -8 -  -8 -8 -3 -  -2 -  -2 -1 -1 -  -2 -  -  -1 -1 -  -  -8 -  -1 -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -10 -10 -1 -  -  -9 -2 -  -  -7 -  -7 -5 -  -7 -  -7 -  -1 -  -3 -3 -1 -1 -  -2 -  -2 -1 -1 -  -1 -  -  -1 -  -1 -7 -7 -  -7 -  -7 -  -  -  -7 -  -  -7 -3 -  -2 -2 -2 -2 -  -  -1 -1 -  -  -7 -  -1 -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -12 -12 -  -12 -12 -  -12 -  -  -  -12 -  -  -  -  -  -1 -1 -  -1 -12 -  -  -1 -  -12 -  -  -540 -  -  -  -  -  -540 -540 -675 -579 -579 -  -  -  -  -  -540 -540 -540 -470 -  -  -  -  -70 -  -  -  -  -1 -12 -12 -  -  -12 -  -12 -12 -  -  -  -  -1 -  -1 -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -1 -1 -1 -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -58 -  -15 -15 -  -15 -2 -  -  -58 -  -  -1 -1 -  -1 -  -303 -302 -  -301 -301 -  -301 -  -  -1 -  -18 -17 -17 -  -17 -  -  -1 -  -27 -  -26 -  -  -1 -  -73 -72 -  -  -1 -  -  -14 -  -  -14 -  -  -14 -14 -  -  -740 -740 -740 -170 -  -  -  -  -  -14 -  -  -2 -2 -2 -1 -  -  -14 -2 -  -  -  -14 -  -  -1 -15 -15 -15 -15 -221 -  -  -15 -  -  -1 -  -  -  -  -1 -  -  -  -  -  -1 -12 -12 -12 -  -12 -12 -  -12 -12 -12 -12 -  -1 -  -1 -2 -  -  -1 -1 -  -  -1 -2 -  -  -1 -1 -1 -  -1 -  -  -  -  -  -  -  -  -1 -  -14 -  -13 -  -13 -  -12 -12 -12 -12 -  -13 -  -  -1 -  -  -  -  -  -  -  -  -1 -  -  - 
(function (root, factory) {
-    Iif (typeof define === "function" && define.amd) {
-        define(factory);
-    } else Iif (typeof exports === "object") {
-        module.exports = factory();
-    } else {
-        root.Asteroid = factory();
-    }
-}(this, function () {
-"use strict";
- 
-function clone (obj) {
-	Iif (typeof EJSON !== "undefined") {
-		return EJSON.clone(obj);
-	}
-	var type = typeof obj;
-	switch (type) {
-		case "undefined":
-		case "function":
-			return undefined;
-		case "string":
-		case "number":
-		case "boolean":
-			return obj;
-		case "object":
-			Iif (obj === null) {
-				return null;
-			}
-			return JSON.parse(JSON.stringify(obj));
-		default:
-			return;
-	}
-}
- 
-var EventEmitter = function () {};
- 
-EventEmitter.prototype = {
- 
-	constructor: EventEmitter,
- 
-	on: function (name, handler) {
-		if (!this._events) this._events = {};
-		this._events[name] = this._events[name] || [];
-		this._events[name].push(handler);
-	},
- 
-	off: function (name, handler) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		this._events[name].splice(this._events[name].indexOf(handler), 1);
-	},
- 
-	_emit: function (name /* , arguments */) {
-		if (!this._events) this._events = {};
-		if (!this._events[name]) return;
-		var args = arguments;
-		var self = this;
-		this._events[name].forEach(function (handler) {
-			handler.apply(self, Array.prototype.slice.call(args, 1));
-		});
-	}
- 
-};
- 
-function formQs (obj) {
-	var qs = "";
-	for (var key in obj) {
-		qs += key + "=" + obj[key] + "&";
-	}
-	qs = qs.slice(0, -1);
-	return qs;
-}
- 
-function guid () {
-	var ret = "";
-	for (var i=0; i<8; i++) {
-		ret += Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
-	}
-	return ret;
-}
- 
-function isEmail (string) {
-	return string.indexOf("@") !== -1;
-}
- 
-function isEqual (obj1, obj2) {
-	var str1 = JSON.stringify(obj1);
-	var str2 = JSON.stringify(obj2);
-	return str1 === str2;
-}
- 
-var must = {};
- 
-must._toString = function (thing) {
-	return Object.prototype.toString.call(thing).slice(8, -1);
-};
- 
-must.beString = function (s) {
-	var type = this._toString(s);
-	if (type !== "String") {
-		throw new Error("Assertion failed: expected String, instead got " + type);
-	}
-};
- 
-must.beArray = function (o) {
-	var type = this._toString(o);
-	if (type !== "Array") {
-		throw new Error("Assertion failed: expected Array, instead got " + type);
-	}
-};
- 
-must.beObject = function (o) {
-	var type = this._toString(o);
-	if (type !== "Object") {
-		throw new Error("Assertion failed: expected Object, instead got " + type);
-	}
-};
- 
-//////////////////////////
-// Asteroid constructor //
-//////////////////////////
- 
-var Asteroid = function (host, ssl, socketInterceptFunction) {
-	// Assert arguments type
-	must.beString(host);
-	// Configure the instance
-	this._host = (ssl ? "https://" : "http://") + host;
-	// If SockJS is available, use it, otherwise, use WebSocket
-	// Note: SockJS is required for IE9 support
-	if (typeof SockJS === "function") {
-		this._ddpOptions = {
-			endpoint: (ssl ? "https://" : "http://") + host + "/sockjs",
-			SocketConstructor: SockJS,
-			socketInterceptFunction: socketInterceptFunction
-		};
-	} else {
-		this._ddpOptions = {
-			endpoint: (ssl ? "wss://" : "ws://") + host + "/websocket",
-			SocketConstructor: WebSocket,
-			socketInterceptFunction: socketInterceptFunction
-		};
-	}
-	// Reference containers
-	this.collections = {};
-	this.subscriptions = {};
-	this._subscriptionsCache = {};
-	// Init the instance
-	this._init();
-};
-// Asteroid instances are EventEmitter-s
-Asteroid.prototype = Object.create(EventEmitter.prototype);
-Asteroid.prototype.constructor = Asteroid;
- 
- 
- 
-////////////////////////////////
-// Establishes the connection //
-////////////////////////////////
- 
-Asteroid.prototype._init = function () {
-	var self = this;
-	// Creates the DDP instance, that will automatically
-	// connect to the DDP server.
-	self.ddp = new DDP(this._ddpOptions);
-	// Register handlers
-	self.ddp.on("connected", function () {
-		// Upon connection try resuming login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Subscribe to the meteor.loginServiceConfiguration
-		// collection, which holds the configuration options
-		// to login via third party services (oauth).
-		self.subscribe("meteor.loginServiceConfiguration");
-		// Emit the connected event
-		self._emit("connected");
-	});
-	self.ddp.on("reconnected", function () {
-		// Upon reconnection try resuming login
-		// Save the pormise it returns
-		self.resumeLoginPromise = self._tryResumeLogin();
-		// Re-establish all previously established (and still active) subscriptions
-		self._reEstablishSubscriptions();
-		// Emit the reconnected event
-		self._emit("reconnected");
-	});
-	self.ddp.on("added", function (data) {
-		self._onAdded(data);
-	});
-	self.ddp.on("changed", function (data) {
-		self._onChanged(data);
-	});
-	self.ddp.on("removed", function (data) {
-		self._onRemoved(data);
-	});
-};
- 
- 
- 
-///////////////////////////////////////
-// Handler for the ddp "added" event //
-///////////////////////////////////////
- 
-Asteroid.prototype._onAdded = function (data) {
-	// Get the name of the collection
-	var cName = data.collection;
-	// If the collection does not exist yet, create it
-	if (!this.collections[cName]) {
-		this.collections[cName] = new Asteroid._Collection(cName, this);
-	}
-	// data.fields can be undefined if the item added has only
-	// the _id field . To avoid errors down the line, ensure item
-	// is an object.
-	var item = data.fields || {};
-	item._id = data.id;
-	// Perform the remote insert
-	this.collections[cName]._remoteToLocalInsert(item);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "removed" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onRemoved = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// Perform the reomte remove
-	this.collections[data.collection]._remoteToLocalRemove(data.id);
-};
- 
- 
- 
-/////////////////////////////////////////
-// Handler for the ddp "changes" event //
-/////////////////////////////////////////
- 
-Asteroid.prototype._onChanged = function (data) {
-	// Check the collection exists to avoid exceptions
-	if (!this.collections[data.collection]) {
-		return;
-	}
-	// data.fields can be undefined if the update only
-	// removed some properties in the item. Make sure
-	// it's an object
-	if (!data.fields) {
-		data.fields = {};
-	}
-	// If there were cleared fields, explicitly set them
-	// to undefined in the data.fields object. This will
-	// cause those fields to be present in the for ... in
-	// loop the remote update method of the collection
-	// performs, causing then the fields to be actually
-	// cleared from the item
-	if (data.cleared) {
-		data.cleared.forEach(function (key) {
-			data.fields[key] = undefined;
-		});
-	}
-	// Perform the remote update
-	this.collections[data.collection]._remoteToLocalUpdate(data.id, data.fields);
-};
- 
- 
- 
- 
- 
- 
- 
-////////////////////////////
-// Call and apply methods //
-////////////////////////////
- 
-Asteroid.prototype.call = function (method /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(method);
-	// Get the parameters for apply
-	var params = Array.prototype.slice.call(arguments, 1);
-	// Call apply
-	return this.apply(method, params);
-};
- 
-Asteroid.prototype.apply = function (method, params) {
-	// Assert arguments type
-	must.beString(method);
-	// If no parameters are given, use an empty array
-	Eif (!Array.isArray(params)) {
-		params = [];
-	}
-	// Create the result and updated promises
-	var resultDeferred = Q.defer();
-	var updatedDeferred = Q.defer();
-	var onResult = function (err, res) {
-		// The onResult handler takes care of errors
-		if (err) {
-			// If errors ccur, reject both promises
-			resultDeferred.reject(err);
-			updatedDeferred.reject();
-		} else {
-			// Otherwise resolve the result one
-			resultDeferred.resolve(res);
-		}
-	};
-	var onUpdated = function () {
-		// Just resolve the updated promise
-		updatedDeferred.resolve();
-	};
-	// Perform the method call
-	this.ddp.method(method, params, onResult, onUpdated);
-	// Return an object containing both promises
-	return {
-		result: resultDeferred.promise,
-		updated: updatedDeferred.promise
-	};
-};
- 
- 
- 
-/////////////////////
-// Syntactic sugar //
-/////////////////////
- 
-Asteroid.prototype.getCollection = function (name) {
-	// Assert arguments type
-	must.beString(name);
-	// Only create the collection if it doesn't exist
-	if (!this.collections[name]) {
-		this.collections[name] = new Asteroid._Collection(name, this);
-	}
-	return this.collections[name];
-};
- 
-///////////////////////////////////////////
-// Removal and update suffix for backups //
-///////////////////////////////////////////
- 
-var mf_removal_suffix = "__del__";
-var mf_update_suffix = "__upd__";
-var is_backup = function (id) {
-	var l1 = mf_removal_suffix.length;
-	var l2 = mf_update_suffix.length;
-	var s1 = id.slice(-1 * l1);
-	var s2 = id.slice(-1 * l2);
-	return s1 === mf_removal_suffix || s2 === mf_update_suffix;
-};
- 
- 
- 
-/////////////////////////////////////////////
-// Collection class constructor definition //
-/////////////////////////////////////////////
- 
-var Collection = function (name, asteroidRef) {
-	this.name = name;
-	this.asteroid = asteroidRef;
-	this._set = new Set();
-};
-Collection.prototype.constructor = Collection;
- 
- 
- 
-///////////////////////////////////////////////
-// Insert-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalInsert = function (item) {
-	// If an item by that id already exists, raise an exception
-	if (this._set.contains(item._id)) {
-		throw new Error("Item " + item._id + " already exists");
-	}
-	this._set.put(item._id, item);
-	// Return a promise, just for api consistency
-	return Q(item._id);
-};
-Collection.prototype._remoteToLocalInsert = function (item) {
-	// The server is the SSOT, add directly
-	this._set.put(item._id, item);
-};
-Collection.prototype._localToRemoteInsert = function (item) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/insert";
-	self.asteroid.ddp.method(methodName, [item], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			self._set.del(item._id);
-			deferred.reject(err);
-		} else {
-			// Else resolve the promise
-			deferred.resolve(item._id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.insert = function (item) {
-	// If the time has no id, generate one for it
-	if (!item._id) {
-		item._id = guid();
-	}
-	return {
-		// Perform the local insert
-		local: this._localToLocalInsert(item),
-		// Send the insert request
-		remote: this._localToRemoteInsert(item)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Remove-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalRemove = function (id) {
-	// Check if the item exists in the database
-	var existing = this._set.get(id);
-	if (existing) {
-		// Create a backup of the object to delete
-		this._set.put(id + mf_removal_suffix, existing);
-		// Delete the object
-		this._set.del(id);
-	}
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalRemove = function (id) {
-	// The server is the SSOT, remove directly (item and backup)
-	this._set.del(id);
-};
-Collection.prototype._localToRemoteRemove = function (id) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/remove";
-	self.asteroid.ddp.method(methodName, [{_id: id}], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_removal_suffix);
-			// Ensure there is a backup
-			if (backup) {
-				self._set.put(id, backup);
-				self._set.del(id + mf_removal_suffix);
-			}
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_removal_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.remove = function (id) {
-	return {
-		// Perform the local remove
-		local: this._localToLocalRemove(id),
-		// Send the remove request
-		remote: this._localToRemoteRemove(id)
-	};
-};
- 
- 
- 
-///////////////////////////////////////////////
-// Update-related private and public methods //
-///////////////////////////////////////////////
- 
-Collection.prototype._localToLocalUpdate = function (id, fields) {
-	// Ensure the item actually exists
-	var existing = this._set.get(id);
-	if (!existing) {
-		throw new Error("Item " + id + " doesn't exist");
-	}
-	// Ensure the _id property won't get modified
-	if (fields._id && fields._id !== id) {
-		throw new Error("Modifying the _id of a document is not allowed");
-	}
-	// Create a backup
-	this._set.put(id + mf_update_suffix, existing);
-	// Perform the update
-	for (var field in fields) {
-		existing[field] = fields[field];
-	}
-	this._set.put(id, existing);
-	// Return a promise, just for api consistency
-	return Q(id);
-};
-Collection.prototype._remoteToLocalUpdate = function (id, fields) {
-	// Ensure the item exixts in the database
-	var existing = this._set.get(id);
-	if (!existing) {
-		console.warn("Server misbehaviour: item " + id + " doesn't exist");
-		return;
-	}
-	for (var field in fields) {
-		// Ensure the server is not trying to moify the item _id
-		if (field === "_id" && fields._id !== id) {
-			console.warn("Server misbehaviour: modifying the _id of a document is not allowed");
-			return;
-		}
-		existing[field] = fields[field];
-	}
-	// Perform the update
-	this._set.put(id, existing);
-};
-Collection.prototype._localToRemoteUpdate = function (id, fields) {
-	var self = this;
-	var deferred = Q.defer();
-	// Construct the name of the method we need to call
-	var methodName = "/" + self.name + "/update";
-	// Construct the selector
-	var sel = {
-		_id: id
-	};
-	// Construct the modifier
-	var mod = {
-		$set: fields
-	};
-	self.asteroid.ddp.method(methodName, [sel, mod], function (err, res) {
-		if (err) {
-			// On error restore the database and reject the promise
-			var backup = self._set.get(id + mf_update_suffix);
-			self._set.put(id, backup);
-			self._set.del(id + mf_update_suffix);
-			deferred.reject(err);
-		} else {
-			// Else, delete the (possible) backup and resolve the promise
-			self._set.del(id + mf_update_suffix);
-			deferred.resolve(id);
-		}
-	});
-	return deferred.promise;
-};
-Collection.prototype.update = function (id, fields) {
-	return {
-		// Perform the local update
-		local: this._localToLocalUpdate(id, fields),
-		// Send the update request
-		remote: this._localToRemoteUpdate(id, fields)
-	};
-};
- 
- 
- 
-//////////////////////////////
-// Reactive queries methods //
-//////////////////////////////
- 
-var ReactiveQuery = function (set) {
-	var self = this;
-	self.result = [];
- 
-	self._set = set;
-	self._getResult();
- 
-	self._set.on("put", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
-	self._set.on("del", function (id) {
-		self._getResult();
-		self._emit("change", id);
-	});
- 
-};
-ReactiveQuery.prototype = Object.create(EventEmitter.prototype);
-ReactiveQuery.constructor = ReactiveQuery;
- 
-ReactiveQuery.prototype._getResult = function () {
-	this.result = this._set.toArray();
-};
- 
-var getFilterFromSelector = function (selector) {
-	// Return the filter function
-	return function (id, item) {
- 
-		// Filter out backups
-		Iif (is_backup(id)) {
-			return false;
-		}
- 
-		// Get the value of the object from a compund key
-		// (e.g. "profile.name.first")
-		var getItemVal = function (item, key) {
-			return key.split(".").reduce(function (prev, curr) {
-				if (!prev) return prev;
-				prev = prev[curr];
-				return prev;
-			}, item);
-		};
- 
-		// Iterate all the keys in the selector. The first that
-		// doesn't match causes the item to be filtered out.
-		for (var key in selector) {
-			var itemVal = getItemVal(item, key);
-			if (itemVal !== selector[key]) {
-				return false;
-			}
-		}
- 
-		// At this point the item matches the selector
-		return true;
- 
-	};
-};
- 
-Collection.prototype.reactiveQuery = function (selectorOrFilter) {
-	var filter;
-	Iif (typeof selectorOrFilter === "function") {
-		filter = selectorOrFilter;
-	} else {
-		filter = getFilterFromSelector(selectorOrFilter);
-	}
-	var subset = this._set.filter(filter);
-	return new ReactiveQuery(subset);
-};
- 
- 
- 
-Asteroid._Collection = Collection;
- 
-Asteroid.prototype._getOauthClientId = function (serviceName) {
-	var loginConfigCollectionName = "meteor_accounts_loginServiceConfiguration";
-	var loginConfigCollection = this.collections[loginConfigCollectionName];
-	var service = loginConfigCollection.reactiveQuery({service: serviceName}).result[0];
-	return service.clientId || service.consumerKey || service.appId;
-};
- 
-Asteroid.prototype._initOauthLogin = function (service, credentialToken, loginUrl) {
-	// Open the oauth oauth
-	var popup = window.open(loginUrl, "_blank", "location=no,toolbar=no");	
-	if (popup.focus) popup.focus();
-	var self = this;
-	return Q()
-		.then(function () {
-			var deferred = Q.defer();
-			if (window.cordova) {
-				// We're using Cordova's InAppBrowser plugin.
-				// Each time the popup fires the loadstop event,
-				// check if the hash fragment contains the
-				// credentialSecret we need to complete the
-				// authentication flow
-				popup.addEventListener("loadstop", function (e) { 
-					// If the url does not contain the # character
-					// it means the loadstop event refers to an
-					// intermediate page, therefore we ignore it
-					if (e.url.indexOf("#") === -1) {
-						return;
-					}
-					// Find the position of the # character
-					var hashPosition = e.url.indexOf("#");
-					var hashes = e.url.slice(hashPosition).split("&");
-					// Once again, check that the fragment belongs to the
-					// final oauth page (the one we're looking for)
-					if (
-						!hashes[0] ||
-						hashes[0].split("=")[0] !== "credentialToken" ||
-						!hashes[1] ||
-						hashes[1].split("=")[0] !== "credentialSecret"
-					) {
-						return;
-					}
-					// Retrieve the two tokens
-					var hashCredentialToken = hashes[0].split("=")[1];
-					var hashCredentialSecret = hashes[1].split("=")[1];
-					// Check if the credentialToken corresponds. We could
-					// use this as a way to communicate possible errors by
-					// purposefully mismatching the credentialToken with
-					// the error message. Too much of a hack?
-					if (hashCredentialToken === credentialToken) {
-						// Resolve the promise with the secret
-						deferred.resolve(hashCredentialSecret);
-						// Close the popup
-						popup.close();
-					}
-				});
-			} else {
-				var request = JSON.stringify({
-					credentialToken: credentialToken
-				});
-				var intervalId = setInterval(function () {
-					popup.postMessage(request, self._host);
-				}, 100);
-				window.addEventListener("message", function (e) {
-					var message;
-					try {
-						message = JSON.parse(e.data);
-					} catch (err) {
-						return;
-					}
-					if (e.origin === self._host) {
-						if (message.credentialToken === credentialToken) {
-							clearInterval(intervalId);
-							deferred.resolve(message.credentialSecret);
-						}
-						if (message.error) {
-							clearInterval(intervalId);
-							deferred.reject(message.error);
-						}
-					}
-				});
-			}
-			return deferred.promise;
-		})
-		.then(function (credentialSecret) {
-			var deferred = Q.defer();
-			var loginParameters = {
-				oauth: {
-					credentialToken: credentialToken,
-					credentialSecret: credentialSecret
-				}
-			};
-			self.ddp.method("login", [loginParameters], function (err, res) {
-				if (err) {
-					delete self.userId;
-					delete self.loggedIn;
-					delete localStorage[self._host + "__login_token__"];
-					deferred.reject(err);
-					self._emit("loginError", err);
-				} else {
-					self.userId = res.id;
-					self.loggedIn = true;
-					localStorage[self._host + "__login_token__"] = res.token;
-					self._emit("login", res.id);
-					deferred.resolve(res.id);
-				}
-			});
-			return deferred.promise;
-		});
-};
- 
-Asteroid.prototype._tryResumeLogin = function () {
-	var self = this;
-	var deferred = Q.defer();
-	var token = localStorage[self._host + "__login_token__"];
-	Eif (!token) {
-		deferred.reject("No login token");
-		return deferred.promise;
-	}
-	var loginParameters = {
-		resume: token
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("loginError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithFacebook = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("facebook"),
-		redirect_uri:	this._host + "/_oauth/facebook?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://www.facebook.com/dialog/oauth?" + formQs(query);
-	return this._initOauthLogin("facebook", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGoogle = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		response_type:	"code",
-		client_id:		this._getOauthClientId("google"),
-		redirect_uri:	this._host + "/_oauth/google?close",
-		state:			credentialToken,
-		scope:			scope || "openid email"
-	};
-	var loginUrl = "https://accounts.google.com/o/oauth2/auth?" + formQs(query);
-	return this._initOauthLogin("google", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithGithub = function (scope) {
-	var credentialToken = guid();
-	var query = {
-		client_id:		this._getOauthClientId("github"),
-		redirect_uri:	this._host + "/_oauth/github?close",
-		state:			credentialToken,
-		scope:			scope || "email"
-	};
-	var loginUrl = "https://github.com/login/oauth/authorize?" + formQs(query);
-	return this._initOauthLogin("github", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.loginWithTwitter = function (scope) {
-	var credentialToken = guid();
-	var callbackUrl = this._host + "/_oauth/twitter?close&state=" + credentialToken;
-	var query = {
-		requestTokenAndRedirect:	encodeURIComponent(callbackUrl),
-		state:						credentialToken
-	};
-	var loginUrl = this._host + "/_oauth/twitter/?" + formQs(query);
-	return this._initOauthLogin("twitter", credentialToken, loginUrl);
-};
- 
-Asteroid.prototype.createUser = function (usernameOrEmail, password, profile) {
-	var self = this;
-	var deferred = Q.defer();
-	var options = {
-		username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-		email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined,
-		password: password,
-		profile: profile
-	};
-	self.ddp.method("createUser", [options], function (err, res) {
-		if (err) {
-			self._emit("createUserError", err);
-			deferred.reject(err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("createUser", res.id);
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.loginWithPassword = function (usernameOrEmail, password) {
-	var self = this;
-	var deferred = Q.defer();
-	var loginParameters = {
-		password: password,
-		user: {
-			username: isEmail(usernameOrEmail) ? undefined : usernameOrEmail,
-			email: isEmail(usernameOrEmail) ? usernameOrEmail : undefined
-		}
-	};
-	self.ddp.method("login", [loginParameters], function (err, res) {
-		if (err) {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			deferred.reject(err);
-			self._emit("loginError", err);
-		} else {
-			self.userId = res.id;
-			self.loggedIn = true;
-			localStorage[self._host + "__login_token__"] = res.token;
-			self._emit("login", res.id);
-			deferred.resolve(res.id);
-		}
-	});
-	return deferred.promise;
-};
- 
-Asteroid.prototype.logout = function () {
-	var self = this;
-	var deferred = Q.defer();
-	self.ddp.method("logout", [], function (err, res) {
-		if (err) {
-			self._emit("logoutError", err);
-			deferred.reject(err);
-		} else {
-			delete self.userId;
-			delete self.loggedIn;
-			delete localStorage[self._host + "__login_token__"];
-			self._emit("logout");
-			deferred.resolve();
-		}
-	});
-	return deferred.promise;
-};
- 
-var Set = function (readonly) {
-	// Allow readonly sets
-	if (readonly) {
-		// Make the put and del methods private
-		this._put = this.put;
-		this._del = this.del;
-		// Replace them with a throwy function
-		this.put = this.del = function () {
-			throw new Error("Attempt to modify readonly set");
-		};
-	}
-	this._items = {};
-};
-// Inherit from EventEmitter
-Set.prototype = Object.create(EventEmitter.prototype);
-Set.constructor = Set;
- 
-Set.prototype.put = function (id, item) {
-	// Assert arguments type
-	must.beString(id);
-	must.beObject(item);
-	// Save a clone to avoid collateral damage
-	this._items[id] = clone(item);
-	this._emit("put", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.del = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	delete this._items[id];
-	this._emit("del", id);
-	// Return the set instance to allow method chainging
-	return this;
-};
- 
-Set.prototype.get = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	// Return a clone to avoid collateral damage
-	return clone(this._items[id]);
-};
- 
-Set.prototype.contains = function (id) {
-	// Assert arguments type
-	must.beString(id);
-	return !!this._items[id];
-};
- 
-Set.prototype.filter = function (belongFn) {
- 
-	// Creates the subset
-	var sub = new Set(true);
- 
-	// Keep a reference to the _items hash
-	var items = this._items;
- 
-	// Performs the initial puts
-	var ids = Object.keys(items);
-	ids.forEach(function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._items[id] = items[id];
-		}
-	});
- 
-	// Listens to the put and del events
-	// to automatically update the subset
-	this.on("put", function (id) {
-		// Clone the element to avoid
-		// collateral damage
-		var itemClone = clone(items[id]);
-		var belongs = belongFn(id, itemClone);
-		if (belongs) {
-			sub._put(id, items[id]);
-		}
-	});
-	this.on("del", function (id) {
-		sub._del(id);
-	});
- 
-	// Returns the subset
-	return sub;
-};
- 
-Set.prototype.toArray = function () {
-	var array = [];
-	var items = this._items;
-	var ids = Object.keys(this._items);
-	ids.forEach(function (id) {
-		array.push(items[id]);
-	});
-	// Return a clone to avoid collateral damage
-	return clone(array);
-};
- 
-Set.prototype.toHash = function () {
-	// Return a clone to avoid collateral damage
-	return clone(this._items);
-};
- 
-Asteroid.Set = Set;
- 
-////////////////////////
-// Subscription class //
-////////////////////////
- 
-var Subscription = function (name, params, asteroid) {
-	this._name = name;
-	this._params = params;
-	this._asteroid = asteroid;
-	// Subscription promises
-	this._ready = Q.defer();
-	this.ready = this._ready.promise;
-	// Subscribe via DDP
-	var or = this._onReady.bind(this);
-	var os = this._onStop.bind(this);
-	var oe = this._onError.bind(this);
-	this.id = asteroid.ddp.sub(name, params, or, os, oe);
-};
-Subscription.constructor = Subscription;
- 
-Subscription.prototype.stop = function () {
-	this._asteroid.ddp.unsub(this.id);
-};
- 
-Subscription.prototype._onReady = function () {
-	this._ready.resolve(this.id);
-};
- 
-Subscription.prototype._onStop = function () {
-	delete this._asteroid.subscriptions[this.id];
-};
- 
-Subscription.prototype._onError = function (err) {
-	Eif (this.ready.isPending()) {
-		this._ready.reject(err);
-	}
-	delete this._asteroid.subscriptions[this.id];
-};
- 
- 
- 
-//////////////////////
-// Subscribe method //
-//////////////////////
- 
-Asteroid.prototype.subscribe = function (name /* , param1, param2, ... */) {
-	// Assert arguments type
-	must.beString(name);
-	// Hash the arguments to get a key for _subscriptionsCache
-	var hash = JSON.stringify(arguments);
-	// Only subscribe if there is no cached subscription
-	if (!this._subscriptionsCache[hash]) {
-		// Collect arguments into array
-		var params = Array.prototype.slice.call(arguments, 1);
-		var sub = new Subscription(name, params, this);
-		this._subscriptionsCache[hash] = sub;
-		this.subscriptions[sub.id] = sub;
-	}
-	return this._subscriptionsCache[hash];
-};
- 
-Asteroid.prototype._reEstablishSubscriptions = function () {
-	var subs = this.subscriptions;
-	for (var id in subs) {
-		if (subs.hasOwnProperty(id)) {
-			subs[id] = new Subscription(subs[id]._name, subs[id]._params, this);
-		}
-	}
-};
- 
-return Asteroid;
- 
-}));
- 
- -
- - - - - - - - diff --git a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/dist/index.html b/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/dist/index.html deleted file mode 100644 index a87ba42..0000000 --- a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/dist/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for dist/ - - - - - - - -
-

Code coverage report for dist/

-

- - Statements: 62.4% (317 / 508)      - - - Branches: 46.84% (74 / 158)      - - - Functions: 60.2% (59 / 98)      - - - Lines: 62.48% (313 / 501)      - - Ignored: none      -

-
All files » dist/
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
asteroid.js62.4%(317 / 508)46.84%(74 / 158)60.2%(59 / 98)62.48%(313 / 501)
-
-
- - - - - - - - diff --git a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/index.html b/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/index.html deleted file mode 100644 index 4605337..0000000 --- a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for All files - - - - - - - -
-

Code coverage report for All files

-

- - Statements: 62.4% (317 / 508)      - - - Branches: 46.84% (74 / 158)      - - - Functions: 60.2% (59 / 98)      - - - Lines: 62.48% (313 / 501)      - - Ignored: none      -

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
dist/62.4%(317 / 508)46.84%(74 / 158)60.2%(59 / 98)62.48%(313 / 501)
-
-
- - - - - - - - diff --git a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/prettify.css b/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/prettify.js b/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/prettify.js deleted file mode 100644 index ef51e03..0000000 --- a/test/coverage/Safari 7.0.4 (Mac OS X 10.9.3)/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/dist/asteroid.js.html b/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/dist/asteroid.js.html index 151650e..cfcb85f 100644 --- a/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/dist/asteroid.js.html +++ b/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/dist/asteroid.js.html @@ -1290,11 +1290,11 @@

    1 -1136 +993     -1136 -1136 +993 +993     9 @@ -1303,10 +1303,10 @@

      -1127 +984     -1127 +984       @@ -1331,8 +1331,8 @@

      -319 -319 +308 +308 4 4 4 @@ -1352,11 +1352,11 @@

    1 -50 -50 -400 +39 +39 +312   -50 +39     1 @@ -1372,12 +1372,12 @@

1   1 -782 +749     1 -476 -476 +454 +454 7     @@ -1390,8 +1390,8 @@

    1 -306 -306 +295 +295 1     @@ -1619,11 +1619,11 @@

1 1 1 -588 -588 -588 -588 -588 +456 +456 +456 +456 +456       @@ -1647,40 +1647,40 @@

  1   -74 +63 2   -72 +61   -72 +61   1   1   1 -72 -72 +61 +61   -72 -72 -52 +61 +61 +41   2 2     -50 +39     -72 +61   1   -74 -50 +63 +39   -74 +63       @@ -1858,31 +1858,31 @@

12     -588 +456           -588 -588 -735 -642 -642 +456 +456 +570 +477 +477           -588 -588 -588 -511 +456 +456 +456 +395         -77 +61       @@ -2180,13 +2180,13 @@

  1   -307 -306 +296 +295   -305 -305 +294 +294   -305 +294     1 @@ -2207,8 +2207,8 @@

  1   -77 -76 +66 +65     1 @@ -2224,10 +2224,10 @@

14     -788 -788 -788 -177 +656 +656 +656 +161       @@ -2255,7 +2255,7 @@

15 15 15 -228 +212     15 @@ -3407,7 +3407,7 @@

diff --git a/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/dist/index.html b/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/dist/index.html index 8400f0b..dcdff1a 100644 --- a/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/dist/index.html +++ b/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/dist/index.html @@ -249,7 +249,7 @@

diff --git a/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/index.html b/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/index.html index 79d64c2..57a8fd3 100644 --- a/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/index.html +++ b/test/coverage/Safari 7.0.5 (Mac OS X 10.9.4)/index.html @@ -249,7 +249,7 @@