ember-source 1.11.0.beta.1 → 1.11.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ember-source might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de13b20eb2c44c4ecad858b9883d741260e783a2
4
- data.tar.gz: c261454ab72f89050e7f8aa06013e827071fb1e0
3
+ metadata.gz: 265b52de5995e8c2036b256f4149d1f26cbe68af
4
+ data.tar.gz: 198d1a29161fa873c47bdc6eee0e2a4bfafb75ae
5
5
  SHA512:
6
- metadata.gz: 23d9023020986d9435a0ae69fcdd89071a6a8326252748e3cb477dd23810211e0babe17a743ce5678e37d01fc00dbbc6303dffeef3261b65188634d95950d21e
7
- data.tar.gz: 5eb59c006601d732c91af0b8329689145eb95480411da66905688478f620794f776059cf6ac76d8d688ad3c66f501a8038e876fc78ba5367d1585e088f1badf1
6
+ metadata.gz: 28279c4ebe049591436ae3ecd9052bc44dd2902dc96603abb73edec2e1d39b5ea8939904f67a7a88775acf1eba1adef07458c0f094ea7d64b1f7d57e3a7124a8
7
+ data.tar.gz: d48ab306b653a91ec72eabd4424a9639d0fc282bbb56ae1b04eb3d1c2bac859d0ef498ea860a1adec4d2ab2b52092de1850eaa1d61708199cf733f5efc1e0b92
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.11.0-beta.1
1
+ 1.11.0-beta.2
@@ -5,7 +5,7 @@
5
5
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
6
6
  * @license Licensed under MIT license
7
7
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
- * @version 1.11.0-beta.1
8
+ * @version 1.11.0-beta.2
9
9
  */
10
10
 
