ember-source 1.10.0.beta.2 → 1.10.0.beta.3
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 +4 -4
- data/VERSION +1 -1
- data/dist/ember-runtime.js +11 -8
- data/dist/ember-template-compiler.js +281 -312
- data/dist/ember-testing.js +4 -2
- data/dist/ember-tests.js +140 -164
- data/dist/ember-tests.prod.js +96 -164
- data/dist/ember.debug.js +874 -769
- data/dist/ember.js +874 -769
- data/dist/ember.min.js +15 -15
- data/dist/ember.prod.js +864 -765
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a51c8274f4e7cf007f118fedb3b566f30b3b3d0d
|
4
|
+
data.tar.gz: 40f6468450908c4c9e0b003faa5a71157ce382db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f94d74ec51da5db14e2867730b47aca32dd24a84d8598c301750c6425dc69033e2c94a759cf0613c81a406cc48c26aa66b36c32fa42cbac1208b27d95e8992c5
|
7
|
+
data.tar.gz: 2d6808249e8c3ddb0013f33f9f004669592e0d649ac7f8377a00ea03903434fe1fe6bbaf9e9e6fa8798be680c9d4f261ff3428d5dcfcbb9c7f3029b3c7929513
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.10.0-beta.
|
1
|
+
1.10.0-beta.3
|
data/dist/ember-runtime.js
CHANGED
@@ -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.10.0-beta.
|
8
|
+
* @version 1.10.0-beta.3
|
9
9
|
*/
|
10
10
|
|
11
11
|
(function() {
|
@@ -4852,7 +4852,7 @@ define("ember-metal/core",
|
|
4852
4852
|
|
4853
4853
|
@class Ember
|
4854
4854
|
@static
|
4855
|
-
@version 1.10.0-beta.
|
4855
|
+
@version 1.10.0-beta.3
|
4856
4856
|
*/
|
4857
4857
|
|
4858
4858
|
if ('undefined' === typeof Ember) {
|
@@ -4879,10 +4879,10 @@ define("ember-metal/core",
|
|
4879
4879
|
/**
|
4880
4880
|
@property VERSION
|
4881
4881
|
@type String
|
4882
|
-
@default '1.10.0-beta.
|
4882
|
+
@default '1.10.0-beta.3'
|
4883
4883
|
@static
|
4884
4884
|
*/
|
4885
|
-
Ember.VERSION = '1.10.0-beta.
|
4885
|
+
Ember.VERSION = '1.10.0-beta.3';
|
4886
4886
|
|
4887
4887
|
/**
|
4888
4888
|
Standard environmental variables. You can define these in a global `EmberENV`
|
@@ -11597,9 +11597,11 @@ define("ember-metal/watch_key",
|
|
11597
11597
|
var handleMandatorySetter = function handleMandatorySetter(m, obj, keyName) {
|
11598
11598
|
var descriptor = Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(obj, keyName);
|
11599
11599
|
var configurable = descriptor ? descriptor.configurable : true;
|
11600
|
+
var isWritable = descriptor ? descriptor.writable : true;
|
11601
|
+
var hasValue = descriptor ? 'value' in descriptor : true;
|
11600
11602
|
|
11601
11603
|
// this x in Y deopts, so keeping it in this function is better;
|
11602
|
-
if (configurable && keyName in obj) {
|
11604
|
+
if (configurable && isWritable && hasValue && keyName in obj) {
|
11603
11605
|
m.values[keyName] = obj[keyName];
|
11604
11606
|
o_defineProperty(obj, keyName, {
|
11605
11607
|
configurable: true,
|
@@ -13400,14 +13402,15 @@ define("ember-runtime/computed/reduce_computed_macros",
|
|
13400
13402
|
The callback method you provide should have the following signature.
|
13401
13403
|
`item` is the current item in the iteration.
|
13402
13404
|
`index` is the integer index of the current item in the iteration.
|
13405
|
+
`array` is the dependant array itself.
|
13403
13406
|
|
13404
13407
|
```javascript
|
13405
|
-
function(item, index);
|
13408
|
+
function(item, index, array);
|
13406
13409
|
```
|
13407
13410
|
|
13408
13411
|
```javascript
|
13409
13412
|
var Hamster = Ember.Object.extend({
|
13410
|
-
remainingChores: Ember.computed.filter('chores', function(chore, index) {
|
13413
|
+
remainingChores: Ember.computed.filter('chores', function(chore, index, array) {
|
13411
13414
|
return !chore.done;
|
13412
13415
|
})
|
13413
13416
|
});
|
@@ -13436,7 +13439,7 @@ define("ember-runtime/computed/reduce_computed_macros",
|
|
13436
13439
|
},
|
13437
13440
|
|
13438
13441
|
addedItem: function (array, item, changeMeta, instanceMeta) {
|
13439
|
-
var match = !!callback.call(this, item, changeMeta.index);
|
13442
|
+
var match = !!callback.call(this, item, changeMeta.index, changeMeta.arrayChanged);
|
13440
13443
|
var filterIndex = instanceMeta.filteredArrayIndexes.addItem(changeMeta.index, match);
|
13441
13444
|
|
13442
13445
|
if (match) {
|
@@ -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.10.0-beta.
|
8
|
+
* @version 1.10.0-beta.3
|
9
9
|
*/
|
10
10
|
|
11
11
|
(function() {
|
@@ -114,7 +114,7 @@ define("ember-metal/core",
|
|
114
114
|
|
115
115
|
@class Ember
|
116
116
|
@static
|
117
|
-
@version 1.10.0-beta.
|
117
|
+
@version 1.10.0-beta.3
|
118
118
|
*/
|
119
119
|
|
120
120
|
if ('undefined' === typeof Ember) {
|
@@ -141,10 +141,10 @@ define("ember-metal/core",
|
|
141
141
|
/**
|
142
142
|
@property VERSION
|
143
143
|
@type String
|
144
|
-
@default '1.10.0-beta.
|
144
|
+
@default '1.10.0-beta.3'
|
145
145
|
@static
|
146
146
|
*/
|
147
|
-
Ember.VERSION = '1.10.0-beta.
|
147
|
+
Ember.VERSION = '1.10.0-beta.3';
|
148
148
|
|
149
149
|
/**
|
150
150
|
Standard environmental variables. You can define these in a global `EmberENV`
|
@@ -681,6 +681,11 @@ define("htmlbars-compiler/fragment-javascript-compiler",
|
|
681
681
|
var processOpcodes = __dependency1__.processOpcodes;
|
682
682
|
var string = __dependency2__.string;
|
683
683
|
|
684
|
+
var svgNamespace = "http://www.w3.org/2000/svg",
|
685
|
+
// http://www.w3.org/html/wg/drafts/html/master/syntax.html#html-integration-point
|
686
|
+
svgHTMLIntegrationPoints = {'foreignObject':true, 'desc':true, 'title':true};
|
687
|
+
|
688
|
+
|
684
689
|
function FragmentJavaScriptCompiler() {
|
685
690
|
this.source = [];
|
686
691
|
this.depth = -1;
|
@@ -692,6 +697,8 @@ define("htmlbars-compiler/fragment-javascript-compiler",
|
|
692
697
|
this.source.length = 0;
|
693
698
|
this.depth = -1;
|
694
699
|
this.indent = (options && options.indent) || "";
|
700
|
+
this.namespaceFrameStack = [{namespace: null, depth: null}];
|
701
|
+
this.domNamespace = null;
|
695
702
|
|
696
703
|
this.source.push('function build(dom) {\n');
|
697
704
|
processOpcodes(this, opcodes);
|
@@ -707,7 +714,14 @@ define("htmlbars-compiler/fragment-javascript-compiler",
|
|
707
714
|
|
708
715
|
FragmentJavaScriptCompiler.prototype.createElement = function(tagName) {
|
709
716
|
var el = 'el'+(++this.depth);
|
717
|
+
if (tagName === 'svg') {
|
718
|
+
this.pushNamespaceFrame({namespace: svgNamespace, depth: this.depth});
|
719
|
+
}
|
720
|
+
this.ensureNamespace();
|
710
721
|
this.source.push(this.indent+' var '+el+' = dom.createElement('+string(tagName)+');\n');
|
722
|
+
if (svgHTMLIntegrationPoints[tagName]) {
|
723
|
+
this.pushNamespaceFrame({namespace: null, depth: this.depth});
|
724
|
+
}
|
711
725
|
};
|
712
726
|
|
713
727
|
FragmentJavaScriptCompiler.prototype.createText = function(str) {
|
@@ -727,17 +741,36 @@ define("htmlbars-compiler/fragment-javascript-compiler",
|
|
727
741
|
|
728
742
|
FragmentJavaScriptCompiler.prototype.setAttribute = function(name, value) {
|
729
743
|
var el = 'el'+this.depth;
|
730
|
-
this.source.push(this.indent+' dom.
|
744
|
+
this.source.push(this.indent+' dom.setProperty('+el+','+string(name)+','+string(value)+');\n');
|
731
745
|
};
|
732
746
|
|
733
747
|
FragmentJavaScriptCompiler.prototype.appendChild = function() {
|
748
|
+
if (this.depth === this.getCurrentNamespaceFrame().depth) {
|
749
|
+
this.popNamespaceFrame();
|
750
|
+
}
|
734
751
|
var child = 'el'+(this.depth--);
|
735
752
|
var el = 'el'+this.depth;
|
736
753
|
this.source.push(this.indent+' dom.appendChild('+el+', '+child+');\n');
|
737
754
|
};
|
738
755
|
|
739
|
-
FragmentJavaScriptCompiler.prototype.
|
740
|
-
this.
|
756
|
+
FragmentJavaScriptCompiler.prototype.getCurrentNamespaceFrame = function() {
|
757
|
+
return this.namespaceFrameStack[this.namespaceFrameStack.length-1];
|
758
|
+
};
|
759
|
+
|
760
|
+
FragmentJavaScriptCompiler.prototype.pushNamespaceFrame = function(frame) {
|
761
|
+
this.namespaceFrameStack.push(frame);
|
762
|
+
};
|
763
|
+
|
764
|
+
FragmentJavaScriptCompiler.prototype.popNamespaceFrame = function() {
|
765
|
+
return this.namespaceFrameStack.pop();
|
766
|
+
};
|
767
|
+
|
768
|
+
FragmentJavaScriptCompiler.prototype.ensureNamespace = function() {
|
769
|
+
var correctNamespace = this.getCurrentNamespaceFrame().namespace;
|
770
|
+
if (this.domNamespace !== correctNamespace) {
|
771
|
+
this.source.push(this.indent+' dom.setNamespace('+(correctNamespace ? string(correctNamespace) : 'null')+');\n');
|
772
|
+
this.domNamespace = correctNamespace;
|
773
|
+
}
|
741
774
|
};
|
742
775
|
});
|
743
776
|
define("htmlbars-compiler/fragment-opcode-compiler",
|
@@ -819,14 +852,13 @@ define("htmlbars-compiler/hydration-javascript-compiler",
|
|
819
852
|
"use strict";
|
820
853
|
var processOpcodes = __dependency1__.processOpcodes;
|
821
854
|
var string = __dependency2__.string;
|
822
|
-
var quoteHash = __dependency2__.hash;
|
823
855
|
var array = __dependency2__.array;
|
824
856
|
|
825
857
|
function HydrationJavaScriptCompiler() {
|
826
858
|
this.stack = [];
|
827
859
|
this.source = [];
|
828
860
|
this.mustaches = [];
|
829
|
-
this.parents = ['fragment'];
|
861
|
+
this.parents = [['fragment']];
|
830
862
|
this.parentCount = 0;
|
831
863
|
this.morphs = [];
|
832
864
|
this.fragmentProcessing = [];
|
@@ -842,7 +874,7 @@ define("htmlbars-compiler/hydration-javascript-compiler",
|
|
842
874
|
this.mustaches.length = 0;
|
843
875
|
this.source.length = 0;
|
844
876
|
this.parents.length = 1;
|
845
|
-
this.parents[0] = 'fragment';
|
877
|
+
this.parents[0] = ['fragment'];
|
846
878
|
this.morphs.length = 0;
|
847
879
|
this.fragmentProcessing.length = 0;
|
848
880
|
this.parentCount = 0;
|
@@ -904,124 +936,113 @@ define("htmlbars-compiler/hydration-javascript-compiler",
|
|
904
936
|
}
|
905
937
|
};
|
906
938
|
|
939
|
+
prototype.pushHook = function(name, args) {
|
940
|
+
this.hooks[name] = true;
|
941
|
+
this.stack.push(name + '(' + args.join(', ') + ')');
|
942
|
+
};
|
943
|
+
|
907
944
|
prototype.pushGetHook = function(path) {
|
908
|
-
this.
|
909
|
-
|
945
|
+
this.pushHook('get', [
|
946
|
+
'env',
|
947
|
+
'context',
|
948
|
+
string(path)
|
949
|
+
]);
|
910
950
|
};
|
911
951
|
|
912
952
|
prototype.pushSexprHook = function() {
|
913
|
-
this.
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
953
|
+
this.pushHook('subexpr', [
|
954
|
+
'env',
|
955
|
+
'context',
|
956
|
+
this.stack.pop(), // path
|
957
|
+
this.stack.pop(), // params
|
958
|
+
this.stack.pop() // hash
|
959
|
+
]);
|
918
960
|
};
|
919
961
|
|
920
962
|
prototype.pushConcatHook = function() {
|
921
|
-
this.
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
prototype.printSetHook = function(name, index) {
|
927
|
-
this.hooks.set = true;
|
928
|
-
this.source.push(this.indent + ' set(context, ' + string(name) +', blockArguments[' + index + ']);\n');
|
929
|
-
};
|
930
|
-
|
931
|
-
prototype.printContentHookForBlockHelper = function(morphNum, templateId, inverseId, blockParamsLength) {
|
932
|
-
var path = this.stack.pop();
|
933
|
-
var params = this.stack.pop();
|
934
|
-
var hash = this.stack.pop();
|
935
|
-
|
936
|
-
var options = [];
|
937
|
-
|
938
|
-
options.push('morph: morph' + morphNum);
|
939
|
-
|
940
|
-
if (templateId !== null) {
|
941
|
-
options.push('template: child' + templateId);
|
942
|
-
}
|
943
|
-
|
944
|
-
if (inverseId !== null) {
|
945
|
-
options.push('inverse: child' + inverseId);
|
946
|
-
}
|
947
|
-
|
948
|
-
if (blockParamsLength) {
|
949
|
-
options.push('blockParams: ' + blockParamsLength);
|
950
|
-
}
|
951
|
-
|
952
|
-
this.printContentHook(morphNum, path, params, hash, options);
|
963
|
+
this.pushHook('concat', [
|
964
|
+
'env',
|
965
|
+
this.stack.pop() // parts
|
966
|
+
]);
|
953
967
|
};
|
954
968
|
|
955
|
-
prototype.
|
956
|
-
|
957
|
-
|
958
|
-
var hash = this.stack.pop();
|
959
|
-
|
960
|
-
var options = [];
|
961
|
-
options.push('morph: morph' + morphNum);
|
962
|
-
|
963
|
-
this.printContentHook(morphNum, path, params, hash, options);
|
964
|
-
};
|
965
|
-
|
966
|
-
prototype.printContentHookForAmbiguous = function(morphNum) {
|
967
|
-
var path = this.stack.pop();
|
968
|
-
|
969
|
-
var options = [];
|
970
|
-
options.push('morph: morph' + morphNum);
|
971
|
-
|
972
|
-
this.printContentHook(morphNum, path, '[]', '{}', options);
|
973
|
-
};
|
974
|
-
|
975
|
-
prototype.printContentHook = function(morphNum, path, params, hash, pairs) {
|
976
|
-
this.hooks.content = true;
|
977
|
-
|
978
|
-
var args = ['morph' + morphNum, path, 'context', params, hash, quoteHash(pairs), 'env'];
|
979
|
-
this.source.push(this.indent+' content(' + args.join(', ') + ');\n');
|
980
|
-
};
|
981
|
-
|
982
|
-
prototype.printComponentHook = function(morphNum, templateId, blockParamsLength) {
|
983
|
-
this.hooks.component = true;
|
984
|
-
|
985
|
-
var path = this.stack.pop();
|
986
|
-
var hash = this.stack.pop();
|
987
|
-
|
988
|
-
var options = [];
|
989
|
-
|
990
|
-
options.push('morph: morph' + morphNum);
|
991
|
-
|
992
|
-
if (templateId !== null) {
|
993
|
-
options.push('template: child' + templateId);
|
994
|
-
}
|
995
|
-
|
996
|
-
if (blockParamsLength) {
|
997
|
-
options.push('blockParams: ' + blockParamsLength);
|
998
|
-
}
|
999
|
-
|
1000
|
-
var args = ['morph' + morphNum, path, 'context', hash, quoteHash(options), 'env'];
|
1001
|
-
this.source.push(this.indent+' component(' + args.join(', ') + ');\n');
|
969
|
+
prototype.printHook = function(name, args) {
|
970
|
+
this.hooks[name] = true;
|
971
|
+
this.source.push(this.indent + ' ' + name + '(' + args.join(', ') + ');\n');
|
1002
972
|
};
|
1003
973
|
|
1004
|
-
prototype.
|
1005
|
-
this.
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
974
|
+
prototype.printSetHook = function(name, index) {
|
975
|
+
this.printHook('set', [
|
976
|
+
'env',
|
977
|
+
'context',
|
978
|
+
string(name),
|
979
|
+
'blockArguments[' + index + ']'
|
980
|
+
]);
|
981
|
+
};
|
982
|
+
|
983
|
+
prototype.printBlockHook = function(morphNum, templateId, inverseId) {
|
984
|
+
this.printHook('block', [
|
985
|
+
'env',
|
986
|
+
'morph' + morphNum,
|
987
|
+
'context',
|
988
|
+
this.stack.pop(), // path
|
989
|
+
this.stack.pop(), // params
|
990
|
+
this.stack.pop(), // hash
|
991
|
+
templateId === null ? 'null' : 'child' + templateId,
|
992
|
+
inverseId === null ? 'null' : 'child' + inverseId
|
993
|
+
]);
|
994
|
+
};
|
995
|
+
|
996
|
+
prototype.printInlineHook = function(morphNum) {
|
997
|
+
this.printHook('inline', [
|
998
|
+
'env',
|
999
|
+
'morph' + morphNum,
|
1000
|
+
'context',
|
1001
|
+
this.stack.pop(), // path
|
1002
|
+
this.stack.pop(), // params
|
1003
|
+
this.stack.pop() // hash
|
1004
|
+
]);
|
1005
|
+
};
|
1006
|
+
|
1007
|
+
prototype.printContentHook = function(morphNum) {
|
1008
|
+
this.printHook('content', [
|
1009
|
+
'env',
|
1010
|
+
'morph' + morphNum,
|
1011
|
+
'context',
|
1012
|
+
this.stack.pop() // path
|
1013
|
+
]);
|
1014
|
+
};
|
1015
|
+
|
1016
|
+
prototype.printComponentHook = function(morphNum, templateId) {
|
1017
|
+
this.printHook('component', [
|
1018
|
+
'env',
|
1019
|
+
'morph' + morphNum,
|
1020
|
+
'context',
|
1021
|
+
this.stack.pop(), // path
|
1022
|
+
this.stack.pop(), // attrs
|
1023
|
+
templateId === null ? 'null' : 'child' + templateId
|
1024
|
+
]);
|
1025
|
+
};
|
1026
|
+
|
1027
|
+
prototype.printAttributeHook = function(attrMorphNum, elementNum) {
|
1028
|
+
this.printHook('attribute', [
|
1029
|
+
'env',
|
1030
|
+
'attrMorph' + attrMorphNum,
|
1031
|
+
'element' + elementNum,
|
1032
|
+
this.stack.pop(), // name
|
1033
|
+
this.stack.pop() // value
|
1034
|
+
]);
|
1011
1035
|
};
|
1012
1036
|
|
1013
1037
|
prototype.printElementHook = function(elementNum) {
|
1014
|
-
this.
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
var args = ['element' + elementNum, path, 'context', params, hash, quoteHash(options), 'env'];
|
1024
|
-
this.source.push(this.indent+' element(' + args.join(', ') + ');\n');
|
1038
|
+
this.printHook('element', [
|
1039
|
+
'env',
|
1040
|
+
'element' + elementNum,
|
1041
|
+
'context',
|
1042
|
+
this.stack.pop(), // path
|
1043
|
+
this.stack.pop(), // params
|
1044
|
+
this.stack.pop() // hash
|
1045
|
+
]);
|
1025
1046
|
};
|
1026
1047
|
|
1027
1048
|
prototype.createMorph = function(morphNum, parentPath, startIndex, endIndex, escaped) {
|
@@ -1037,6 +1058,12 @@ define("htmlbars-compiler/hydration-javascript-compiler",
|
|
1037
1058
|
this.morphs.push(['morph' + morphNum, morph]);
|
1038
1059
|
};
|
1039
1060
|
|
1061
|
+
prototype.createAttrMorph = function(attrMorphNum, elementNum, name, escaped) {
|
1062
|
+
var morphMethod = escaped ? 'createAttrMorph' : 'createUnsafeAttrMorph';
|
1063
|
+
var morph = "dom."+morphMethod+"(element"+elementNum+", '"+name+"')";
|
1064
|
+
this.morphs.push(['attrMorph' + attrMorphNum, morph]);
|
1065
|
+
};
|
1066
|
+
|
1040
1067
|
prototype.repairClonedNode = function(blankChildTextNodes, isElementChecked) {
|
1041
1068
|
var parent = this.getParent(),
|
1042
1069
|
processing = 'dom.repairClonedNode('+parent+','+
|
@@ -1051,11 +1078,14 @@ define("htmlbars-compiler/hydration-javascript-compiler",
|
|
1051
1078
|
prototype.shareElement = function(elementNum){
|
1052
1079
|
var elementNodesName = "element" + elementNum;
|
1053
1080
|
this.fragmentProcessing.push('var '+elementNodesName+' = '+this.getParent()+';');
|
1054
|
-
this.parents[this.parents.length-1] = elementNodesName;
|
1081
|
+
this.parents[this.parents.length-1] = [elementNodesName];
|
1055
1082
|
};
|
1056
1083
|
|
1057
1084
|
prototype.consumeParent = function(i) {
|
1058
|
-
this.
|
1085
|
+
var newParent = this.lastParent().slice();
|
1086
|
+
newParent.push(i);
|
1087
|
+
|
1088
|
+
this.parents.push(newParent);
|
1059
1089
|
};
|
1060
1090
|
|
1061
1091
|
prototype.popParent = function() {
|
@@ -1063,6 +1093,17 @@ define("htmlbars-compiler/hydration-javascript-compiler",
|
|
1063
1093
|
};
|
1064
1094
|
|
1065
1095
|
prototype.getParent = function() {
|
1096
|
+
var last = this.lastParent().slice();
|
1097
|
+
var frag = last.shift();
|
1098
|
+
|
1099
|
+
if (!last.length) {
|
1100
|
+
return frag;
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
return 'dom.childAt(' + frag + ', [' + last.join(', ') + '])';
|
1104
|
+
};
|
1105
|
+
|
1106
|
+
prototype.lastParent = function() {
|
1066
1107
|
return this.parents[this.parents.length-1];
|
1067
1108
|
};
|
1068
1109
|
});
|
@@ -1099,6 +1140,7 @@ define("htmlbars-compiler/hydration-opcode-compiler",
|
|
1099
1140
|
this.currentDOMChildIndex = 0;
|
1100
1141
|
this.morphs = [];
|
1101
1142
|
this.morphNum = 0;
|
1143
|
+
this.attrMorphNum = 0;
|
1102
1144
|
this.element = null;
|
1103
1145
|
this.elementNum = -1;
|
1104
1146
|
}
|
@@ -1130,6 +1172,7 @@ define("htmlbars-compiler/hydration-opcode-compiler",
|
|
1130
1172
|
this.templateId = 0;
|
1131
1173
|
this.currentDOMChildIndex = -1;
|
1132
1174
|
this.morphNum = 0;
|
1175
|
+
this.attrMorphNum = 0;
|
1133
1176
|
|
1134
1177
|
var blockParams = program.blockParams || [];
|
1135
1178
|
|
@@ -1191,8 +1234,6 @@ define("htmlbars-compiler/hydration-opcode-compiler",
|
|
1191
1234
|
|
1192
1235
|
HydrationOpcodeCompiler.prototype.block = function(block, childIndex, childrenLength) {
|
1193
1236
|
var sexpr = block.sexpr;
|
1194
|
-
var program = block.program || {};
|
1195
|
-
var blockParams = program.blockParams || [];
|
1196
1237
|
|
1197
1238
|
var currentDOMChildIndex = this.currentDOMChildIndex;
|
1198
1239
|
var start = (currentDOMChildIndex < 0) ? null : currentDOMChildIndex;
|
@@ -1205,7 +1246,7 @@ define("htmlbars-compiler/hydration-opcode-compiler",
|
|
1205
1246
|
var inverseId = block.inverse === null ? null : this.templateId++;
|
1206
1247
|
|
1207
1248
|
prepareSexpr(this, sexpr);
|
1208
|
-
this.opcode('
|
1249
|
+
this.opcode('printBlockHook', morphNum, templateId, inverseId);
|
1209
1250
|
};
|
1210
1251
|
|
1211
1252
|
HydrationOpcodeCompiler.prototype.component = function(component, childIndex, childrenLength) {
|
@@ -1244,16 +1285,15 @@ define("htmlbars-compiler/hydration-opcode-compiler",
|
|
1244
1285
|
|
1245
1286
|
HydrationOpcodeCompiler.prototype.attribute = function(attr) {
|
1246
1287
|
var value = attr.value;
|
1247
|
-
var
|
1248
|
-
|
1288
|
+
var escaped = true;
|
1289
|
+
|
1249
1290
|
// TODO: Introduce context specific AST nodes to avoid switching here.
|
1250
1291
|
if (value.type === 'TextNode') {
|
1251
1292
|
return;
|
1252
1293
|
} else if (value.type === 'MustacheStatement') {
|
1253
|
-
|
1294
|
+
escaped = value.escaped;
|
1254
1295
|
this.accept(unwrapMustache(value));
|
1255
1296
|
} else if (value.type === 'ConcatStatement') {
|
1256
|
-
quoted = true;
|
1257
1297
|
prepareParams(this, value.parts);
|
1258
1298
|
this.opcode('pushConcatHook');
|
1259
1299
|
}
|
@@ -1265,7 +1305,9 @@ define("htmlbars-compiler/hydration-opcode-compiler",
|
|
1265
1305
|
this.element = null;
|
1266
1306
|
}
|
1267
1307
|
|
1268
|
-
|
1308
|
+
var attrMorphNum = this.attrMorphNum++;
|
1309
|
+
this.opcode('createAttrMorph', attrMorphNum, this.elementNum, attr.name, escaped);
|
1310
|
+
this.opcode('printAttributeHook', attrMorphNum, this.elementNum);
|
1269
1311
|
};
|
1270
1312
|
|
1271
1313
|
HydrationOpcodeCompiler.prototype.elementHelper = function(sexpr) {
|
@@ -1292,10 +1334,10 @@ define("htmlbars-compiler/hydration-opcode-compiler",
|
|
1292
1334
|
|
1293
1335
|
if (isHelper(sexpr)) {
|
1294
1336
|
prepareSexpr(this, sexpr);
|
1295
|
-
this.opcode('
|
1337
|
+
this.opcode('printInlineHook', morphNum);
|
1296
1338
|
} else {
|
1297
1339
|
preparePath(this, sexpr.path);
|
1298
|
-
this.opcode('
|
1340
|
+
this.opcode('printContentHook', morphNum);
|
1299
1341
|
}
|
1300
1342
|
};
|
1301
1343
|
|
@@ -1474,16 +1516,26 @@ define("htmlbars-compiler/template-compiler",
|
|
1474
1516
|
this.getChildTemplateVars(indent + ' ') +
|
1475
1517
|
indent+' return {\n' +
|
1476
1518
|
indent+' isHTMLBars: true,\n' +
|
1519
|
+
indent+' blockParams: ' + blockParams.length + ',\n' +
|
1477
1520
|
indent+' cachedFragment: null,\n' +
|
1521
|
+
indent+' hasRendered: false,\n' +
|
1478
1522
|
indent+' build: ' + fragmentProgram + ',\n' +
|
1479
1523
|
indent+' render: function render(' + templateSignature + ') {\n' +
|
1480
1524
|
indent+' var dom = env.dom;\n' +
|
1481
1525
|
this.getHydrationHooks(indent + ' ', this.hydrationCompiler.hooks) +
|
1482
1526
|
indent+' dom.detectNamespace(contextualElement);\n' +
|
1527
|
+
indent+' var fragment;\n' +
|
1483
1528
|
indent+' if (this.cachedFragment === null) {\n' +
|
1484
|
-
indent+'
|
1529
|
+
indent+' fragment = this.build(dom);\n' +
|
1530
|
+
indent+' if (this.hasRendered) {\n' +
|
1531
|
+
indent+' this.cachedFragment = fragment;\n' +
|
1532
|
+
indent+' } else {\n' +
|
1533
|
+
indent+' this.hasRendered = true;\n' +
|
1534
|
+
indent+' }\n' +
|
1535
|
+
indent+' }\n' +
|
1536
|
+
indent+' if (this.cachedFragment) {\n' +
|
1537
|
+
indent+' fragment = dom.cloneNode(this.cachedFragment, true);\n' +
|
1485
1538
|
indent+' }\n' +
|
1486
|
-
indent+' var fragment = dom.cloneNode(this.cachedFragment, true);\n' +
|
1487
1539
|
hydrationProgram +
|
1488
1540
|
indent+' return fragment;\n' +
|
1489
1541
|
indent+' }\n' +
|
@@ -1538,17 +1590,6 @@ define("htmlbars-compiler/template-visitor",
|
|
1538
1590
|
"use strict";
|
1539
1591
|
var push = Array.prototype.push;
|
1540
1592
|
|
1541
|
-
function elementIntroducesNamespace(element, parentElement){
|
1542
|
-
return (
|
1543
|
-
// Root element. Those that have a namespace are entered.
|
1544
|
-
(!parentElement && element.namespaceURI) ||
|
1545
|
-
// Inner elements to a namespace
|
1546
|
-
( parentElement &&
|
1547
|
-
( !element.isHTMLIntegrationPoint && parentElement.namespaceURI !== element.namespaceURI )
|
1548
|
-
)
|
1549
|
-
);
|
1550
|
-
}
|
1551
|
-
|
1552
1593
|
function Frame() {
|
1553
1594
|
this.parentNode = null;
|
1554
1595
|
this.children = null;
|
@@ -1669,15 +1710,7 @@ define("htmlbars-compiler/template-visitor",
|
|
1669
1710
|
parentNode.type === 'Program' && parentFrame.childCount === 1
|
1670
1711
|
];
|
1671
1712
|
|
1672
|
-
var lastNode = parentFrame.childIndex === parentFrame.childCount-1,
|
1673
|
-
introducesNamespace = elementIntroducesNamespace(element, parentFrame.parentNode);
|
1674
|
-
if ( !lastNode && introducesNamespace ) {
|
1675
|
-
elementFrame.actions.push(['setNamespace', [parentNode.namespaceURI]]);
|
1676
|
-
}
|
1677
1713
|
elementFrame.actions.push(['closeElement', actionArgs]);
|
1678
|
-
if ( !lastNode && element.isHTMLIntergrationPoint ) {
|
1679
|
-
elementFrame.actions.push(['setNamespace', []]);
|
1680
|
-
}
|
1681
1714
|
|
1682
1715
|
for (var i = element.attributes.length - 1; i >= 0; i--) {
|
1683
1716
|
this.visit(element.attributes[i]);
|
@@ -1688,14 +1721,8 @@ define("htmlbars-compiler/template-visitor",
|
|
1688
1721
|
this.visit(element.children[i]);
|
1689
1722
|
}
|
1690
1723
|
|
1691
|
-
if ( element.isHTMLIntergrationPoint ) {
|
1692
|
-
elementFrame.actions.push(['setNamespace', []]);
|
1693
|
-
}
|
1694
1724
|
elementFrame.actions.push(['openElement', actionArgs.concat([
|
1695
1725
|
elementFrame.mustacheCount, elementFrame.blankChildTextNodes.reverse() ])]);
|
1696
|
-
if ( introducesNamespace ) {
|
1697
|
-
elementFrame.actions.push(['setNamespace', [element.namespaceURI]]);
|
1698
|
-
}
|
1699
1726
|
this.popFrame();
|
1700
1727
|
|
1701
1728
|
// Propagate the element's frame state to the parent frame
|
@@ -1863,7 +1890,7 @@ define("htmlbars-syntax/builders",
|
|
1863
1890
|
__exports__.buildPartial = buildPartial;function buildComment(value) {
|
1864
1891
|
return {
|
1865
1892
|
type: "CommentStatement",
|
1866
|
-
value: value
|
1893
|
+
value: value
|
1867
1894
|
};
|
1868
1895
|
}
|
1869
1896
|
|
@@ -3237,16 +3264,15 @@ define("htmlbars-syntax/handlebars/utils",
|
|
3237
3264
|
__exports__.appendContextPath = appendContextPath;
|
3238
3265
|
});
|
3239
3266
|
define("htmlbars-syntax/node-handlers",
|
3240
|
-
["./builders","
|
3241
|
-
function(__dependency1__, __dependency2__, __dependency3__,
|
3267
|
+
["./builders","../htmlbars-util/array-utils","./utils","exports"],
|
3268
|
+
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
3242
3269
|
"use strict";
|
3243
3270
|
var buildProgram = __dependency1__.buildProgram;
|
3244
3271
|
var buildBlock = __dependency1__.buildBlock;
|
3245
3272
|
var buildHash = __dependency1__.buildHash;
|
3246
|
-
var
|
3247
|
-
var
|
3248
|
-
var
|
3249
|
-
var postprocessProgram = __dependency4__.postprocessProgram;
|
3273
|
+
var forEach = __dependency2__.forEach;
|
3274
|
+
var appendChild = __dependency3__.appendChild;
|
3275
|
+
var postprocessProgram = __dependency3__.postprocessProgram;
|
3250
3276
|
|
3251
3277
|
var nodeHandlers = {
|
3252
3278
|
|
@@ -3282,7 +3308,7 @@ define("htmlbars-syntax/node-handlers",
|
|
3282
3308
|
delete block.closeStrip;
|
3283
3309
|
|
3284
3310
|
if (this.tokenizer.state === 'comment') {
|
3285
|
-
this.tokenizer.
|
3311
|
+
this.tokenizer.addChar('{{' + this.sourceForMustache(block) + '}}');
|
3286
3312
|
return;
|
3287
3313
|
}
|
3288
3314
|
|
@@ -3302,7 +3328,7 @@ define("htmlbars-syntax/node-handlers",
|
|
3302
3328
|
delete mustache.strip;
|
3303
3329
|
|
3304
3330
|
if (this.tokenizer.state === 'comment') {
|
3305
|
-
this.tokenizer.
|
3331
|
+
this.tokenizer.addChar('{{' + this.sourceForMustache(mustache) + '}}');
|
3306
3332
|
return;
|
3307
3333
|
}
|
3308
3334
|
|
@@ -3380,8 +3406,7 @@ define("htmlbars-syntax/node-handlers",
|
|
3380
3406
|
function switchToHandlebars(processor) {
|
3381
3407
|
var token = processor.tokenizer.token;
|
3382
3408
|
|
3383
|
-
|
3384
|
-
if (token instanceof Chars) {
|
3409
|
+
if (token && token.type === 'Chars') {
|
3385
3410
|
processor.acceptToken(token);
|
3386
3411
|
processor.tokenizer.token = null;
|
3387
3412
|
}
|
@@ -3405,7 +3430,7 @@ define("htmlbars-syntax/node-handlers",
|
|
3405
3430
|
__exports__["default"] = nodeHandlers;
|
3406
3431
|
});
|
3407
3432
|
define("htmlbars-syntax/parser",
|
3408
|
-
["./handlebars/compiler/base","
|
3433
|
+
["./handlebars/compiler/base","./tokenizer","../simple-html-tokenizer/entity-parser","../simple-html-tokenizer/char-refs/full","./node-handlers","./token-handlers","../htmlbars-syntax","exports"],
|
3409
3434
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __exports__) {
|
3410
3435
|
"use strict";
|
3411
3436
|
var parse = __dependency1__.parse;
|
@@ -3522,28 +3547,6 @@ define("htmlbars-syntax/token-handlers",
|
|
3522
3547
|
voidMap[tagName] = true;
|
3523
3548
|
});
|
3524
3549
|
|
3525
|
-
var svgNamespace = "http://www.w3.org/2000/svg",
|
3526
|
-
// http://www.w3.org/html/wg/drafts/html/master/syntax.html#html-integration-point
|
3527
|
-
svgHTMLIntegrationPoints = {'foreignObject':true, 'desc':true, 'title':true};
|
3528
|
-
|
3529
|
-
function applyNamespace(tag, element, currentElement){
|
3530
|
-
if (tag.tagName === 'svg') {
|
3531
|
-
element.namespaceURI = svgNamespace;
|
3532
|
-
} else if (
|
3533
|
-
currentElement.type === 'ElementNode' &&
|
3534
|
-
currentElement.namespaceURI &&
|
3535
|
-
!currentElement.isHTMLIntegrationPoint
|
3536
|
-
) {
|
3537
|
-
element.namespaceURI = currentElement.namespaceURI;
|
3538
|
-
}
|
3539
|
-
}
|
3540
|
-
|
3541
|
-
function applyHTMLIntegrationPoint(tag, element){
|
3542
|
-
if (svgHTMLIntegrationPoints[tag.tagName]) {
|
3543
|
-
element.isHTMLIntegrationPoint = true;
|
3544
|
-
}
|
3545
|
-
}
|
3546
|
-
|
3547
3550
|
// Except for `mustache`, all tokens are only allowed outside of
|
3548
3551
|
// a start or end tag.
|
3549
3552
|
var tokenHandlers = {
|
@@ -3566,8 +3569,6 @@ define("htmlbars-syntax/token-handlers",
|
|
3566
3569
|
end: { line: null, column: null}
|
3567
3570
|
};
|
3568
3571
|
|
3569
|
-
applyNamespace(tag, element, this.currentElement());
|
3570
|
-
applyHTMLIntegrationPoint(tag, element);
|
3571
3572
|
this.elementStack.push(element);
|
3572
3573
|
if (voidMap.hasOwnProperty(tag.tagName) || tag.selfClosing) {
|
3573
3574
|
tokenHandlers.EndTag.call(this, tag);
|
@@ -3583,39 +3584,38 @@ define("htmlbars-syntax/token-handlers",
|
|
3583
3584
|
},
|
3584
3585
|
|
3585
3586
|
MustacheStatement: function(mustache) {
|
3586
|
-
var
|
3587
|
-
var token = this.tokenizer.token;
|
3587
|
+
var tokenizer = this.tokenizer;
|
3588
3588
|
|
3589
|
-
switch(state) {
|
3589
|
+
switch(tokenizer.state) {
|
3590
3590
|
// Tag helpers
|
3591
3591
|
case "tagName":
|
3592
|
-
|
3593
|
-
|
3592
|
+
tokenizer.addTagHelper(mustache.sexpr);
|
3593
|
+
tokenizer.state = "beforeAttributeName";
|
3594
3594
|
return;
|
3595
3595
|
case "beforeAttributeName":
|
3596
|
-
|
3596
|
+
tokenizer.addTagHelper(mustache.sexpr);
|
3597
3597
|
return;
|
3598
3598
|
case "attributeName":
|
3599
3599
|
case "afterAttributeName":
|
3600
|
-
|
3601
|
-
|
3602
|
-
|
3600
|
+
tokenizer.finalizeAttributeValue();
|
3601
|
+
tokenizer.addTagHelper(mustache.sexpr);
|
3602
|
+
tokenizer.state = "beforeAttributeName";
|
3603
3603
|
return;
|
3604
3604
|
case "afterAttributeValueQuoted":
|
3605
|
-
|
3606
|
-
|
3605
|
+
tokenizer.addTagHelper(mustache.sexpr);
|
3606
|
+
tokenizer.state = "beforeAttributeName";
|
3607
3607
|
return;
|
3608
3608
|
|
3609
3609
|
// Attribute values
|
3610
3610
|
case "beforeAttributeValue":
|
3611
|
-
|
3612
|
-
|
3613
|
-
|
3611
|
+
tokenizer.markAttributeQuoted(false);
|
3612
|
+
tokenizer.addToAttributeValue(mustache);
|
3613
|
+
tokenizer.state = 'attributeValueUnquoted';
|
3614
3614
|
return;
|
3615
3615
|
case "attributeValueDoubleQuoted":
|
3616
3616
|
case "attributeValueSingleQuoted":
|
3617
3617
|
case "attributeValueUnquoted":
|
3618
|
-
|
3618
|
+
tokenizer.addToAttributeValue(mustache);
|
3619
3619
|
return;
|
3620
3620
|
|
3621
3621
|
// TODO: Only append child when the tokenizer state makes
|
@@ -3630,12 +3630,7 @@ define("htmlbars-syntax/token-handlers",
|
|
3630
3630
|
var parent = this.currentElement();
|
3631
3631
|
var disableComponentGeneration = this.options.disableComponentGeneration === true;
|
3632
3632
|
|
3633
|
-
|
3634
|
-
throw new Error(
|
3635
|
-
"Closing tag `" + tag.tagName + "` (on line " + tag.lastLine + ") " +
|
3636
|
-
"did not match last open tag `" + element.tag + "` (on line " + element.loc.start.line + ")."
|
3637
|
-
);
|
3638
|
-
}
|
3633
|
+
validateEndTag(tag, element);
|
3639
3634
|
|
3640
3635
|
if (disableComponentGeneration || element.tag.indexOf("-") === -1) {
|
3641
3636
|
appendChild(parent, element);
|
@@ -3651,32 +3646,52 @@ define("htmlbars-syntax/token-handlers",
|
|
3651
3646
|
|
3652
3647
|
};
|
3653
3648
|
|
3649
|
+
function validateEndTag(tag, element) {
|
3650
|
+
var error;
|
3651
|
+
|
3652
|
+
if (voidMap[tag.tagName] && element.tag === undefined) {
|
3653
|
+
// For void elements, we check element.tag is undefined because endTag is called by the startTag token handler in
|
3654
|
+
// the normal case, so checking only voidMap[tag.tagName] would lead to an error being thrown on the opening tag.
|
3655
|
+
error = "Invalid end tag " + formatEndTagInfo(tag) + " (void elements cannot have end tags).";
|
3656
|
+
} else if (element.tag === undefined) {
|
3657
|
+
error = "Closing tag " + formatEndTagInfo(tag) + " without an open tag.";
|
3658
|
+
} else if (element.tag !== tag.tagName) {
|
3659
|
+
error = "Closing tag " + formatEndTagInfo(tag) + " did not match last open tag `" + element.tag + "` (on line " +
|
3660
|
+
element.loc.start.line + ").";
|
3661
|
+
}
|
3662
|
+
|
3663
|
+
if (error) { throw new Error(error); }
|
3664
|
+
}
|
3665
|
+
|
3666
|
+
function formatEndTagInfo(tag) {
|
3667
|
+
return "`" + tag.tagName + "` (on line " + tag.lastLine + ")";
|
3668
|
+
}
|
3669
|
+
|
3654
3670
|
__exports__["default"] = tokenHandlers;
|
3655
3671
|
});
|
3656
|
-
define("htmlbars-syntax/
|
3672
|
+
define("htmlbars-syntax/tokenizer",
|
3657
3673
|
["../simple-html-tokenizer","./utils","./builders","exports"],
|
3658
3674
|
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
3659
3675
|
"use strict";
|
3660
|
-
var
|
3661
|
-
var StartTag = __dependency1__.StartTag;
|
3662
|
-
var EndTag = __dependency1__.EndTag;
|
3676
|
+
var Tokenizer = __dependency1__.Tokenizer;
|
3663
3677
|
var isHelper = __dependency2__.isHelper;
|
3664
3678
|
var builders = __dependency3__["default"];
|
3665
3679
|
|
3666
|
-
|
3680
|
+
Tokenizer.prototype.createAttribute = function(char) {
|
3667
3681
|
this.currentAttribute = builders.attr(char.toLowerCase(), [], null);
|
3668
|
-
this.attributes.push(this.currentAttribute);
|
3682
|
+
this.token.attributes.push(this.currentAttribute);
|
3683
|
+
this.state = 'attributeName';
|
3669
3684
|
};
|
3670
3685
|
|
3671
|
-
|
3686
|
+
Tokenizer.prototype.markAttributeQuoted = function(value) {
|
3672
3687
|
this.currentAttribute.quoted = value;
|
3673
3688
|
};
|
3674
3689
|
|
3675
|
-
|
3690
|
+
Tokenizer.prototype.addToAttributeName = function(char) {
|
3676
3691
|
this.currentAttribute.name += char;
|
3677
3692
|
};
|
3678
3693
|
|
3679
|
-
|
3694
|
+
Tokenizer.prototype.addToAttributeValue = function(char) {
|
3680
3695
|
var value = this.currentAttribute.value;
|
3681
3696
|
|
3682
3697
|
if (!this.currentAttribute.quoted && value.length > 0 &&
|
@@ -3702,12 +3717,7 @@ define("htmlbars-syntax/tokens",
|
|
3702
3717
|
}
|
3703
3718
|
};
|
3704
3719
|
|
3705
|
-
|
3706
|
-
this.finalizeAttributeValue();
|
3707
|
-
return this;
|
3708
|
-
};
|
3709
|
-
|
3710
|
-
StartTag.prototype.finalizeAttributeValue = function() {
|
3720
|
+
Tokenizer.prototype.finalizeAttributeValue = function() {
|
3711
3721
|
if (this.currentAttribute) {
|
3712
3722
|
this.currentAttribute.value = prepareAttributeValue(this.currentAttribute);
|
3713
3723
|
delete this.currentAttribute.quoted;
|
@@ -3715,8 +3725,8 @@ define("htmlbars-syntax/tokens",
|
|
3715
3725
|
}
|
3716
3726
|
};
|
3717
3727
|
|
3718
|
-
|
3719
|
-
var helpers = this.helpers = this.helpers || [];
|
3728
|
+
Tokenizer.prototype.addTagHelper = function(helper) {
|
3729
|
+
var helpers = this.token.helpers = this.token.helpers || [];
|
3720
3730
|
helpers.push(helper);
|
3721
3731
|
};
|
3722
3732
|
|
@@ -3750,9 +3760,7 @@ define("htmlbars-syntax/tokens",
|
|
3750
3760
|
}
|
3751
3761
|
}
|
3752
3762
|
|
3753
|
-
__exports__.unwrapMustache = unwrapMustache;__exports__.
|
3754
|
-
__exports__.StartTag = StartTag;
|
3755
|
-
__exports__.EndTag = EndTag;
|
3763
|
+
__exports__.unwrapMustache = unwrapMustache;__exports__.Tokenizer = Tokenizer;
|
3756
3764
|
});
|
3757
3765
|
define("htmlbars-syntax/utils",
|
3758
3766
|
["./builders","exports"],
|
@@ -6558,39 +6566,50 @@ define("simple-html-tokenizer/tokenizer",
|
|
6558
6566
|
}
|
6559
6567
|
},
|
6560
6568
|
|
6561
|
-
|
6569
|
+
createTag: function(Type, char) {
|
6562
6570
|
var lastToken = this.token;
|
6563
6571
|
this.token = new Type(char);
|
6564
6572
|
this.state = 'tagName';
|
6565
6573
|
return lastToken;
|
6566
6574
|
},
|
6567
6575
|
|
6576
|
+
addToTagName: function(char) {
|
6577
|
+
this.token.tagName += char;
|
6578
|
+
},
|
6579
|
+
|
6568
6580
|
selfClosing: function() {
|
6569
6581
|
this.token.selfClosing = true;
|
6570
6582
|
},
|
6571
6583
|
|
6572
|
-
|
6573
|
-
this.
|
6584
|
+
createAttribute: function(char) {
|
6585
|
+
this._currentAttribute = [char.toLowerCase(), "", null];
|
6586
|
+
this.token.attributes.push(this._currentAttribute);
|
6574
6587
|
this.state = 'attributeName';
|
6575
6588
|
},
|
6576
6589
|
|
6577
6590
|
addToAttributeName: function(char) {
|
6578
|
-
this.
|
6591
|
+
this._currentAttribute[0] += char;
|
6579
6592
|
},
|
6580
6593
|
|
6581
6594
|
markAttributeQuoted: function(value) {
|
6582
|
-
this.
|
6595
|
+
this._currentAttribute[2] = value;
|
6583
6596
|
},
|
6584
6597
|
|
6585
6598
|
finalizeAttributeValue: function() {
|
6586
|
-
this.
|
6599
|
+
if (this._currentAttribute) {
|
6600
|
+
if (this._currentAttribute[2] === null) {
|
6601
|
+
this._currentAttribute[2] = false;
|
6602
|
+
}
|
6603
|
+
this._currentAttribute = undefined;
|
6604
|
+
}
|
6587
6605
|
},
|
6588
6606
|
|
6589
6607
|
addToAttributeValue: function(char) {
|
6590
|
-
this.
|
6608
|
+
this._currentAttribute[1] = this._currentAttribute[1] || "";
|
6609
|
+
this._currentAttribute[1] += char;
|
6591
6610
|
},
|
6592
6611
|
|
6593
|
-
|
6612
|
+
createComment: function() {
|
6594
6613
|
var lastToken = this.token;
|
6595
6614
|
this.token = new Comment();
|
6596
6615
|
this.state = 'commentStart';
|
@@ -6598,7 +6617,18 @@ define("simple-html-tokenizer/tokenizer",
|
|
6598
6617
|
},
|
6599
6618
|
|
6600
6619
|
addToComment: function(char) {
|
6601
|
-
this.
|
6620
|
+
this.addChar(char);
|
6621
|
+
},
|
6622
|
+
|
6623
|
+
addChar: function(char) {
|
6624
|
+
this.token.chars += char;
|
6625
|
+
},
|
6626
|
+
|
6627
|
+
finalizeToken: function() {
|
6628
|
+
if (this.token.type === 'StartTag') {
|
6629
|
+
this.finalizeAttributeValue();
|
6630
|
+
}
|
6631
|
+
return this.token;
|
6602
6632
|
},
|
6603
6633
|
|
6604
6634
|
emitData: function() {
|
@@ -6611,7 +6641,7 @@ define("simple-html-tokenizer/tokenizer",
|
|
6611
6641
|
|
6612
6642
|
emitToken: function() {
|
6613
6643
|
this.addLocInfo();
|
6614
|
-
var lastToken = this.
|
6644
|
+
var lastToken = this.finalizeToken();
|
6615
6645
|
this.token = null;
|
6616
6646
|
this.state = 'data';
|
6617
6647
|
return lastToken;
|
@@ -6623,7 +6653,7 @@ define("simple-html-tokenizer/tokenizer",
|
|
6623
6653
|
this.markFirst();
|
6624
6654
|
}
|
6625
6655
|
|
6626
|
-
this.
|
6656
|
+
this.addChar(char);
|
6627
6657
|
},
|
6628
6658
|
|
6629
6659
|
markFirst: function(line, column) {
|
@@ -6655,7 +6685,6 @@ define("simple-html-tokenizer/tokenizer",
|
|
6655
6685
|
} else {
|
6656
6686
|
this.column++;
|
6657
6687
|
}
|
6658
|
-
// console.log(this.state, char);
|
6659
6688
|
return this.states[this.state].call(this, char);
|
6660
6689
|
} else {
|
6661
6690
|
this.addLocInfo(this.line, this.column);
|
@@ -6682,14 +6711,14 @@ define("simple-html-tokenizer/tokenizer",
|
|
6682
6711
|
} else if (char === "/") {
|
6683
6712
|
this.state = 'endTagOpen';
|
6684
6713
|
} else if (isAlpha(char)) {
|
6685
|
-
return this.
|
6714
|
+
return this.createTag(StartTag, char.toLowerCase());
|
6686
6715
|
}
|
6687
6716
|
},
|
6688
6717
|
|
6689
6718
|
markupDeclaration: function(char) {
|
6690
6719
|
if (char === "-" && this.input.charAt(this["char"]) === "-") {
|
6691
6720
|
this["char"]++;
|
6692
|
-
this.
|
6721
|
+
this.createComment();
|
6693
6722
|
}
|
6694
6723
|
},
|
6695
6724
|
|
@@ -6749,7 +6778,7 @@ define("simple-html-tokenizer/tokenizer",
|
|
6749
6778
|
} else if (char === ">") {
|
6750
6779
|
return this.emitToken();
|
6751
6780
|
} else {
|
6752
|
-
this.
|
6781
|
+
this.addToTagName(char);
|
6753
6782
|
}
|
6754
6783
|
},
|
6755
6784
|
|
@@ -6761,7 +6790,7 @@ define("simple-html-tokenizer/tokenizer",
|
|
6761
6790
|
} else if (char === ">") {
|
6762
6791
|
return this.emitToken();
|
6763
6792
|
} else {
|
6764
|
-
this.
|
6793
|
+
this.createAttribute(char);
|
6765
6794
|
}
|
6766
6795
|
},
|
6767
6796
|
|
@@ -6790,7 +6819,7 @@ define("simple-html-tokenizer/tokenizer",
|
|
6790
6819
|
return this.emitToken();
|
6791
6820
|
} else {
|
6792
6821
|
this.finalizeAttributeValue();
|
6793
|
-
this.
|
6822
|
+
this.createAttribute(char);
|
6794
6823
|
}
|
6795
6824
|
},
|
6796
6825
|
|
@@ -6872,7 +6901,7 @@ define("simple-html-tokenizer/tokenizer",
|
|
6872
6901
|
|
6873
6902
|
endTagOpen: function(char) {
|
6874
6903
|
if (isAlpha(char)) {
|
6875
|
-
this.
|
6904
|
+
this.createTag(EndTag, char.toLowerCase());
|
6876
6905
|
}
|
6877
6906
|
}
|
6878
6907
|
}
|
@@ -6889,84 +6918,24 @@ define("simple-html-tokenizer/tokens",
|
|
6889
6918
|
this.tagName = tagName || '';
|
6890
6919
|
this.attributes = attributes || [];
|
6891
6920
|
this.selfClosing = selfClosing === true;
|
6892
|
-
this._currentAttribute = undefined;
|
6893
6921
|
}
|
6894
6922
|
|
6895
|
-
__exports__.StartTag = StartTag;
|
6896
|
-
addToTagName: function(char) {
|
6897
|
-
this.tagName += char;
|
6898
|
-
},
|
6899
|
-
|
6900
|
-
startAttribute: function(char) {
|
6901
|
-
this._currentAttribute = [char.toLowerCase(), "", null];
|
6902
|
-
this.attributes.push(this._currentAttribute);
|
6903
|
-
},
|
6904
|
-
|
6905
|
-
addToAttributeName: function(char) {
|
6906
|
-
this._currentAttribute[0] += char;
|
6907
|
-
},
|
6908
|
-
|
6909
|
-
markAttributeQuoted: function(value) {
|
6910
|
-
this._currentAttribute[2] = value;
|
6911
|
-
},
|
6912
|
-
|
6913
|
-
addToAttributeValue: function(char) {
|
6914
|
-
this._currentAttribute[1] = this._currentAttribute[1] || "";
|
6915
|
-
this._currentAttribute[1] += char;
|
6916
|
-
},
|
6917
|
-
|
6918
|
-
finalizeAttributeValue: function() {
|
6919
|
-
if (this._currentAttribute) {
|
6920
|
-
if (this._currentAttribute[2] === null) {
|
6921
|
-
this._currentAttribute[2] = false;
|
6922
|
-
}
|
6923
|
-
this._currentAttribute = undefined;
|
6924
|
-
}
|
6925
|
-
},
|
6926
|
-
|
6927
|
-
finalize: function() {
|
6928
|
-
this.finalizeAttributeValue();
|
6929
|
-
return this;
|
6930
|
-
}
|
6931
|
-
};
|
6932
|
-
|
6933
|
-
function EndTag(tagName) {
|
6923
|
+
__exports__.StartTag = StartTag;function EndTag(tagName) {
|
6934
6924
|
this.type = 'EndTag';
|
6935
6925
|
this.tagName = tagName || '';
|
6936
6926
|
}
|
6937
6927
|
|
6938
|
-
__exports__.EndTag = EndTag;
|
6939
|
-
addToTagName: function(char) {
|
6940
|
-
this.tagName += char;
|
6941
|
-
},
|
6942
|
-
finalize: function () {
|
6943
|
-
return this;
|
6944
|
-
}
|
6945
|
-
};
|
6946
|
-
|
6947
|
-
function Chars(chars) {
|
6928
|
+
__exports__.EndTag = EndTag;function Chars(chars) {
|
6948
6929
|
this.type = 'Chars';
|
6949
6930
|
this.chars = chars || "";
|
6950
6931
|
}
|
6951
6932
|
|
6952
|
-
__exports__.Chars = Chars;
|
6953
|
-
addChar: function(char) {
|
6954
|
-
this.chars += char;
|
6955
|
-
}
|
6956
|
-
};
|
6957
|
-
|
6958
|
-
function Comment(chars) {
|
6933
|
+
__exports__.Chars = Chars;function Comment(chars) {
|
6959
6934
|
this.type = 'Comment';
|
6960
6935
|
this.chars = chars || '';
|
6961
6936
|
}
|
6962
6937
|
|
6963
|
-
__exports__.Comment = Comment;
|
6964
|
-
addChar: function(char) {
|
6965
|
-
this.chars += char;
|
6966
|
-
},
|
6967
|
-
|
6968
|
-
finalize: function() { return this; }
|
6969
|
-
};
|
6938
|
+
__exports__.Comment = Comment;
|
6970
6939
|
});
|
6971
6940
|
define("simple-html-tokenizer/utils",
|
6972
6941
|
["exports"],
|