11
11
  (function() {
@@ -1485,6 +1485,8 @@ enifed('container/registry', ['exports', 'ember-metal/core', 'ember-metal/dictio
1485
1485
 
1486
1486
  var VALID_FULL_NAME_REGEXP = /^[^:]+.+:[^:]+$/;
1487
1487
 
1488
+ var instanceInitializersFeatureEnabled;
1489
+
1488
1490
  /**
1489
1491
  A lightweight registry used to store factory and option information keyed
1490
1492
  by type.
@@ -1651,7 +1653,7 @@ enifed('container/registry', ['exports', 'ember-metal/core', 'ember-metal/dictio
1651
1653
 
1652
1654
  lookup: function(fullName, options) {
1653
1655
 
1654
- if (Ember['default'].FEATURES.isEnabled('ember-application-instance-initializers')) {
1656
+ if (instanceInitializersFeatureEnabled) {
1655
1657
  }
1656
1658
 
1657
1659
  return this._defaultContainer.lookup(fullName, options);
@@ -1659,7 +1661,7 @@ enifed('container/registry', ['exports', 'ember-metal/core', 'ember-metal/dictio
1659
1661
 
1660
1662
  lookupFactory: function(fullName) {
1661
1663
 
1662
- if (Ember['default'].FEATURES.isEnabled('ember-application-instance-initializers')) {
1664
+ if (instanceInitializersFeatureEnabled) {
1663
1665
  }
1664
1666
 
1665
1667
  return this._defaultContainer.lookupFactory(fullName);
@@ -2257,12 +2259,12 @@ enifed('ember-metal', ['exports', 'ember-metal/core', 'ember-metal/merge', 'embe
2257
2259
 
2258
2260
  var EmberInstrumentation = Ember['default'].Instrumentation = {};
2259
2261
  EmberInstrumentation.instrument = instrumentation.instrument;
2260
- EmberInstrumentation.subscribe = streams__utils.subscribe;
2261
- EmberInstrumentation.unsubscribe = streams__utils.unsubscribe;
2262
+ EmberInstrumentation.subscribe = instrumentation.subscribe;
2263
+ EmberInstrumentation.unsubscribe = instrumentation.unsubscribe;
2262
2264
  EmberInstrumentation.reset = instrumentation.reset;
2263
2265
 
2264
2266
  Ember['default'].instrument = instrumentation.instrument;
2265
- Ember['default'].subscribe = streams__utils.subscribe;
2267
+ Ember['default'].subscribe = instrumentation.subscribe;
2266
2268
 
2267
2269
  Ember['default']._Cache = Cache['default'];
2268
2270
 
@@ -2412,23 +2414,7 @@ enifed('ember-metal', ['exports', 'ember-metal/core', 'ember-metal/merge', 'embe
2412
2414
 
2413
2415
  Ember['default'].merge = merge['default'];
2414
2416
 
2415
- if (Ember['default'].FEATURES.isEnabled('ember-metal-stream')) {
2416
- Ember['default'].stream = {
2417
- Stream: Stream['default'],
2418
-
2419
- isStream: streams__utils.isStream,
2420
- subscribe: streams__utils.subscribe,
2421
- unsubscribe: streams__utils.unsubscribe,
2422
- read: streams__utils.read,
2423
- readHash: streams__utils.readHash,
2424
- readArray: streams__utils.readArray,
2425
- scanArray: streams__utils.scanArray,
2426
- scanHash: streams__utils.scanHash,
2427
- concat: streams__utils.concat,
2428
- chain: streams__utils.chain
2429
- };
2430
- }
2431
-
2417
+
2432
2418
  /**
2433
2419
  A function may be assigned to `Ember.onerror` to be called when Ember
2434
2420
  internals encounter an error. This is useful for specialized error handling
@@ -3694,27 +3680,13 @@ enifed('ember-metal/computed', ['exports', 'ember-metal/property_set', 'ember-me
3694
3680
  */
3695
3681
  function ComputedProperty(config, opts) {
3696
3682
  this.isDescriptor = true;
3697
- if (Ember.FEATURES.isEnabled("new-computed-syntax")) {
3698
- if (typeof config === "function") {
3699
- config.__ember_arity = config.length;
3700
- this._getter = config;
3701
- if (config.__ember_arity > 1) {
3702
- this._setter = config;
3703
- }
3704
- } else {
3705
- this._getter = config.get;
3706
- this._setter = config.set;
3707
- if (this._setter && this._setter.__ember_arity === undefined) {
3708
- this._setter.__ember_arity = this._setter.length;
3709
- }
3710
- }
3711
- } else {
3683
+
3712
3684
  config.__ember_arity = config.length;
3713
3685
  this._getter = config;
3714
3686
  if (config.__ember_arity > 1) {
3715
3687
  this._setter = config;
3716
3688
  }
3717
- }
3689
+
3718
3690
 
3719
3691
  this._dependentKeys = undefined;
3720
3692
  this._suspended = undefined;
@@ -4156,14 +4128,12 @@ enifed('ember-metal/computed', ['exports', 'ember-metal/property_set', 'ember-me
4156
4128
 
4157
4129
  var cp = new ComputedProperty(func);
4158
4130
  // jscs:disable
4159
- if (Ember.FEATURES.isEnabled("new-computed-syntax")) {
4160
- // Empty block on purpose
4161
- } else {
4131
+
4162
4132
  // jscs:enable
4163
4133
  if (typeof func !== "function") {
4164
4134
  throw new EmberError['default']("Computed Property declared without a property function");
4165
4135
  }
4166
- }
4136
+
4167
4137
 
4168
4138
  if (args) {
4169
4139
  cp.property.apply(cp, args);
@@ -4975,7 +4945,7 @@ enifed('ember-metal/core', ['exports'], function (exports) {
4975
4945
 
4976
4946
  @class Ember
4977
4947
  @static
4978
- @version 1.11.0-beta.1
4948
+ @version 1.11.0-beta.2
4979
4949
  */
4980
4950
 
4981
4951
  if ('undefined' === typeof Ember) {
@@ -5003,10 +4973,10 @@ enifed('ember-metal/core', ['exports'], function (exports) {
5003
4973
  /**
5004
4974
  @property VERSION
5005
4975
  @type String
5006
- @default '1.11.0-beta.1'
4976
+ @default '1.11.0-beta.2'
5007
4977
  @static
5008
4978
  */
5009
- Ember.VERSION = '1.11.0-beta.1';
4979
+ Ember.VERSION = '1.11.0-beta.2';
5010
4980
 
5011
4981
  /**
5012
4982
  Standard environmental variables. You can define these in a global `EmberENV`
@@ -16085,7 +16055,7 @@ enifed('ember-runtime/mixins/enumerable', ['exports', 'ember-metal/core', 'ember
16085
16055
 
16086
16056
  /**
16087
16057
  Returns an array with all of the items in the enumeration where the passed
16088
- function returns false for. This method is the inverse of filter().
16058
+ function returns true. This method is the inverse of filter().
16089
16059
 
16090
16060
  The callback method you provide should have the following signature (all
16091
16061
  parameters are optional):
@@ -5,7 +5,7 @@
5
5
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
6
6
  * @license Licensed under MIT license
7
7
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
- * @version 1.11.0-beta.1
8
+ * @version 1.11.0-beta.2
9
9
  */
10
10
 
11
11
  (function() {
@@ -133,7 +133,7 @@ enifed('ember-metal/core', ['exports'], function (exports) {
133
133
 
134
134
  @class Ember
135
135
  @static
136
- @version 1.11.0-beta.1
136
+ @version 1.11.0-beta.2
137
137
  */
138
138
 
139
139
  if ('undefined' === typeof Ember) {
@@ -161,10 +161,10 @@ enifed('ember-metal/core', ['exports'], function (exports) {
161
161
  /**
162
162
  @property VERSION
163
163
  @type String
164
- @default '1.11.0-beta.1'
164
+ @default '1.11.0-beta.2'
165
165
  @static
166
166
  */
167
- Ember.VERSION = '1.11.0-beta.1';
167
+ Ember.VERSION = '1.11.0-beta.2';
168
168
 
169
169
  /**
170
170
  Standard environmental variables. You can define these in a global `EmberENV`
@@ -209,7 +209,7 @@ enifed('ember-metal/core', ['exports'], function (exports) {
209
209
  Ember.FEATURES = Ember.ENV.FEATURES;
210
210
 
211
211
  if (!Ember.FEATURES) {
212
- Ember.FEATURES = {"features-stripped-test":null,"ember-routing-named-substates":true,"ember-metal-injected-properties":true,"mandatory-setter":true,"ember-htmlbars":true,"ember-htmlbars-block-params":true,"ember-htmlbars-component-generation":null,"ember-htmlbars-component-helper":true,"ember-htmlbars-inline-if-helper":true,"ember-htmlbars-attribute-syntax":true,"ember-routing-transitioning-classes":true,"new-computed-syntax":null,"ember-testing-checkbox-helpers":null,"ember-metal-stream":null,"ember-htmlbars-each-with-index":true,"ember-application-instance-initializers":null,"ember-application-initializer-context":null,"ember-router-willtransition":true,"ember-application-visit":null}; //jshint ignore:line
212
+ Ember.FEATURES = {"features-stripped-test":false,"ember-routing-named-substates":true,"mandatory-setter":true,"ember-htmlbars-component-generation":false,"ember-htmlbars-component-helper":true,"ember-htmlbars-inline-if-helper":true,"ember-htmlbars-attribute-syntax":true,"ember-routing-transitioning-classes":true,"new-computed-syntax":false,"ember-testing-checkbox-helpers":false,"ember-metal-stream":false,"ember-htmlbars-each-with-index":true,"ember-application-instance-initializers":false,"ember-application-initializer-context":false,"ember-router-willtransition":true,"ember-application-visit":false}; //jshint ignore:line
213
213
  }
214
214
 
215
215
  /**
@@ -345,7 +345,7 @@ enifed('ember-template-compiler/compat', ['ember-metal/core', 'ember-template-co
345
345
  EmberHandlebars.template = template['default'];
346
346
 
347
347
  });
348
- enifed('ember-template-compiler/compat/precompile', ['exports'], function (exports) {
348
+ enifed('ember-template-compiler/compat/precompile', ['exports', 'ember-template-compiler/system/compile_options'], function (exports, compileOptions) {
349
349
 
350
350
  'use strict';
351
351
 
@@ -353,7 +353,6 @@ enifed('ember-template-compiler/compat/precompile', ['exports'], function (expor
353
353
  @module ember
354
354
  @submodule ember-template-compiler
355
355
  */
356
-
357
356
  var compile, compileSpec;
358
357
 
359
358
  exports['default'] = function(string) {
@@ -371,7 +370,7 @@ enifed('ember-template-compiler/compat/precompile', ['exports'], function (expor
371
370
  var asObject = arguments[1] === undefined ? true : arguments[1];
372
371
  var compileFunc = asObject ? compile : compileSpec;
373
372
 
374
- return compileFunc(string);
373
+ return compileFunc(string, compileOptions['default']());
375
374
  }
376
375
 
377
376
  });
@@ -594,11 +593,10 @@ enifed('ember-template-compiler/system/compile_options', ['exports', 'ember-meta
594
593
 
595
594
  exports['default'] = function() {
596
595
  var disableComponentGeneration = true;
597
- if (Ember['default'].FEATURES.isEnabled('ember-htmlbars-component-generation')) {
598
- disableComponentGeneration = false;
599
- }
600
-
596
+
601
597
  return {
598
+ revision: 'Ember@1.11.0-beta.2',
599
+
602
600
  disableComponentGeneration: disableComponentGeneration,
603
601
 
604
602
  plugins: plugins['default']
@@ -671,10 +669,12 @@ enifed("htmlbars-compiler",
671
669
  function(__dependency1__, __exports__) {
672
670
  "use strict";
673
671
  var compile = __dependency1__.compile;
674
- var compilerSpec = __dependency1__.compilerSpec;
672
+ var compileSpec = __dependency1__.compileSpec;
673
+ var template = __dependency1__.template;
675
674
 
676
675
  __exports__.compile = compile;
677
- __exports__.compilerSpec = compilerSpec;
676
+ __exports__.compileSpec = compileSpec;
677
+ __exports__.template = template;
678
678
  });
679
679
  enifed("htmlbars-compiler/compiler",
680
680
  ["../htmlbars-syntax/parser","./template-compiler","exports"],
@@ -685,6 +685,37 @@ enifed("htmlbars-compiler/compiler",
685
685
  var TemplateCompiler = __dependency2__["default"];
686
686
 
687
687
  /*
688
+ * Compile a string into a template spec string. The template spec is a string
689
+ * representation of a template. Usually, you would use compileSpec for
690
+ * pre-compilation of a template on the server.
691
+ *
692
+ * Example usage:
693
+ *
694
+ * var templateSpec = compileSpec("Howdy {{name}}");
695
+ * // This next step is basically what plain compile does
696
+ * var template = new Function("return " + templateSpec)();
697
+ *
698
+ * @method compileSpec
699
+ * @param {String} string An HTMLBars template string
700
+ * @return {TemplateSpec} A template spec string
701
+ */
702
+ function compileSpec(string, options) {
703
+ var ast = preprocess(string, options);
704
+ var compiler = new TemplateCompiler(options);
705
+ var program = compiler.compile(ast);
706
+ return program;
707
+ }
708
+
709
+ __exports__.compileSpec = compileSpec;/*
710
+ * @method template
711
+ * @param {TemplateSpec} templateSpec A precompiled template
712
+ * @return {Template} A template spec string
713
+ */
714
+ function template(templateSpec) {
715
+ return new Function("return " + templateSpec)();
716
+ }
717
+
718
+ __exports__.template = template;/*
688
719
  * Compile a string into a template rendering function
689
720
  *
690
721
  * Example usage:
@@ -711,13 +742,12 @@ enifed("htmlbars-compiler/compiler",
711
742
  * var domFragment = template(context, env, contextualElement);
712
743
  *
713
744
  * @method compile
714
- * @param {String} string An htmlbars template string
745
+ * @param {String} string An HTMLBars template string
715
746
  * @param {Object} options A set of options to provide to the compiler
716
- * @return {Function} A function for rendering the template
747
+ * @return {Template} A function for rendering the template
717
748
  */
718
749
  function compile(string, options) {
719
- var program = compileSpec(string, options);
720
- return new Function("return " + program)();
750
+ return template(compileSpec(string, options));
721
751
  }
722
752
 
723
753
  __exports__.compile = compile;/*
@@ -742,7 +772,11 @@ enifed("htmlbars-compiler/compiler",
742
772
  return program;
743
773
  }
744
774
 
745
- __exports__.compileSpec = compileSpec;
775
+ __exports__.compileSpec = compileSpec;function template(program) {
776
+ return new Function("return " + program)();
777
+ }
778
+
779
+ __exports__.template = template;
746
780
  });
747
781
  enifed("htmlbars-compiler/fragment-javascript-compiler",
748
782
  ["./utils","../htmlbars-util/quoting","exports"],
@@ -875,14 +909,14 @@ enifed("htmlbars-compiler/fragment-opcode-compiler",
875
909
  this.opcodes.push([type, params]);
876
910
  };
877
911
 
878
- FragmentOpcodeCompiler.prototype.text = function(text, childIndex, childCount, isSingleRoot) {
912
+ FragmentOpcodeCompiler.prototype.text = function(text) {
879
913
  this.opcode('createText', [text.chars]);
880
- if (!isSingleRoot) { this.opcode('appendChild'); }
914
+ this.opcode('appendChild');
881
915
  };
882
916
 
883
- FragmentOpcodeCompiler.prototype.comment = function(comment, childIndex, childCount, isSingleRoot) {
917
+ FragmentOpcodeCompiler.prototype.comment = function(comment) {
884
918
  this.opcode('createComment', [comment.value]);
885
- if (!isSingleRoot) { this.opcode('appendChild'); }
919
+ this.opcode('appendChild');
886
920
  };
887
921
 
888
922
  FragmentOpcodeCompiler.prototype.openElement = function(element) {
@@ -890,32 +924,39 @@ enifed("htmlbars-compiler/fragment-opcode-compiler",
890
924
  forEach(element.attributes, this.attribute, this);
891
925
  };
892
926
 
893
- FragmentOpcodeCompiler.prototype.closeElement = function(element, childIndex, childCount, isSingleRoot) {
894
- if (!isSingleRoot) { this.opcode('appendChild'); }
927
+ FragmentOpcodeCompiler.prototype.closeElement = function() {
928
+ this.opcode('appendChild');
895
929
  };
896
930
 
897
- FragmentOpcodeCompiler.prototype.startProgram = function(program) {
931
+ FragmentOpcodeCompiler.prototype.startProgram = function() {
898
932
  this.opcodes.length = 0;
899
- if (program.body.length !== 1) {
900
- this.opcode('createFragment');
901
- }
933
+ this.opcode('createFragment');
902
934
  };
903
935
 
904
- FragmentOpcodeCompiler.prototype.endProgram = function(/* program */) {
936
+ FragmentOpcodeCompiler.prototype.endProgram = function() {
905
937
  this.opcode('returnNode');
906
938
  };
907
939
 
908
- FragmentOpcodeCompiler.prototype.mustache = function () {};
940
+ FragmentOpcodeCompiler.prototype.mustache = function() {
941
+ this.pushMorphPlaceholderNode();
942
+ };
943
+
944
+ FragmentOpcodeCompiler.prototype.component = function() {
945
+ this.pushMorphPlaceholderNode();
946
+ };
909
947
 
910
- FragmentOpcodeCompiler.prototype.component = function () {};
948
+ FragmentOpcodeCompiler.prototype.block = function() {
949
+ this.pushMorphPlaceholderNode();
950
+ };
911
951
 
912
- FragmentOpcodeCompiler.prototype.block = function () {};
952
+ FragmentOpcodeCompiler.prototype.pushMorphPlaceholderNode = function() {
953
+ this.opcode('createComment', [""]);
954
+ this.opcode('appendChild');
955
+ };
913
956
 
914
957
  FragmentOpcodeCompiler.prototype.attribute = function(attr) {
915
958
  if (attr.value.type === 'TextNode') {
916
-
917
959
  var namespace = getAttrNamespace(attr.name);
918
-
919
960
  this.opcode('setAttribute', [attr.name, attr.value.chars, namespace]);
920
961
  }
921
962
  };
@@ -958,9 +999,19 @@ enifed("htmlbars-compiler/hydration-javascript-compiler",
958
999
  this.parentCount = 0;
959
1000
  this.indent = (options && options.indent) || "";
960
1001
  this.hooks = {};
1002
+ this.hasOpenBoundary = false;
1003
+ this.hasCloseBoundary = false;
961
1004
 
962
1005
  processOpcodes(this, opcodes);
963
1006
 
1007
+ if (this.hasOpenBoundary) {
1008
+ this.source.unshift(this.indent+" dom.insertBoundary(fragment, 0);\n");
1009
+ }
1010
+
1011
+ if (this.hasCloseBoundary) {
1012
+ this.source.unshift(this.indent+" dom.insertBoundary(fragment, null);\n");
1013
+ }
1014
+
964
1015
  var i, l;
965
1016
  if (this.morphs.length) {
966
1017
  var morphs = "";
@@ -1006,6 +1057,14 @@ enifed("htmlbars-compiler/hydration-javascript-compiler",
1006
1057
  this.stack.push(value);
1007
1058
  };
1008
1059
 
1060
+ prototype.openBoundary = function() {
1061
+ this.hasOpenBoundary = true;
1062
+ };
1063
+
1064
+ prototype.closeBoundary = function() {
1065
+ this.hasCloseBoundary = true;
1066
+ };
1067
+
1009
1068
  prototype.pushLiteral = function(value) {
1010
1069
  if (typeof value === 'string') {
1011
1070
  this.stack.push(string(value));
@@ -1264,33 +1323,32 @@ enifed("htmlbars-compiler/hydration-opcode-compiler",
1264
1323
  }
1265
1324
  };
1266
1325
 
1267
- HydrationOpcodeCompiler.prototype.endProgram = function(/* program */) {
1326
+ HydrationOpcodeCompiler.prototype.endProgram = function() {
1268
1327
  distributeMorphs(this.morphs, this.opcodes);
1269
1328
  };
1270
1329
 
1271
- HydrationOpcodeCompiler.prototype.text = function(/* string, pos, len */) {
1330
+ HydrationOpcodeCompiler.prototype.text = function() {
1272
1331
  ++this.currentDOMChildIndex;
1273
1332
  };
1274
1333
 
1275
- HydrationOpcodeCompiler.prototype.comment = function(/* string, pos, len */) {
1334
+ HydrationOpcodeCompiler.prototype.comment = function() {
1276
1335
  ++this.currentDOMChildIndex;
1277
1336
  };
1278
1337
 
1279
- HydrationOpcodeCompiler.prototype.openElement = function(element, pos, len, isSingleRoot, mustacheCount, blankChildTextNodes) {
1338
+ HydrationOpcodeCompiler.prototype.openElement = function(element, pos, len, mustacheCount, blankChildTextNodes) {
1280
1339
  distributeMorphs(this.morphs, this.opcodes);
1281
1340
  ++this.currentDOMChildIndex;
1282
1341
 
1283
1342
  this.element = this.currentDOMChildIndex;
1284
1343
 
1285
- if (!isSingleRoot) {
1286
- this.opcode('consumeParent', this.currentDOMChildIndex);
1344
+ this.opcode('consumeParent', this.currentDOMChildIndex);
1287
1345
 
1288
- // If our parent reference will be used more than once, cache its reference.
1289
- if (mustacheCount > 1) {
1290
- this.opcode('shareElement', ++this.elementNum);
1291
- this.element = null; // Set element to null so we don't cache it twice
1292
- }
1346
+ // If our parent reference will be used more than once, cache its reference.
1347
+ if (mustacheCount > 1) {
1348
+ this.opcode('shareElement', ++this.elementNum);
1349
+ this.element = null; // Set element to null so we don't cache it twice
1293
1350
  }
1351
+
1294
1352
  var isElementChecked = detectIsElementChecked(element);
1295
1353
  if (blankChildTextNodes.length > 0 || isElementChecked) {
1296
1354
  this.opcode( 'repairClonedNode',
@@ -1305,20 +1363,39 @@ enifed("htmlbars-compiler/hydration-opcode-compiler",
1305
1363
  forEach(element.helpers, this.elementHelper, this);
1306
1364
  };
1307
1365
 
1308
- HydrationOpcodeCompiler.prototype.closeElement = function(element, pos, len, isSingleRoot) {
1366
+ HydrationOpcodeCompiler.prototype.closeElement = function() {
1309
1367
  distributeMorphs(this.morphs, this.opcodes);
1310
- if (!isSingleRoot) { this.opcode('popParent'); }
1368
+ this.opcode('popParent');
1311
1369
  this.currentDOMChildIndex = this.paths.pop();
1312
1370
  };
1313
1371
 
1314
- HydrationOpcodeCompiler.prototype.block = function(block, childIndex, childrenLength) {
1315
- var sexpr = block.sexpr;
1372
+ HydrationOpcodeCompiler.prototype.mustache = function(mustache, childIndex, childCount) {
1373
+ this.pushMorphPlaceholderNode(childIndex, childCount);
1374
+
1375
+ var sexpr = mustache.sexpr;
1316
1376
 
1317
- var currentDOMChildIndex = this.currentDOMChildIndex;
1318
- var start = (currentDOMChildIndex < 0) ? null : currentDOMChildIndex;
1319
- var end = (childIndex === childrenLength - 1) ? null : currentDOMChildIndex + 1;
1377
+ var morphNum = this.morphNum++;
1378
+ var start = this.currentDOMChildIndex;
1379
+ var end = this.currentDOMChildIndex;
1380
+ this.morphs.push([morphNum, this.paths.slice(), start, end, mustache.escaped]);
1381
+
1382
+ if (isHelper(sexpr)) {
1383
+ prepareSexpr(this, sexpr);
1384
+ this.opcode('printInlineHook', morphNum);
1385
+ } else {
1386
+ preparePath(this, sexpr.path);
1387
+ this.opcode('printContentHook', morphNum);
1388
+ }
1389
+ };
1390
+
1391
+ HydrationOpcodeCompiler.prototype.block = function(block, childIndex, childCount) {
1392
+ this.pushMorphPlaceholderNode(childIndex, childCount);
1393
+
1394
+ var sexpr = block.sexpr;
1320
1395
 
1321
1396
  var morphNum = this.morphNum++;
1397
+ var start = this.currentDOMChildIndex;
1398
+ var end = this.currentDOMChildIndex;
1322
1399
  this.morphs.push([morphNum, this.paths.slice(), start, end, true]);
1323
1400
 
1324
1401
  var templateId = this.templateId++;
@@ -1328,15 +1405,15 @@ enifed("htmlbars-compiler/hydration-opcode-compiler",
1328
1405
  this.opcode('printBlockHook', morphNum, templateId, inverseId);
1329
1406
  };
1330
1407
 
1331
- HydrationOpcodeCompiler.prototype.component = function(component, childIndex, childrenLength) {
1332
- var currentDOMChildIndex = this.currentDOMChildIndex;
1408
+ HydrationOpcodeCompiler.prototype.component = function(component, childIndex, childCount) {
1409
+ this.pushMorphPlaceholderNode(childIndex, childCount);
1410
+
1333
1411
  var program = component.program || {};
1334
1412
  var blockParams = program.blockParams || [];
1335
1413
 
1336
- var start = (currentDOMChildIndex < 0 ? null : currentDOMChildIndex),
1337
- end = (childIndex === childrenLength - 1 ? null : currentDOMChildIndex + 1);
1338
-
1339
1414
  var morphNum = this.morphNum++;
1415
+ var start = this.currentDOMChildIndex;
1416
+ var end = this.currentDOMChildIndex;
1340
1417
  this.morphs.push([morphNum, this.paths.slice(), start, end, true]);
1341
1418
 
1342
1419
  var attrs = component.attributes;
@@ -1402,23 +1479,16 @@ enifed("htmlbars-compiler/hydration-opcode-compiler",
1402
1479
  this.opcode('printElementHook', this.elementNum);
1403
1480
  };
1404
1481
 
1405
- HydrationOpcodeCompiler.prototype.mustache = function(mustache, childIndex, childrenLength) {
1406
- var sexpr = mustache.sexpr;
1407
- var currentDOMChildIndex = this.currentDOMChildIndex;
1408
-
1409
- var start = currentDOMChildIndex,
1410
- end = (childIndex === childrenLength - 1 ? -1 : currentDOMChildIndex + 1);
1411
-
1412
- var morphNum = this.morphNum++;
1413
- this.morphs.push([morphNum, this.paths.slice(), start, end, mustache.escaped]);
1414
-
1415
- if (isHelper(sexpr)) {
1416
- prepareSexpr(this, sexpr);
1417
- this.opcode('printInlineHook', morphNum);
1418
- } else {
1419
- preparePath(this, sexpr.path);
1420
- this.opcode('printContentHook', morphNum);
1482
+ HydrationOpcodeCompiler.prototype.pushMorphPlaceholderNode = function(childIndex, childCount) {
1483
+ if (this.paths.length === 0) {
1484
+ if (childIndex === 0) {
1485
+ this.opcode('openBoundary');
1486
+ }
1487
+ if (childIndex === childCount - 1) {
1488
+ this.opcode('closeBoundary');
1489
+ }
1421
1490
  }
1491
+ this.comment();
1422
1492
  };
1423
1493
 
1424
1494
  HydrationOpcodeCompiler.prototype.SubExpression = function(sexpr) {
@@ -1511,6 +1581,7 @@ enifed("htmlbars-compiler/template-compiler",
1511
1581
 
1512
1582
  function TemplateCompiler(options) {
1513
1583
  this.options = options || {};
1584
+ this.revision = this.options.revision || "HTMLBars@v0.11.1";
1514
1585
  this.fragmentOpcodeCompiler = new FragmentOpcodeCompiler();
1515
1586
  this.fragmentCompiler = new FragmentJavaScriptCompiler();
1516
1587
  this.hydrationOpcodeCompiler = new HydrationOpcodeCompiler();
@@ -1596,6 +1667,7 @@ enifed("htmlbars-compiler/template-compiler",
1596
1667
  this.getChildTemplateVars(indent + ' ') +
1597
1668
  indent+' return {\n' +
1598
1669
  indent+' isHTMLBars: true,\n' +
1670
+ indent+' revision: "' + this.revision + '",\n' +
1599
1671
  indent+' blockParams: ' + blockParams.length + ',\n' +
1600
1672
  indent+' cachedFragment: null,\n' +
1601
1673
  indent+' hasRendered: false,\n' +
@@ -1639,14 +1711,14 @@ enifed("htmlbars-compiler/template-compiler",
1639
1711
  this.hydrationOpcodeCompiler.closeElement(element, i, l, r);
1640
1712
  };
1641
1713
 
1642
- TemplateCompiler.prototype.component = function(component, i, l) {
1643
- this.fragmentOpcodeCompiler.component(component, i, l);
1644
- this.hydrationOpcodeCompiler.component(component, i, l);
1714
+ TemplateCompiler.prototype.component = function(component, i, l, s) {
1715
+ this.fragmentOpcodeCompiler.component(component, i, l, s);
1716
+ this.hydrationOpcodeCompiler.component(component, i, l, s);
1645
1717
  };
1646
1718
 
1647
- TemplateCompiler.prototype.block = function(block, i, l) {
1648
- this.fragmentOpcodeCompiler.block(block, i, l);
1649
- this.hydrationOpcodeCompiler.block(block, i, l);
1719
+ TemplateCompiler.prototype.block = function(block, i, l, s) {
1720
+ this.fragmentOpcodeCompiler.block(block, i, l, s);
1721
+ this.hydrationOpcodeCompiler.block(block, i, l, s);
1650
1722
  };
1651
1723
 
1652
1724
  TemplateCompiler.prototype.text = function(string, i, l, r) {
@@ -1659,9 +1731,9 @@ enifed("htmlbars-compiler/template-compiler",
1659
1731
  this.hydrationOpcodeCompiler.comment(string, i, l, r);
1660
1732
  };
1661
1733
 
1662
- TemplateCompiler.prototype.mustache = function (mustache, i, l) {
1663
- this.fragmentOpcodeCompiler.mustache(mustache, i, l);
1664
- this.hydrationOpcodeCompiler.mustache(mustache, i, l);
1734
+ TemplateCompiler.prototype.mustache = function (mustache, i, l, s) {
1735
+ this.fragmentOpcodeCompiler.mustache(mustache, i, l, s);
1736
+ this.hydrationOpcodeCompiler.mustache(mustache, i, l, s);
1665
1737
  };
1666
1738
 
1667
1739
  TemplateCompiler.prototype.setNamespace = function(namespace) {
@@ -1779,7 +1851,6 @@ enifed("htmlbars-compiler/template-visitor",
1779
1851
  TemplateVisitor.prototype.ElementNode = function(element) {
1780
1852
  var parentFrame = this.getCurrentFrame();
1781
1853
  var elementFrame = this.pushFrame();
1782
- var parentNode = parentFrame.parentNode;
1783
1854
 
1784
1855
  elementFrame.parentNode = element;
1785
1856
  elementFrame.children = element.children;
@@ -1790,8 +1861,7 @@ enifed("htmlbars-compiler/template-visitor",
1790
1861
  var actionArgs = [
1791
1862
  element,
1792
1863
  parentFrame.childIndex,
1793
- parentFrame.childCount,
1794
- parentNode.type === 'Program' && parentFrame.childCount === 1
1864
+ parentFrame.childCount
1795
1865
  ];
1796
1866
 
1797
1867
  elementFrame.actions.push(['closeElement', actionArgs]);
@@ -1823,11 +1893,10 @@ enifed("htmlbars-compiler/template-visitor",
1823
1893
 
1824
1894
  TemplateVisitor.prototype.TextNode = function(text) {
1825
1895
  var frame = this.getCurrentFrame();
1826
- var isSingleRoot = frame.parentNode.type === 'Program' && frame.childCount === 1;
1827
1896
  if (text.chars === '') {
1828
1897
  frame.blankChildTextNodes.push(domIndexOf(frame.children, text));
1829
1898
  }
1830
- frame.actions.push(['text', [text, frame.childIndex, frame.childCount, isSingleRoot]]);
1899
+ frame.actions.push(['text', [text, frame.childIndex, frame.childCount]]);
1831
1900
  };
1832
1901
 
1833
1902
  TemplateVisitor.prototype.BlockStatement = function(node) {
@@ -1858,9 +1927,7 @@ enifed("htmlbars-compiler/template-visitor",
1858
1927
 
1859
1928
  TemplateVisitor.prototype.CommentStatement = function(text) {
1860
1929
  var frame = this.getCurrentFrame();
1861
- var isSingleRoot = frame.parentNode.type === 'Program' && frame.childCount === 1;
1862
-
1863
- frame.actions.push(['comment', [text, frame.childIndex, frame.childCount, isSingleRoot]]);
1930
+ frame.actions.push(['comment', [text, frame.childIndex, frame.childCount]]);
1864
1931
  };
1865
1932
 
1866
1933
  TemplateVisitor.prototype.MustacheStatement = function(mustache) {
@@ -1928,6 +1995,159 @@ enifed("htmlbars-compiler/utils",
1928
1995
 
1929
1996
  __exports__.processOpcodes = processOpcodes;
1930
1997
  });
1998
+ enifed("htmlbars-runtime",
1999
+ ["htmlbars-runtime/hooks","htmlbars-runtime/helpers","exports"],
2000
+ function(__dependency1__, __dependency2__, __exports__) {
2001
+ "use strict";
2002
+ var hooks = __dependency1__["default"];
2003
+ var helpers = __dependency2__["default"];
2004
+
2005
+ __exports__.hooks = hooks;
2006
+ __exports__.helpers = helpers;
2007
+ });
2008
+ enifed("htmlbars-runtime/helpers",
2009
+ ["exports"],
2010
+ function(__exports__) {
2011
+ "use strict";
2012
+ function partial(params, hash, options, env) {
2013
+ var template = env.partials[params[0]];
2014
+ return template.render(this, env, options.morph.contextualElement);
2015
+ }
2016
+
2017
+ __exports__.partial = partial;__exports__["default"] = {
2018
+ partial: partial
2019
+ };
2020
+ });
2021
+ enifed("htmlbars-runtime/hooks",
2022
+ ["exports"],
2023
+ function(__exports__) {
2024
+ "use strict";
2025
+ function block(env, morph, context, path, params, hash, template, inverse) {
2026
+ var options = {
2027
+ morph: morph,
2028
+ template: template,
2029
+ inverse: inverse
2030
+ };
2031
+
2032
+ var helper = lookupHelper(env, context, path);
2033
+ var value = helper.call(context, params, hash, options, env);
2034
+
2035
+ morph.setContent(value);
2036
+ }
2037
+
2038
+ __exports__.block = block;function inline(env, morph, context, path, params, hash) {
2039
+ var helper = lookupHelper(env, context, path);
2040
+ var value = helper.call(context, params, hash, { morph: morph }, env);
2041
+
2042
+ morph.setContent(value);
2043
+ }
2044
+
2045
+ __exports__.inline = inline;function content(env, morph, context, path) {
2046
+ var helper = lookupHelper(env, context, path);
2047
+
2048
+ var value;
2049
+ if (helper) {
2050
+ value = helper.call(context, [], {}, { morph: morph }, env);
2051
+ } else {
2052
+ value = get(env, context, path);
2053
+ }
2054
+
2055
+ morph.setContent(value);
2056
+ }
2057
+
2058
+ __exports__.content = content;function element(env, domElement, context, path, params, hash) {
2059
+ var helper = lookupHelper(env, context, path);
2060
+ if (helper) {
2061
+ helper.call(context, params, hash, { element: domElement }, env);
2062
+ }
2063
+ }
2064
+
2065
+ __exports__.element = element;function attribute(env, attrMorph, domElement, name, value) {
2066
+ attrMorph.setContent(value);
2067
+ }
2068
+
2069
+ __exports__.attribute = attribute;function subexpr(env, context, helperName, params, hash) {
2070
+ var helper = lookupHelper(env, context, helperName);
2071
+ if (helper) {
2072
+ return helper.call(context, params, hash, {}, env);
2073
+ } else {
2074
+ return get(env, context, helperName);
2075
+ }
2076
+ }
2077
+
2078
+ __exports__.subexpr = subexpr;function get(env, context, path) {
2079
+ if (path === '') {
2080
+ return context;
2081
+ }
2082
+
2083
+ var keys = path.split('.');
2084
+ var value = context;
2085
+ for (var i = 0; i < keys.length; i++) {
2086
+ if (value) {
2087
+ value = value[keys[i]];
2088
+ } else {
2089
+ break;
2090
+ }
2091
+ }
2092
+ return value;
2093
+ }
2094
+
2095
+ __exports__.get = get;function set(env, context, name, value) {
2096
+ context[name] = value;
2097
+ }
2098
+
2099
+ __exports__.set = set;function component(env, morph, context, tagName, attrs, template) {
2100
+ var helper = lookupHelper(env, context, tagName);
2101
+
2102
+ var value;
2103
+ if (helper) {
2104
+ var options = {
2105
+ morph: morph,
2106
+ template: template
2107
+ };
2108
+
2109
+ value = helper.call(context, [], attrs, options, env);
2110
+ } else {
2111
+ value = componentFallback(env, morph, context, tagName, attrs, template);
2112
+ }
2113
+
2114
+ morph.setContent(value);
2115
+ }
2116
+
2117
+ __exports__.component = component;function concat(env, params) {
2118
+ var value = "";
2119
+ for (var i = 0, l = params.length; i < l; i++) {
2120
+ value += params[i];
2121
+ }
2122
+ return value;
2123
+ }
2124
+
2125
+ __exports__.concat = concat;function componentFallback(env, morph, context, tagName, attrs, template) {
2126
+ var element = env.dom.createElement(tagName);
2127
+ for (var name in attrs) {
2128
+ element.setAttribute(name, attrs[name]);
2129
+ }
2130
+ element.appendChild(template.render(context, env, morph.contextualElement));
2131
+ return element;
2132
+ }
2133
+
2134
+ function lookupHelper(env, context, helperName) {
2135
+ return env.helpers[helperName];
2136
+ }
2137
+
2138
+ __exports__["default"] = {
2139
+ content: content,
2140
+ block: block,
2141
+ inline: inline,
2142
+ component: component,
2143
+ element: element,
2144
+ attribute: attribute,
2145
+ subexpr: subexpr,
2146
+ concat: concat,
2147
+ get: get,
2148
+ set: set
2149
+ };
2150
+ });
1931
2151
  enifed("htmlbars-syntax",
1932
2152
  ["./htmlbars-syntax/walker","./htmlbars-syntax/builders","./htmlbars-syntax/parser","exports"],
1933
2153
  function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
@@ -3356,7 +3576,6 @@ enifed("htmlbars-syntax/node-handlers",
3356
3576
  var buildHash = __dependency1__.buildHash;
3357
3577
  var forEach = __dependency2__.forEach;
3358
3578
  var appendChild = __dependency3__.appendChild;
3359
- var postprocessProgram = __dependency3__.postprocessProgram;
3360
3579
 
3361
3580
  var nodeHandlers = {
3362
3581
 
@@ -3375,8 +3594,6 @@ enifed("htmlbars-syntax/node-handlers",
3375
3594
 
3376
3595
  this.acceptToken(this.tokenizer.tokenizeEOF());
3377
3596
 
3378
- postprocessProgram(node);
3379
-
3380
3597
  // Ensure that that the element stack is balanced properly.
3381
3598
  var poppedNode = this.elementStack.pop();
3382
3599
  if (poppedNode !== node) {
@@ -3632,7 +3849,6 @@ enifed("htmlbars-syntax/token-handlers",
3632
3849
  var buildText = __dependency2__.buildText;
3633
3850
  var appendChild = __dependency3__.appendChild;
3634
3851
  var parseComponentBlockParams = __dependency3__.parseComponentBlockParams;
3635
- var postprocessProgram = __dependency3__.postprocessProgram;
3636
3852
 
3637
3853
  // The HTML elements in this list are speced by
3638
3854
  // http://www.w3.org/TR/html-markup/syntax.html#syntax-elements,
@@ -3735,7 +3951,6 @@ enifed("htmlbars-syntax/token-handlers",
3735
3951
  } else {
3736
3952
  var program = buildProgram(element.children);
3737
3953
  parseComponentBlockParams(element, program);
3738
- postprocessProgram(program);
3739
3954
  var component = buildComponent(element.tag, element.attributes, program);
3740
3955
  appendChild(parent, component);
3741
3956
  }
@@ -3872,11 +4087,10 @@ enifed("htmlbars-syntax/tokenizer",
3872
4087
  __exports__.unwrapMustache = unwrapMustache;__exports__.Tokenizer = Tokenizer;
3873
4088
  });
3874
4089
  enifed("htmlbars-syntax/utils",
3875
- ["./builders","../htmlbars-util/array-utils","exports"],
3876
- function(__dependency1__, __dependency2__, __exports__) {
4090
+ ["../htmlbars-util/array-utils","exports"],
4091
+ function(__dependency1__, __exports__) {
3877
4092
  "use strict";
3878
- var buildText = __dependency1__.buildText;
3879
- var indexOfArray = __dependency2__.indexOfArray;
4093
+ var indexOfArray = __dependency1__.indexOfArray;
3880
4094
  // Regex to validate the identifier for block parameters.
3881
4095
  // Based on the ID validation regex in Handlebars.
3882
4096
 
@@ -3923,26 +4137,7 @@ enifed("htmlbars-syntax/utils",
3923
4137
  }
3924
4138
  }
3925
4139
 
3926
- __exports__.parseComponentBlockParams = parseComponentBlockParams;// Adds an empty text node at the beginning and end of a program.
3927
- // The empty text nodes *between* nodes are handled elsewhere.
3928
-
3929
- function postprocessProgram(program) {
3930
- var body = program.body;
3931
-
3932
- if (body.length === 0) {
3933
- return;
3934
- }
3935
-
3936
- if (usesMorph(body[0])) {
3937
- body.unshift(buildText(''));
3938
- }
3939
-
3940
- if (usesMorph(body[body.length-1])) {
3941
- body.push(buildText(''));
3942
- }
3943
- }
3944
-
3945
- __exports__.postprocessProgram = postprocessProgram;function childrenFor(node) {
4140
+ __exports__.parseComponentBlockParams = parseComponentBlockParams;function childrenFor(node) {
3946
4141
  if (node.type === 'Program') {
3947
4142
  return node.body;
3948
4143
  }
@@ -3951,23 +4146,8 @@ enifed("htmlbars-syntax/utils",
3951
4146
  }
3952
4147
  }
3953
4148
 
3954
- __exports__.childrenFor = childrenFor;function usesMorph(node) {
3955
- return node.type === 'MustacheStatement' ||
3956
- node.type === 'BlockStatement' ||
3957
- node.type === 'ComponentNode';
3958
- }
3959
-
3960
- __exports__.usesMorph = usesMorph;function appendChild(parent, node) {
3961
- var children = childrenFor(parent);
3962
-
3963
- var len = children.length, last;
3964
- if (len > 0) {
3965
- last = children[len-1];
3966
- if (usesMorph(last) && usesMorph(node)) {
3967
- children.push(buildText(''));
3968
- }
3969
- }
3970
- children.push(node);
4149
+ __exports__.childrenFor = childrenFor;function appendChild(parent, node) {
4150
+ childrenFor(parent).push(node);
3971
4151
  }
3972
4152
 
3973
4153
  __exports__.appendChild = appendChild;function isHelper(sexpr) {