chore: kill ListWrapper.create() and .push().
These wrappers are not natively understood by ts2dart. Removing them will improve Dart2JS compilation due to fewer megamorphic calls to List functions. It also makes Angular code more succinct and improves type safety in Angular due to better type inference of the Array component type. This change exposed several bugs in Angular.
This commit is contained in:
@ -17,14 +17,14 @@ export class AbstractChangeDetector extends ChangeDetector {
|
||||
}
|
||||
|
||||
addChild(cd: ChangeDetector): void {
|
||||
ListWrapper.push(this.lightDomChildren, cd);
|
||||
this.lightDomChildren.push(cd);
|
||||
cd.parent = this;
|
||||
}
|
||||
|
||||
removeChild(cd: ChangeDetector): void { ListWrapper.remove(this.lightDomChildren, cd); }
|
||||
|
||||
addShadowDomChild(cd: ChangeDetector): void {
|
||||
ListWrapper.push(this.shadowDomChildren, cd);
|
||||
this.shadowDomChildren.push(cd);
|
||||
cd.parent = this;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ import {RecordType, ProtoRecord} from './proto_record';
|
||||
* replaced with very cheap SELF records.
|
||||
*/
|
||||
export function coalesce(records: List<ProtoRecord>): List<ProtoRecord> {
|
||||
var res: List<ProtoRecord> = ListWrapper.create();
|
||||
var res: List<ProtoRecord> = [];
|
||||
var indexMap: Map<number, number> = MapWrapper.create();
|
||||
|
||||
for (var i = 0; i < records.length; ++i) {
|
||||
@ -22,14 +22,14 @@ export function coalesce(records: List<ProtoRecord>): List<ProtoRecord> {
|
||||
var matchingRecord = _findMatching(record, res);
|
||||
|
||||
if (isPresent(matchingRecord) && record.lastInBinding) {
|
||||
ListWrapper.push(res, _selfRecord(record, matchingRecord.selfIndex, res.length + 1));
|
||||
res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1));
|
||||
MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
|
||||
|
||||
} else if (isPresent(matchingRecord) && !record.lastInBinding) {
|
||||
MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
|
||||
|
||||
} else {
|
||||
ListWrapper.push(res, record);
|
||||
res.push(record);
|
||||
MapWrapper.set(indexMap, r.selfIndex, record.selfIndex);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ enum TokenType {
|
||||
var tokens = [];
|
||||
var token = scanner.scanToken();
|
||||
while (token != null) {
|
||||
ListWrapper.push(tokens, token);
|
||||
tokens.push(token);
|
||||
token = scanner.scanToken();
|
||||
}
|
||||
return tokens;
|
||||
|
@ -99,11 +99,11 @@ export class Parser {
|
||||
var part = parts[i];
|
||||
if (i % 2 === 0) {
|
||||
// fixed string
|
||||
ListWrapper.push(strings, part);
|
||||
strings.push(part);
|
||||
} else {
|
||||
var tokens = this._lexer.tokenize(part);
|
||||
var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain();
|
||||
ListWrapper.push(expressions, ast);
|
||||
expressions.push(ast);
|
||||
}
|
||||
}
|
||||
return new ASTWithSource(new Interpolation(strings, expressions), input, location);
|
||||
@ -194,7 +194,7 @@ class _ParseAST {
|
||||
var exprs = [];
|
||||
while (this.index < this.tokens.length) {
|
||||
var expr = this.parsePipe();
|
||||
ListWrapper.push(exprs, expr);
|
||||
exprs.push(expr);
|
||||
|
||||
if (this.optionalCharacter($SEMICOLON)) {
|
||||
if (!this.parseAction) {
|
||||
@ -222,7 +222,7 @@ class _ParseAST {
|
||||
var name = this.expectIdentifierOrKeyword();
|
||||
var args = [];
|
||||
while (this.optionalCharacter($COLON)) {
|
||||
ListWrapper.push(args, this.parsePipe());
|
||||
args.push(this.parsePipe());
|
||||
}
|
||||
result = new Pipe(result, name, args, true);
|
||||
} while (this.optionalOperator("|"));
|
||||
@ -456,7 +456,7 @@ class _ParseAST {
|
||||
var result = [];
|
||||
if (!this.next.isCharacter(terminator)) {
|
||||
do {
|
||||
ListWrapper.push(result, this.parsePipe());
|
||||
result.push(this.parsePipe());
|
||||
} while (this.optionalCharacter($COMMA));
|
||||
}
|
||||
return result;
|
||||
@ -469,9 +469,9 @@ class _ParseAST {
|
||||
if (!this.optionalCharacter($RBRACE)) {
|
||||
do {
|
||||
var key = this.expectIdentifierOrKeywordOrString();
|
||||
ListWrapper.push(keys, key);
|
||||
keys.push(key);
|
||||
this.expectCharacter($COLON);
|
||||
ListWrapper.push(values, this.parsePipe());
|
||||
values.push(this.parsePipe());
|
||||
} while (this.optionalCharacter($COMMA));
|
||||
this.expectCharacter($RBRACE);
|
||||
}
|
||||
@ -500,7 +500,7 @@ class _ParseAST {
|
||||
if (this.next.isCharacter($RPAREN)) return [];
|
||||
var positionals = [];
|
||||
do {
|
||||
ListWrapper.push(positionals, this.parsePipe());
|
||||
positionals.push(this.parsePipe());
|
||||
} while (this.optionalCharacter($COMMA));
|
||||
return positionals;
|
||||
}
|
||||
@ -522,7 +522,7 @@ class _ParseAST {
|
||||
var exprs = [];
|
||||
while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) {
|
||||
var expr = this.parseExpression();
|
||||
ListWrapper.push(exprs, expr);
|
||||
exprs.push(expr);
|
||||
|
||||
if (this.optionalCharacter($SEMICOLON)) {
|
||||
while (this.optionalCharacter($SEMICOLON)) {
|
||||
@ -581,7 +581,7 @@ class _ParseAST {
|
||||
var source = this.input.substring(start, this.inputIndex);
|
||||
expression = new ASTWithSource(ast, source, this.location);
|
||||
}
|
||||
ListWrapper.push(bindings, new TemplateBinding(key, keyIsVar, name, expression));
|
||||
bindings.push(new TemplateBinding(key, keyIsVar, name, expression));
|
||||
if (!this.optionalCharacter($SEMICOLON)) {
|
||||
this.optionalCharacter($COMMA);
|
||||
}
|
||||
|
@ -448,26 +448,26 @@ export class IterableChanges extends Pipe {
|
||||
|
||||
var list = [];
|
||||
for (record = this._itHead; record !== null; record = record._next) {
|
||||
ListWrapper.push(list, record);
|
||||
list.push(record);
|
||||
}
|
||||
|
||||
var previous = [];
|
||||
for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
|
||||
ListWrapper.push(previous, record);
|
||||
previous.push(record);
|
||||
}
|
||||
|
||||
var additions = [];
|
||||
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
||||
ListWrapper.push(additions, record);
|
||||
additions.push(record);
|
||||
}
|
||||
var moves = [];
|
||||
for (record = this._movesHead; record !== null; record = record._nextMoved) {
|
||||
ListWrapper.push(moves, record);
|
||||
moves.push(record);
|
||||
}
|
||||
|
||||
var removals = [];
|
||||
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
||||
ListWrapper.push(removals, record);
|
||||
removals.push(record);
|
||||
}
|
||||
|
||||
return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
|
||||
|
@ -299,19 +299,19 @@ export class KeyValueChanges extends Pipe {
|
||||
var record: KVChangeRecord;
|
||||
|
||||
for (record = this._mapHead; record !== null; record = record._next) {
|
||||
ListWrapper.push(items, stringify(record));
|
||||
items.push(stringify(record));
|
||||
}
|
||||
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
|
||||
ListWrapper.push(previous, stringify(record));
|
||||
previous.push(stringify(record));
|
||||
}
|
||||
for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
||||
ListWrapper.push(changes, stringify(record));
|
||||
changes.push(stringify(record));
|
||||
}
|
||||
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
||||
ListWrapper.push(additions, stringify(record));
|
||||
additions.push(stringify(record));
|
||||
}
|
||||
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
||||
ListWrapper.push(removals, stringify(record));
|
||||
removals.push(stringify(record));
|
||||
}
|
||||
|
||||
return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
|
||||
|
@ -82,10 +82,9 @@ export class ProtoRecordBuilder {
|
||||
|
||||
_appendRecords(b: BindingRecord, variableNames: List<string>) {
|
||||
if (b.isDirectiveLifecycle()) {
|
||||
ListWrapper.push(
|
||||
this.records,
|
||||
new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [], [], -1, null,
|
||||
this.records.length + 1, b, null, false, false));
|
||||
this.records.push(new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [],
|
||||
[], -1, null, this.records.length + 1, b, null, false,
|
||||
false));
|
||||
} else {
|
||||
_ConvertAstIntoProtoRecords.append(this.records, b, variableNames);
|
||||
}
|
||||
@ -215,13 +214,13 @@ class _ConvertAstIntoProtoRecords implements AstVisitor {
|
||||
_addRecord(type, name, funcOrValue, args, fixedArgs, context) {
|
||||
var selfIndex = this._records.length + 1;
|
||||
if (context instanceof DirectiveIndex) {
|
||||
ListWrapper.push(this._records, new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1,
|
||||
context, selfIndex, this._bindingRecord,
|
||||
this._expressionAsString, false, false));
|
||||
this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context,
|
||||
selfIndex, this._bindingRecord, this._expressionAsString,
|
||||
false, false));
|
||||
} else {
|
||||
ListWrapper.push(this._records, new ProtoRecord(type, name, funcOrValue, args, fixedArgs,
|
||||
context, null, selfIndex, this._bindingRecord,
|
||||
this._expressionAsString, false, false));
|
||||
this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null,
|
||||
selfIndex, this._bindingRecord, this._expressionAsString,
|
||||
false, false));
|
||||
}
|
||||
return selfIndex;
|
||||
}
|
||||
|
@ -342,9 +342,9 @@ export class ApplicationRef {
|
||||
function _createAppInjector(appComponentType: Type, bindings: List<Type | Binding | List<any>>,
|
||||
zone: NgZone): Injector {
|
||||
if (isBlank(_rootInjector)) _rootInjector = Injector.resolveAndCreate(_rootBindings);
|
||||
var mergedBindings = isPresent(bindings) ?
|
||||
ListWrapper.concat(_injectorBindings(appComponentType), bindings) :
|
||||
_injectorBindings(appComponentType);
|
||||
ListWrapper.push(mergedBindings, bind(NgZone).toValue(zone));
|
||||
var mergedBindings: any[] =
|
||||
isPresent(bindings) ? ListWrapper.concat(_injectorBindings(appComponentType), bindings) :
|
||||
_injectorBindings(appComponentType);
|
||||
mergedBindings.push(bind(NgZone).toValue(zone));
|
||||
return _rootInjector.resolveAndCreateChild(mergedBindings);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export class BaseQueryList<T> {
|
||||
}
|
||||
|
||||
add(obj) {
|
||||
ListWrapper.push(this._results, obj);
|
||||
this._results.push(obj);
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ export class BaseQueryList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
onChange(callback) { ListWrapper.push(this._callbacks, callback); }
|
||||
onChange(callback) { this._callbacks.push(callback); }
|
||||
|
||||
removeCallback(callback) { ListWrapper.remove(this._callbacks, callback); }
|
||||
|
||||
|
@ -187,8 +187,7 @@ export class Compiler {
|
||||
(nestedPv: AppProtoView) => { elementBinder.nestedProtoView = nestedPv; };
|
||||
var nestedCall = this._compile(nestedComponent);
|
||||
if (isPromise(nestedCall)) {
|
||||
ListWrapper.push(nestedPVPromises,
|
||||
(<Promise<AppProtoView>>nestedCall).then(elementBinderDone));
|
||||
nestedPVPromises.push((<Promise<AppProtoView>>nestedCall).then(elementBinderDone));
|
||||
} else {
|
||||
elementBinderDone(<AppProtoView>nestedCall);
|
||||
}
|
||||
@ -206,7 +205,7 @@ export class Compiler {
|
||||
ListWrapper.forEach(protoViews, (protoView) => {
|
||||
ListWrapper.forEach(protoView.elementBinders, (elementBinder) => {
|
||||
if (isPresent(elementBinder.componentDirective)) {
|
||||
ListWrapper.push(componentElementBinders, elementBinder);
|
||||
componentElementBinders.push(elementBinder);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -254,7 +253,7 @@ export class Compiler {
|
||||
if (isArray(item)) {
|
||||
this._flattenList(item, out);
|
||||
} else {
|
||||
ListWrapper.push(out, item);
|
||||
out.push(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ export class TreeNode<T extends TreeNode<any>> {
|
||||
var res = [];
|
||||
var child = this._head;
|
||||
while (child != null) {
|
||||
ListWrapper.push(res, child);
|
||||
res.push(child);
|
||||
child = child._next;
|
||||
}
|
||||
return res;
|
||||
@ -285,7 +285,7 @@ export class DirectiveBinding extends ResolvedBinding {
|
||||
var readAttributes = [];
|
||||
ListWrapper.forEach(deps, (dep) => {
|
||||
if (isPresent(dep.attributeName)) {
|
||||
ListWrapper.push(readAttributes, dep.attributeName);
|
||||
readAttributes.push(dep.attributeName);
|
||||
}
|
||||
});
|
||||
return readAttributes;
|
||||
@ -357,10 +357,9 @@ export class BindingData {
|
||||
if (!(this.binding instanceof DirectiveBinding)) return [];
|
||||
var res = [];
|
||||
var db = <DirectiveBinding>this.binding;
|
||||
MapWrapper.forEach(
|
||||
db.hostActions,
|
||||
(actionExpression, actionName) => {ListWrapper.push(
|
||||
res, new HostActionAccessor(actionExpression, reflector.getter(actionName)))});
|
||||
MapWrapper.forEach(db.hostActions, (actionExpression, actionName) => {
|
||||
res.push(new HostActionAccessor(actionExpression, reflector.getter(actionName)));
|
||||
});
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -409,8 +408,8 @@ export class ProtoElementInjector {
|
||||
bd: List<BindingData>,
|
||||
firstBindingIsComponent: boolean) {
|
||||
ListWrapper.forEach(dirBindings, dirBinding => {
|
||||
ListWrapper.push(bd, ProtoElementInjector._createBindingData(
|
||||
firstBindingIsComponent, dirBinding, dirBindings, dirBinding));
|
||||
bd.push(ProtoElementInjector._createBindingData(firstBindingIsComponent, dirBinding,
|
||||
dirBindings, dirBinding));
|
||||
});
|
||||
}
|
||||
|
||||
@ -425,9 +424,9 @@ export class ProtoElementInjector {
|
||||
`Multiple directives defined the same host injectable: "${stringify(b.key.token)}"`);
|
||||
}
|
||||
MapWrapper.set(visitedIds, b.key.id, true);
|
||||
ListWrapper.push(bd, ProtoElementInjector._createBindingData(
|
||||
firstBindingIsComponent, dirBinding, dirBindings,
|
||||
ProtoElementInjector._createBinding(b)));
|
||||
bd.push(ProtoElementInjector._createBindingData(firstBindingIsComponent, dirBinding,
|
||||
dirBindings,
|
||||
ProtoElementInjector._createBinding(b)));
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -442,8 +441,7 @@ export class ProtoElementInjector {
|
||||
var db = <DirectiveBinding>bindings[0];
|
||||
ListWrapper.forEach(
|
||||
db.resolvedViewInjectables,
|
||||
b => ListWrapper.push(bd,
|
||||
new BindingData(ProtoElementInjector._createBinding(b), SHADOW_DOM)));
|
||||
b => bd.push(new BindingData(ProtoElementInjector._createBinding(b), SHADOW_DOM)));
|
||||
}
|
||||
|
||||
private static _createBinding(b: ResolvedBinding) {
|
||||
@ -963,15 +961,15 @@ export class ElementInjector extends TreeNode<ElementInjector> {
|
||||
var queriesToUpdate = [];
|
||||
if (isPresent(this.parent._query0)) {
|
||||
this._pruneQueryFromTree(this.parent._query0);
|
||||
ListWrapper.push(queriesToUpdate, this.parent._query0);
|
||||
queriesToUpdate.push(this.parent._query0);
|
||||
}
|
||||
if (isPresent(this.parent._query1)) {
|
||||
this._pruneQueryFromTree(this.parent._query1);
|
||||
ListWrapper.push(queriesToUpdate, this.parent._query1);
|
||||
queriesToUpdate.push(this.parent._query1);
|
||||
}
|
||||
if (isPresent(this.parent._query2)) {
|
||||
this._pruneQueryFromTree(this.parent._query2);
|
||||
ListWrapper.push(queriesToUpdate, this.parent._query2);
|
||||
queriesToUpdate.push(this.parent._query2);
|
||||
}
|
||||
|
||||
this.remove();
|
||||
@ -1454,10 +1452,10 @@ class QueryRef {
|
||||
this.list.reset(aggregator);
|
||||
}
|
||||
|
||||
visit(inj: ElementInjector, aggregator): void {
|
||||
visit(inj: ElementInjector, aggregator: any[]): void {
|
||||
if (isBlank(inj) || !inj._hasQuery(this)) return;
|
||||
if (inj.hasDirective(this.query.directive)) {
|
||||
ListWrapper.push(aggregator, inj.get(this.query.directive));
|
||||
aggregator.push(inj.get(this.query.directive));
|
||||
}
|
||||
var child = inj._head;
|
||||
while (isPresent(child)) {
|
||||
|
@ -47,10 +47,8 @@ class BindingRecordsCreator {
|
||||
for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) {
|
||||
var dirs = elementBinders[elementIndex].directives;
|
||||
for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) {
|
||||
ListWrapper.push(
|
||||
directiveRecords,
|
||||
this._getDirectiveRecord(elementIndex, dirIndex,
|
||||
allDirectiveMetadatas[dirs[dirIndex].directiveIndex]));
|
||||
directiveRecords.push(this._getDirectiveRecord(
|
||||
elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,15 +60,15 @@ class BindingRecordsCreator {
|
||||
if (isBlank(renderElementBinder.textBindings)) return;
|
||||
|
||||
ListWrapper.forEach(renderElementBinder.textBindings, (b) => {
|
||||
ListWrapper.push(bindings, BindingRecord.createForTextNode(b, this._textNodeIndex++));
|
||||
bindings.push(BindingRecord.createForTextNode(b, this._textNodeIndex++));
|
||||
});
|
||||
}
|
||||
|
||||
_createElementPropertyRecords(bindings: List<BindingRecord>, boundElementIndex: number,
|
||||
renderElementBinder: renderApi.ElementBinder) {
|
||||
MapWrapper.forEach(renderElementBinder.propertyBindings, (astWithSource, propertyName) => {
|
||||
ListWrapper.push(
|
||||
bindings, BindingRecord.createForElement(astWithSource, boundElementIndex, propertyName));
|
||||
|
||||
bindings.push(BindingRecord.createForElement(astWithSource, boundElementIndex, propertyName));
|
||||
});
|
||||
}
|
||||
|
||||
@ -87,18 +85,18 @@ class BindingRecordsCreator {
|
||||
// TODO: these setters should eventually be created by change detection, to make
|
||||
// it monomorphic!
|
||||
var setter = reflector.setter(propertyName);
|
||||
ListWrapper.push(bindings, BindingRecord.createForDirective(astWithSource, propertyName,
|
||||
setter, directiveRecord));
|
||||
bindings.push(
|
||||
BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord));
|
||||
});
|
||||
|
||||
if (directiveRecord.callOnChange) {
|
||||
ListWrapper.push(bindings, BindingRecord.createDirectiveOnChange(directiveRecord));
|
||||
bindings.push(BindingRecord.createDirectiveOnChange(directiveRecord));
|
||||
}
|
||||
if (directiveRecord.callOnInit) {
|
||||
ListWrapper.push(bindings, BindingRecord.createDirectiveOnInit(directiveRecord));
|
||||
bindings.push(BindingRecord.createDirectiveOnInit(directiveRecord));
|
||||
}
|
||||
if (directiveRecord.callOnCheck) {
|
||||
ListWrapper.push(bindings, BindingRecord.createDirectiveOnCheck(directiveRecord));
|
||||
bindings.push(BindingRecord.createDirectiveOnCheck(directiveRecord));
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,8 +105,8 @@ class BindingRecordsCreator {
|
||||
// host properties
|
||||
MapWrapper.forEach(directiveBinder.hostPropertyBindings, (astWithSource, propertyName) => {
|
||||
var dirIndex = new DirectiveIndex(boundElementIndex, i);
|
||||
ListWrapper.push(
|
||||
bindings, BindingRecord.createForHostProperty(dirIndex, astWithSource, propertyName));
|
||||
|
||||
bindings.push(BindingRecord.createForHostProperty(dirIndex, astWithSource, propertyName));
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -185,8 +183,8 @@ function _collectNestedProtoViews(
|
||||
if (isBlank(result)) {
|
||||
result = [];
|
||||
}
|
||||
ListWrapper.push(result, new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex,
|
||||
boundElementIndex));
|
||||
result.push(
|
||||
new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex));
|
||||
var currentIndex = result.length - 1;
|
||||
var childBoundElementIndex = 0;
|
||||
ListWrapper.forEach(renderProtoView.elementBinders, (elementBinder) => {
|
||||
@ -266,7 +264,6 @@ function _collectNestedProtoViewsVariableNames(
|
||||
return nestedPvVariableNames;
|
||||
}
|
||||
|
||||
|
||||
function _createVariableNames(parentVariableNames, renderProtoView): List<string> {
|
||||
var res = isBlank(parentVariableNames) ? [] : ListWrapper.clone(parentVariableNames);
|
||||
MapWrapper.forEach(renderProtoView.variableBindings,
|
||||
|
@ -183,7 +183,7 @@ export class AppProtoView {
|
||||
new ElementBinder(this.elementBinders.length, parent, distanceToParent,
|
||||
protoElementInjector, directiveVariableBindings, componentDirective);
|
||||
|
||||
ListWrapper.push(this.elementBinders, elBinder);
|
||||
this.elementBinders.push(elBinder);
|
||||
return elBinder;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ export class AppViewManagerUtils {
|
||||
elementInjector = protoElementInjector.instantiate(parentElementInjector);
|
||||
} else {
|
||||
elementInjector = protoElementInjector.instantiate(null);
|
||||
ListWrapper.push(rootElementInjectors, elementInjector);
|
||||
rootElementInjectors.push(elementInjector);
|
||||
}
|
||||
}
|
||||
elementInjectors[binderIdx] = elementInjector;
|
||||
|
@ -34,7 +34,7 @@ export class AppViewPool {
|
||||
}
|
||||
var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView;
|
||||
if (haveRemainingCapacity) {
|
||||
ListWrapper.push(pooledViews, view);
|
||||
pooledViews.push(view);
|
||||
}
|
||||
return haveRemainingCapacity;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export class Testability {
|
||||
|
||||
constructor() {
|
||||
this._pendingCount = 0;
|
||||
this._callbacks = ListWrapper.create();
|
||||
this._callbacks = [];
|
||||
}
|
||||
|
||||
increaseCount(delta: number = 1) {
|
||||
@ -37,7 +37,7 @@ export class Testability {
|
||||
}
|
||||
|
||||
whenStable(callback: Function) {
|
||||
ListWrapper.push(this._callbacks, callback);
|
||||
this._callbacks.push(callback);
|
||||
|
||||
if (this._pendingCount === 0) {
|
||||
this._runCallbacks();
|
||||
|
@ -69,7 +69,7 @@ export class DebugElement {
|
||||
|
||||
if (!isPresent(shadowView)) {
|
||||
// The current element is not a component.
|
||||
return ListWrapper.create();
|
||||
return [];
|
||||
}
|
||||
|
||||
return this._getChildElements(shadowView, null);
|
||||
@ -123,7 +123,7 @@ export class DebugElement {
|
||||
}
|
||||
|
||||
_getChildElements(view: AppView, parentBoundElementIndex: number): List<DebugElement> {
|
||||
var els = ListWrapper.create();
|
||||
var els = [];
|
||||
var parentElementBinder = null;
|
||||
if (isPresent(parentBoundElementIndex)) {
|
||||
parentElementBinder = view.proto.elementBinders[parentBoundElementIndex];
|
||||
@ -131,7 +131,7 @@ export class DebugElement {
|
||||
for (var i = 0; i < view.proto.elementBinders.length; ++i) {
|
||||
var binder = view.proto.elementBinders[i];
|
||||
if (binder.parent == parentElementBinder) {
|
||||
ListWrapper.push(els, new DebugElement(view, i));
|
||||
els.push(new DebugElement(view, i));
|
||||
|
||||
var views = view.viewContainers[i];
|
||||
if (isPresent(views)) {
|
||||
@ -154,8 +154,8 @@ export function inspectElement(elementRef: ElementRef): DebugElement {
|
||||
*/
|
||||
export class Scope {
|
||||
static all(debugElement): List<DebugElement> {
|
||||
var scope = ListWrapper.create();
|
||||
ListWrapper.push(scope, debugElement);
|
||||
var scope = [];
|
||||
scope.push(debugElement);
|
||||
|
||||
ListWrapper.forEach(debugElement.children,
|
||||
(child) => { scope = ListWrapper.concat(scope, Scope.all(child)); });
|
||||
@ -166,19 +166,19 @@ export class Scope {
|
||||
return scope;
|
||||
}
|
||||
static light(debugElement): List<DebugElement> {
|
||||
var scope = ListWrapper.create();
|
||||
var scope = [];
|
||||
ListWrapper.forEach(debugElement.children, (child) => {
|
||||
ListWrapper.push(scope, child);
|
||||
scope.push(child);
|
||||
scope = ListWrapper.concat(scope, Scope.light(child));
|
||||
});
|
||||
return scope;
|
||||
}
|
||||
|
||||
static view(debugElement): List<DebugElement> {
|
||||
var scope = ListWrapper.create();
|
||||
var scope = [];
|
||||
|
||||
ListWrapper.forEach(debugElement.componentViewChildren, (child) => {
|
||||
ListWrapper.push(scope, child);
|
||||
scope.push(child);
|
||||
scope = ListWrapper.concat(scope, Scope.light(child));
|
||||
});
|
||||
return scope;
|
||||
|
@ -501,7 +501,7 @@ function _extractToken(typeOrFunc, annotations /*List<any> | any*/,
|
||||
if (isPresent(paramAnnotation.token)) {
|
||||
token = paramAnnotation.token;
|
||||
}
|
||||
ListWrapper.push(depProps, paramAnnotation);
|
||||
depProps.push(paramAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ function findFirstClosedCycle(keys: List<any>): List<any> {
|
||||
var res = [];
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
if (ListWrapper.contains(res, keys[i])) {
|
||||
ListWrapper.push(res, keys[i]);
|
||||
res.push(keys[i]);
|
||||
return res;
|
||||
} else {
|
||||
ListWrapper.push(res, keys[i]);
|
||||
res.push(keys[i]);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
@ -45,7 +45,7 @@ export class AbstractBindingError extends BaseException {
|
||||
|
||||
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
||||
addKey(key): void {
|
||||
ListWrapper.push(this.keys, key);
|
||||
this.keys.push(key);
|
||||
this.message = this.constructResolvingMessage(this.keys);
|
||||
}
|
||||
|
||||
@ -182,13 +182,13 @@ export class NoAnnotationError extends BaseException {
|
||||
message: string;
|
||||
constructor(typeOrFunc, params: List<List<any>>) {
|
||||
super();
|
||||
var signature = ListWrapper.create();
|
||||
var signature = [];
|
||||
for (var i = 0, ii = params.length; i < ii; i++) {
|
||||
var parameter = params[i];
|
||||
if (isBlank(parameter) || parameter.length == 0) {
|
||||
ListWrapper.push(signature, '?');
|
||||
signature.push('?');
|
||||
} else {
|
||||
ListWrapper.push(signature, ListWrapper.map(parameter, stringify).join(' '));
|
||||
signature.push(ListWrapper.map(parameter, stringify).join(' '));
|
||||
}
|
||||
}
|
||||
this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" +
|
||||
|
@ -390,8 +390,8 @@ export function resolveBindings(bindings: List<Type | Binding | List<any>>): Lis
|
||||
|
||||
function flattenBindings(bindings: List<ResolvedBinding>): List<ResolvedBinding> {
|
||||
var map = _flattenBindings(bindings, MapWrapper.create());
|
||||
var res = ListWrapper.create();
|
||||
MapWrapper.forEach(map, (binding, keyId) => ListWrapper.push(res, binding));
|
||||
var res = [];
|
||||
MapWrapper.forEach(map, (binding, keyId) => res.push(binding));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import {Directive} from 'angular2/annotations';
|
||||
import {ViewContainerRef, ViewRef, ProtoViewRef} from 'angular2/core';
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
/**
|
||||
* The `NgFor` directive instantiates a template once per item from an iterable. The context for
|
||||
@ -54,16 +53,16 @@ export class NgFor {
|
||||
// TODO(rado): check if change detection can produce a change record that is
|
||||
// easier to consume than current.
|
||||
var recordViewTuples = [];
|
||||
changes.forEachRemovedItem((removedRecord) => ListWrapper.push(
|
||||
recordViewTuples, new RecordViewTuple(removedRecord, null)));
|
||||
changes.forEachRemovedItem((removedRecord) =>
|
||||
recordViewTuples.push(new RecordViewTuple(removedRecord, null)));
|
||||
|
||||
changes.forEachMovedItem((movedRecord) => ListWrapper.push(
|
||||
recordViewTuples, new RecordViewTuple(movedRecord, null)));
|
||||
changes.forEachMovedItem((movedRecord) =>
|
||||
recordViewTuples.push(new RecordViewTuple(movedRecord, null)));
|
||||
|
||||
var insertTuples = NgFor.bulkRemove(recordViewTuples, this.viewContainer);
|
||||
|
||||
changes.forEachAddedItem(
|
||||
(addedRecord) => ListWrapper.push(insertTuples, new RecordViewTuple(addedRecord, null)));
|
||||
changes.forEachAddedItem((addedRecord) =>
|
||||
insertTuples.push(new RecordViewTuple(addedRecord, null)));
|
||||
|
||||
NgFor.bulkInsert(insertTuples, this.viewContainer, this.protoViewRef);
|
||||
|
||||
@ -85,7 +84,7 @@ export class NgFor {
|
||||
// separate moved views from removed views.
|
||||
if (isPresent(tuple.record.currentIndex)) {
|
||||
tuple.view = viewContainer.detach(tuple.record.previousIndex);
|
||||
ListWrapper.push(movedTuples, tuple);
|
||||
movedTuples.push(tuple);
|
||||
} else {
|
||||
viewContainer.remove(tuple.record.previousIndex);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ export class NgSwitch {
|
||||
|
||||
constructor() {
|
||||
this._valueViews = MapWrapper.create();
|
||||
this._activeViews = ListWrapper.create();
|
||||
this._activeViews = [];
|
||||
this._useDefault = false;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ export class NgSwitch {
|
||||
this._emptyAllActiveViews();
|
||||
}
|
||||
view.create();
|
||||
ListWrapper.push(this._activeViews, view);
|
||||
this._activeViews.push(view);
|
||||
}
|
||||
|
||||
// Switch to default when there is no more active ViewContainers
|
||||
@ -101,7 +101,7 @@ export class NgSwitch {
|
||||
for (var i = 0; i < activeContainers.length; i++) {
|
||||
activeContainers[i].destroy();
|
||||
}
|
||||
this._activeViews = ListWrapper.create();
|
||||
this._activeViews = [];
|
||||
}
|
||||
|
||||
_activateViews(views: List<SwitchView>): void {
|
||||
@ -117,10 +117,10 @@ export class NgSwitch {
|
||||
_registerView(value, view: SwitchView): void {
|
||||
var views = MapWrapper.get(this._valueViews, value);
|
||||
if (isBlank(views)) {
|
||||
views = ListWrapper.create();
|
||||
views = [];
|
||||
MapWrapper.set(this._valueViews, value, views);
|
||||
}
|
||||
ListWrapper.push(views, view);
|
||||
views.push(view);
|
||||
}
|
||||
|
||||
_deregisterView(value, view: SwitchView): void {
|
||||
|
@ -13,7 +13,7 @@ export class GenericBrowserDomAdapter extends DomAdapter {
|
||||
cssToRules(css: string): List<any> {
|
||||
var style = this.createStyleElement(css);
|
||||
this.appendChild(this.defaultDoc().head, style);
|
||||
var rules = ListWrapper.create();
|
||||
var rules = [];
|
||||
if (isPresent(style.sheet)) {
|
||||
// TODO(sorvell): Firefox throws when accessing the rules of a stylesheet
|
||||
// with an @import
|
||||
|
@ -33,14 +33,14 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
query(selector) { throw _notImplemented('query'); }
|
||||
querySelector(el, selector: string) { return this.querySelectorAll(el, selector)[0]; }
|
||||
querySelectorAll(el, selector: string) {
|
||||
var res = ListWrapper.create();
|
||||
var res = [];
|
||||
var _recursive = (result, node, selector, matcher) => {
|
||||
var cNodes = node.childNodes;
|
||||
if (cNodes && cNodes.length > 0) {
|
||||
for (var i = 0; i < cNodes.length; i++) {
|
||||
var childNode = cNodes[i];
|
||||
if (this.elementMatches(childNode, selector, matcher)) {
|
||||
ListWrapper.push(result, childNode);
|
||||
result.push(childNode);
|
||||
}
|
||||
_recursive(result, childNode, selector, matcher);
|
||||
}
|
||||
@ -86,9 +86,9 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
}
|
||||
var listeners = StringMapWrapper.get(listenersMap, evt);
|
||||
if (isBlank(listeners)) {
|
||||
listeners = ListWrapper.create();
|
||||
listeners = [];
|
||||
}
|
||||
ListWrapper.push(listeners, listener);
|
||||
listeners.push(listener);
|
||||
StringMapWrapper.set(listenersMap, evt, listeners);
|
||||
}
|
||||
onAndCancel(el, evt, listener): Function {
|
||||
@ -287,7 +287,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
var classList = this.classList(element);
|
||||
var index = classList.indexOf(classname);
|
||||
if (index == -1) {
|
||||
ListWrapper.push(classList, classname);
|
||||
classList.push(classname);
|
||||
element.attribs["class"] = element.className = ListWrapper.join(classList, " ");
|
||||
}
|
||||
}
|
||||
@ -417,7 +417,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
}
|
||||
}
|
||||
_buildRules(parsedRules, css?) {
|
||||
var rules = ListWrapper.create();
|
||||
var rules = [];
|
||||
for (var i = 0; i < parsedRules.length; i++) {
|
||||
var parsedRule = parsedRules[i];
|
||||
var rule: StringMap<string, any> = StringMapWrapper.create();
|
||||
@ -448,13 +448,13 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
StringMapWrapper.set(rule, "cssRules", this._buildRules(parsedRule.rules));
|
||||
}
|
||||
}
|
||||
ListWrapper.push(rules, rule);
|
||||
rules.push(rule);
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
cssToRules(css: string): List<any> {
|
||||
css = css.replace(/url\(\'(.+)\'\)/g, 'url($1)');
|
||||
var rules = ListWrapper.create();
|
||||
var rules = [];
|
||||
var parsedCSS = cssParse(css, {silent: true});
|
||||
if (parsedCSS.stylesheet && parsedCSS.stylesheet.rules) {
|
||||
rules = this._buildRules(parsedCSS.stylesheet.rules, css);
|
||||
|
@ -101,7 +101,6 @@ class StringMapWrapper {
|
||||
|
||||
class ListWrapper {
|
||||
static List clone(Iterable l) => new List.from(l);
|
||||
static List create() => new List();
|
||||
static List createFixedSize(int size) => new List(size);
|
||||
static get(List m, int k) => m[k];
|
||||
static void set(List m, int k, v) {
|
||||
@ -126,9 +125,6 @@ class ListWrapper {
|
||||
static first(List list) => list.isEmpty ? null : list.first;
|
||||
static last(List list) => list.isEmpty ? null : list.last;
|
||||
static List reversed(List list) => list.reversed.toList();
|
||||
static void push(List l, e) {
|
||||
l.add(e);
|
||||
}
|
||||
static List concat(List a, List b) {
|
||||
return new List()
|
||||
..length = a.length + b.length
|
||||
|
@ -145,7 +145,6 @@ export class StringMapWrapper {
|
||||
}
|
||||
|
||||
export class ListWrapper {
|
||||
static create(): List<any> { return new List(); }
|
||||
static createFixedSize(size): List<any> { return new List(size); }
|
||||
static get(m, k) { return m[k]; }
|
||||
static set(m, k, v) { m[k] = v; }
|
||||
@ -156,7 +155,6 @@ export class ListWrapper {
|
||||
fn(array[i]);
|
||||
}
|
||||
}
|
||||
static push(array, el) { array.push(el); }
|
||||
static first(array) {
|
||||
if (!array) return null;
|
||||
return array[0];
|
||||
|
@ -113,7 +113,7 @@ export class NgFormModel extends ControlContainer implements Form {
|
||||
var c: any = this.form.find(dir.path);
|
||||
setUpControl(c, dir);
|
||||
c.updateValidity();
|
||||
ListWrapper.push(this.directives, dir);
|
||||
this.directives.push(dir);
|
||||
}
|
||||
|
||||
getControl(dir: NgControl): Control { return <Control>this.form.find(dir.path); }
|
||||
|
@ -10,7 +10,7 @@ import {Renderer, ElementRef} from 'angular2/angular2';
|
||||
|
||||
export function controlPath(name, parent: ControlContainer) {
|
||||
var p = ListWrapper.clone(parent.path);
|
||||
ListWrapper.push(p, name);
|
||||
p.push(name);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ export class ControlArray extends AbstractControl {
|
||||
at(index: number): AbstractControl { return this.controls[index]; }
|
||||
|
||||
push(control: AbstractControl): void {
|
||||
ListWrapper.push(this.controls, control);
|
||||
this.controls.push(control);
|
||||
control.setParent(this);
|
||||
this.updateValueAndValidity();
|
||||
}
|
||||
|
@ -51,12 +51,13 @@ export class Validators {
|
||||
return StringMapWrapper.isEmpty(res) ? null : res;
|
||||
}
|
||||
|
||||
static _mergeErrors(control: modelModule.AbstractControl, res: StringMap<string, any>): void {
|
||||
static _mergeErrors(control: modelModule.AbstractControl, res: StringMap<string, any[]>): void {
|
||||
StringMapWrapper.forEach(control.errors, (value, error) => {
|
||||
if (!StringMapWrapper.contains(res, error)) {
|
||||
res[error] = [];
|
||||
}
|
||||
ListWrapper.push(res[error], control);
|
||||
var current: any[] = res[error];
|
||||
current.push(control);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ export class Headers {
|
||||
this._headersMap = MapWrapper.createFromStringMap(headers);
|
||||
MapWrapper.forEach(this._headersMap, (v, k) => {
|
||||
if (!isListLikeIterable(v)) {
|
||||
var list = ListWrapper.create();
|
||||
ListWrapper.push(list, v);
|
||||
var list = [];
|
||||
list.push(v);
|
||||
MapWrapper.set(this._headersMap, k, list);
|
||||
}
|
||||
});
|
||||
@ -42,8 +42,8 @@ export class Headers {
|
||||
}
|
||||
|
||||
append(name: string, value: string): void {
|
||||
var list = MapWrapper.get(this._headersMap, name) || ListWrapper.create();
|
||||
ListWrapper.push(list, value);
|
||||
var list = MapWrapper.get(this._headersMap, name) || [];
|
||||
list.push(value);
|
||||
MapWrapper.set(this._headersMap, name, list);
|
||||
}
|
||||
|
||||
@ -61,11 +61,11 @@ export class Headers {
|
||||
|
||||
// TODO: this implementation seems wrong. create list then check if it's iterable?
|
||||
set(header: string, value: string | List<string>): void {
|
||||
var list = ListWrapper.create();
|
||||
var list = [];
|
||||
if (!isListLikeIterable(value)) {
|
||||
ListWrapper.push(list, value);
|
||||
list.push(value);
|
||||
} else {
|
||||
ListWrapper.push(list, ListWrapper.toString((<List<string>>value)));
|
||||
list.push(ListWrapper.toString((<List<string>>value)));
|
||||
}
|
||||
|
||||
MapWrapper.set(this._headersMap, header, list);
|
||||
@ -73,9 +73,7 @@ export class Headers {
|
||||
|
||||
values() { return MapWrapper.values(this._headersMap); }
|
||||
|
||||
getAll(header: string): Array<string> {
|
||||
return MapWrapper.get(this._headersMap, header) || ListWrapper.create();
|
||||
}
|
||||
getAll(header: string): Array<string> { return MapWrapper.get(this._headersMap, header) || []; }
|
||||
|
||||
entries() { throw new BaseException('"entries" method is not implemented on Headers class'); }
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ function paramParser(rawParams: string): Map<string, List<string>> {
|
||||
var split: List<string> = StringWrapper.split(param, '=');
|
||||
var key = ListWrapper.get(split, 0);
|
||||
var val = ListWrapper.get(split, 1);
|
||||
var list = MapWrapper.get(map, key) || ListWrapper.create();
|
||||
ListWrapper.push(list, val);
|
||||
var list = MapWrapper.get(map, key) || [];
|
||||
list.push(val);
|
||||
MapWrapper.set(map, key, list);
|
||||
});
|
||||
return map;
|
||||
@ -23,20 +23,18 @@ export class URLSearchParams {
|
||||
|
||||
get(param: string): string { return ListWrapper.first(MapWrapper.get(this.paramsMap, param)); }
|
||||
|
||||
getAll(param: string): List<string> {
|
||||
return MapWrapper.get(this.paramsMap, param) || ListWrapper.create();
|
||||
}
|
||||
getAll(param: string): List<string> { return MapWrapper.get(this.paramsMap, param) || []; }
|
||||
|
||||
append(param: string, val: string): void {
|
||||
var list = MapWrapper.get(this.paramsMap, param) || ListWrapper.create();
|
||||
ListWrapper.push(list, val);
|
||||
var list = MapWrapper.get(this.paramsMap, param) || [];
|
||||
list.push(val);
|
||||
MapWrapper.set(this.paramsMap, param, list);
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
var paramsList = ListWrapper.create();
|
||||
var paramsList = [];
|
||||
MapWrapper.forEach(this.paramsMap, (values, k) => {
|
||||
ListWrapper.forEach(values, v => { ListWrapper.push(paramsList, k + '=' + v); });
|
||||
ListWrapper.forEach(values, v => { paramsList.push(k + '=' + v); });
|
||||
});
|
||||
return ListWrapper.join(paramsList, '&');
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ export class DummyBrowserLocation extends SpyObject {
|
||||
internalBaseHref: string = '/';
|
||||
internalPath: string = '/';
|
||||
internalTitle: string = '';
|
||||
urlChanges: List<string> = ListWrapper.create();
|
||||
urlChanges: List<string> = [];
|
||||
_subject: EventEmitter = new EventEmitter();
|
||||
constructor() { super(); }
|
||||
|
||||
@ -28,7 +28,7 @@ export class DummyBrowserLocation extends SpyObject {
|
||||
pushState(ctx: any, title: string, url: string): void {
|
||||
this.internalTitle = title;
|
||||
this.internalPath = url;
|
||||
ListWrapper.push(this.urlChanges, url);
|
||||
this.urlChanges.push(url);
|
||||
}
|
||||
|
||||
forward(): void { throw new BaseException('Not implemented yet!'); }
|
||||
|
@ -17,7 +17,7 @@ export class SpyLocation extends SpyObject {
|
||||
constructor() {
|
||||
super();
|
||||
this._path = '/';
|
||||
this.urlChanges = ListWrapper.create();
|
||||
this.urlChanges = [];
|
||||
this._subject = new EventEmitter();
|
||||
this._baseHref = '';
|
||||
}
|
||||
@ -38,7 +38,7 @@ export class SpyLocation extends SpyObject {
|
||||
return;
|
||||
}
|
||||
this._path = url;
|
||||
ListWrapper.push(this.urlChanges, url);
|
||||
this.urlChanges.push(url);
|
||||
}
|
||||
|
||||
forward() {
|
||||
|
@ -10,14 +10,14 @@ import {CompileStep} from './compile_step';
|
||||
export class CompileControl {
|
||||
_currentStepIndex: number = 0;
|
||||
_parent: CompileElement = null;
|
||||
_results = null;
|
||||
_additionalChildren = null;
|
||||
_results: any[] = null;
|
||||
_additionalChildren: any[] = null;
|
||||
_ignoreCurrentElement: boolean;
|
||||
|
||||
constructor(public _steps: List<CompileStep>) {}
|
||||
|
||||
// only public so that it can be used by compile_pipeline
|
||||
internalProcess(results, startStepIndex, parent: CompileElement, current: CompileElement) {
|
||||
internalProcess(results: any[], startStepIndex, parent: CompileElement, current: CompileElement) {
|
||||
this._results = results;
|
||||
var previousStepIndex = this._currentStepIndex;
|
||||
var previousParent = this._parent;
|
||||
@ -33,7 +33,7 @@ export class CompileControl {
|
||||
}
|
||||
|
||||
if (!this._ignoreCurrentElement) {
|
||||
ListWrapper.push(results, current);
|
||||
results.push(current);
|
||||
}
|
||||
|
||||
this._currentStepIndex = previousStepIndex;
|
||||
@ -51,9 +51,9 @@ export class CompileControl {
|
||||
|
||||
addChild(element: CompileElement) {
|
||||
if (isBlank(this._additionalChildren)) {
|
||||
this._additionalChildren = ListWrapper.create();
|
||||
this._additionalChildren = [];
|
||||
}
|
||||
ListWrapper.push(this._additionalChildren, element);
|
||||
this._additionalChildren.push(element);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,10 +63,10 @@ export class CompileElement {
|
||||
|
||||
classList(): List<string> {
|
||||
if (isBlank(this._classList)) {
|
||||
this._classList = ListWrapper.create();
|
||||
this._classList = [];
|
||||
var elClassList = DOM.classList(this.element);
|
||||
for (var i = 0; i < elClassList.length; i++) {
|
||||
ListWrapper.push(this._classList, elClassList[i]);
|
||||
this._classList.push(elClassList[i]);
|
||||
}
|
||||
}
|
||||
return this._classList;
|
||||
|
@ -20,7 +20,7 @@ export class CompilePipeline {
|
||||
if (isBlank(protoViewType)) {
|
||||
protoViewType = ViewType.COMPONENT;
|
||||
}
|
||||
var results = ListWrapper.create();
|
||||
var results = [];
|
||||
var rootCompileElement = new CompileElement(rootElement, compilationCtxtDescription);
|
||||
rootCompileElement.inheritedProtoView = new ProtoViewBuilder(rootElement, protoViewType);
|
||||
rootCompileElement.isViewRoot = true;
|
||||
|
@ -74,7 +74,7 @@ export class DirectiveParser implements CompileStep {
|
||||
componentDirective = directive;
|
||||
elementBinder.setComponentId(directive.id);
|
||||
} else {
|
||||
ListWrapper.push(foundDirectiveIndices, directiveIndex);
|
||||
foundDirectiveIndices.push(directiveIndex);
|
||||
}
|
||||
});
|
||||
ListWrapper.forEach(foundDirectiveIndices, (directiveIndex) => {
|
||||
|
@ -32,13 +32,13 @@ export class CssSelector {
|
||||
notSelectors: List<CssSelector> = [];
|
||||
|
||||
static parse(selector: string): List<CssSelector> {
|
||||
var results = ListWrapper.create();
|
||||
var _addResult = (res, cssSel) => {
|
||||
var results: CssSelector[] = [];
|
||||
var _addResult = (res: CssSelector[], cssSel) => {
|
||||
if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) &&
|
||||
ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
||||
cssSel.element = "*";
|
||||
}
|
||||
ListWrapper.push(res, cssSel);
|
||||
res.push(cssSel);
|
||||
};
|
||||
var cssSelector = new CssSelector();
|
||||
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
||||
@ -52,7 +52,7 @@ export class CssSelector {
|
||||
}
|
||||
inNot = true;
|
||||
current = new CssSelector();
|
||||
ListWrapper.push(cssSelector.notSelectors, current);
|
||||
cssSelector.notSelectors.push(current);
|
||||
}
|
||||
if (isPresent(match[2])) {
|
||||
current.setElement(match[2]);
|
||||
@ -92,16 +92,16 @@ export class CssSelector {
|
||||
}
|
||||
|
||||
addAttribute(name: string, value: string = _EMPTY_ATTR_VALUE) {
|
||||
ListWrapper.push(this.attrs, name.toLowerCase());
|
||||
this.attrs.push(name.toLowerCase());
|
||||
if (isPresent(value)) {
|
||||
value = value.toLowerCase();
|
||||
} else {
|
||||
value = _EMPTY_ATTR_VALUE;
|
||||
}
|
||||
ListWrapper.push(this.attrs, value);
|
||||
this.attrs.push(value);
|
||||
}
|
||||
|
||||
addClassName(name: string) { ListWrapper.push(this.classNames, name.toLowerCase()); }
|
||||
addClassName(name: string) { this.classNames.push(name.toLowerCase()); }
|
||||
|
||||
toString(): string {
|
||||
var res = '';
|
||||
@ -141,11 +141,11 @@ export class SelectorMatcher {
|
||||
return notMatcher;
|
||||
}
|
||||
|
||||
private _elementMap: Map<string, List<string>> = MapWrapper.create();
|
||||
private _elementMap: Map<string, List<SelectorContext>> = MapWrapper.create();
|
||||
private _elementPartialMap: Map<string, SelectorMatcher> = MapWrapper.create();
|
||||
private _classMap: Map<string, List<string>> = MapWrapper.create();
|
||||
private _classMap: Map<string, List<SelectorContext>> = MapWrapper.create();
|
||||
private _classPartialMap: Map<string, SelectorMatcher> = MapWrapper.create();
|
||||
private _attrValueMap: Map<string, Map<string, List<string>>> = MapWrapper.create();
|
||||
private _attrValueMap: Map<string, Map<string, List<SelectorContext>>> = MapWrapper.create();
|
||||
private _attrValuePartialMap: Map<string, Map<string, SelectorMatcher>> = MapWrapper.create();
|
||||
private _listContexts: List<SelectorListContext> = [];
|
||||
|
||||
@ -153,7 +153,7 @@ export class SelectorMatcher {
|
||||
var listContext = null;
|
||||
if (cssSelectors.length > 1) {
|
||||
listContext = new SelectorListContext(cssSelectors);
|
||||
ListWrapper.push(this._listContexts, listContext);
|
||||
this._listContexts.push(listContext);
|
||||
}
|
||||
for (var i = 0; i < cssSelectors.length; i++) {
|
||||
this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
|
||||
@ -220,13 +220,14 @@ export class SelectorMatcher {
|
||||
}
|
||||
}
|
||||
|
||||
private _addTerminal(map: Map<string, List<string>>, name: string, selectable: SelectorContext) {
|
||||
private _addTerminal(map: Map<string, List<SelectorContext>>, name: string,
|
||||
selectable: SelectorContext) {
|
||||
var terminalList = MapWrapper.get(map, name);
|
||||
if (isBlank(terminalList)) {
|
||||
terminalList = ListWrapper.create();
|
||||
terminalList = [];
|
||||
MapWrapper.set(map, name, terminalList);
|
||||
}
|
||||
ListWrapper.push(terminalList, selectable);
|
||||
terminalList.push(selectable);
|
||||
}
|
||||
|
||||
private _addPartial(map: Map<string, SelectorMatcher>, name: string): SelectorMatcher {
|
||||
@ -297,8 +298,8 @@ export class SelectorMatcher {
|
||||
return result;
|
||||
}
|
||||
|
||||
_matchTerminal(map: Map<string, List<string>>, name, cssSelector: CssSelector,
|
||||
matchedCallback /*: (CssSelector, any) => void*/): boolean {
|
||||
_matchTerminal(map: Map<string, List<SelectorContext>>, name, cssSelector: CssSelector,
|
||||
matchedCallback: (CssSelector, any) => void): boolean {
|
||||
if (isBlank(map) || isBlank(name)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ export class DomRenderer extends Renderer {
|
||||
}
|
||||
|
||||
// add global events
|
||||
view.eventHandlerRemovers = ListWrapper.create();
|
||||
view.eventHandlerRemovers = [];
|
||||
var binders = view.proto.elementBinders;
|
||||
for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) {
|
||||
var binder = binders[binderIdx];
|
||||
@ -160,7 +160,7 @@ export class DomRenderer extends Renderer {
|
||||
var globalEvent = binder.globalEvents[i];
|
||||
var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name,
|
||||
globalEvent.target, globalEvent.fullName);
|
||||
ListWrapper.push(view.eventHandlerRemovers, remover);
|
||||
view.eventHandlerRemovers.push(remover);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ export class LightDom {
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i];
|
||||
if (isPresent(el.contentTag)) {
|
||||
ListWrapper.push(acc, el.contentTag);
|
||||
acc.push(el.contentTag);
|
||||
}
|
||||
if (isPresent(el.viewContainer)) {
|
||||
ListWrapper.forEach(el.viewContainer.contentTagContainers(),
|
||||
@ -83,10 +83,10 @@ export class LightDom {
|
||||
} else if (isPresent(content)) {
|
||||
res = ListWrapper.concat(res, content.nodes());
|
||||
} else {
|
||||
ListWrapper.push(res, root.node);
|
||||
res.push(root.node);
|
||||
}
|
||||
} else {
|
||||
ListWrapper.push(res, root.node);
|
||||
res.push(root.node);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
@ -303,7 +303,7 @@ export class ShadowCss {
|
||||
var p = parts[i];
|
||||
if (isBlank(p)) break;
|
||||
p = p.trim();
|
||||
ListWrapper.push(r, partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
||||
r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
||||
}
|
||||
return r.join(',');
|
||||
} else {
|
||||
@ -392,7 +392,7 @@ export class ShadowCss {
|
||||
this._applyStrictSelectorScope(p, scopeSelector) :
|
||||
this._applySelectorScope(p, scopeSelector, hostSelector);
|
||||
}
|
||||
ListWrapper.push(r, p);
|
||||
r.push(p);
|
||||
}
|
||||
return r.join(', ');
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ export class ShadowDomCompileStep implements CompileStep {
|
||||
var stylePromise = this._shadowDomStrategy.processStyleElement(
|
||||
this._template.componentId, this._template.templateAbsUrl, current.element);
|
||||
if (isPresent(stylePromise) && isPromise(stylePromise)) {
|
||||
ListWrapper.push(this._subTaskPromises, stylePromise);
|
||||
this._subTaskPromises.push(stylePromise);
|
||||
}
|
||||
|
||||
// Style elements should not be further processed by the compiler, as they can not contain
|
||||
|
@ -73,7 +73,7 @@ export class StyleInliner {
|
||||
// Importing again might cause a circular dependency
|
||||
promise = PromiseWrapper.resolve(prefix);
|
||||
} else {
|
||||
ListWrapper.push(inlinedUrls, url);
|
||||
inlinedUrls.push(url);
|
||||
promise = PromiseWrapper.then(this._xhr.get(url), (rawCss) => {
|
||||
// resolve nested @import rules
|
||||
var inlinedCss = this._inlineImports(rawCss, url, inlinedUrls);
|
||||
@ -88,7 +88,7 @@ export class StyleInliner {
|
||||
}
|
||||
}, (error) => `/* failed to import ${url} */\n`);
|
||||
}
|
||||
ListWrapper.push(promises, promise);
|
||||
promises.push(promise);
|
||||
partIndex += 2;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ export class ProtoViewBuilder {
|
||||
|
||||
bindElement(element, description = null): ElementBinderBuilder {
|
||||
var builder = new ElementBinderBuilder(this.elements.length, element, description);
|
||||
ListWrapper.push(this.elements, builder);
|
||||
this.elements.push(builder);
|
||||
DOM.addClass(element, NG_BINDING_CLASS);
|
||||
|
||||
return builder;
|
||||
@ -90,7 +90,7 @@ export class ProtoViewBuilder {
|
||||
transitiveContentTagCount++;
|
||||
}
|
||||
var parentIndex = isPresent(ebb.parent) ? ebb.parent.index : -1;
|
||||
ListWrapper.push(apiElementBinders, new api.ElementBinder({
|
||||
apiElementBinders.push(new api.ElementBinder({
|
||||
index: ebb.index,
|
||||
parentIndex: parentIndex,
|
||||
distanceToParent: ebb.distanceToParent,
|
||||
@ -103,22 +103,21 @@ export class ProtoViewBuilder {
|
||||
readAttributes: ebb.readAttributes
|
||||
}));
|
||||
var elementIsEmpty = this._isEmptyElement(ebb.element);
|
||||
ListWrapper.push(renderElementBinders, new ElementBinder({
|
||||
textNodeIndices: ebb.textBindingIndices,
|
||||
contentTagSelector: ebb.contentTagSelector,
|
||||
parentIndex: parentIndex,
|
||||
distanceToParent: ebb.distanceToParent,
|
||||
nestedProtoView: isPresent(nestedProtoView) ?
|
||||
resolveInternalDomProtoView(nestedProtoView.render) :
|
||||
null,
|
||||
componentId: ebb.componentId,
|
||||
eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()),
|
||||
localEvents: ebb.eventBuilder.buildLocalEvents(),
|
||||
globalEvents: ebb.eventBuilder.buildGlobalEvents(),
|
||||
hostActions: hostActions,
|
||||
propertySetters: propertySetters,
|
||||
elementIsEmpty: elementIsEmpty
|
||||
}));
|
||||
renderElementBinders.push(new ElementBinder({
|
||||
textNodeIndices: ebb.textBindingIndices,
|
||||
contentTagSelector: ebb.contentTagSelector,
|
||||
parentIndex: parentIndex,
|
||||
distanceToParent: ebb.distanceToParent,
|
||||
nestedProtoView:
|
||||
isPresent(nestedProtoView) ? resolveInternalDomProtoView(nestedProtoView.render) : null,
|
||||
componentId: ebb.componentId,
|
||||
eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()),
|
||||
localEvents: ebb.eventBuilder.buildLocalEvents(),
|
||||
globalEvents: ebb.eventBuilder.buildGlobalEvents(),
|
||||
hostActions: hostActions,
|
||||
propertySetters: propertySetters,
|
||||
elementIsEmpty: elementIsEmpty
|
||||
}));
|
||||
});
|
||||
return new api.ProtoViewDto({
|
||||
render: new DomProtoViewRef(new DomProtoView({
|
||||
@ -178,7 +177,7 @@ export class ElementBinderBuilder {
|
||||
|
||||
bindDirective(directiveIndex: number): DirectiveBuilder {
|
||||
var directive = new DirectiveBuilder(directiveIndex);
|
||||
ListWrapper.push(this.directives, directive);
|
||||
this.directives.push(directive);
|
||||
return directive;
|
||||
}
|
||||
|
||||
@ -211,12 +210,12 @@ export class ElementBinderBuilder {
|
||||
}
|
||||
|
||||
bindEvent(name, expression, target = null) {
|
||||
ListWrapper.push(this.eventBindings, this.eventBuilder.add(name, expression, target));
|
||||
this.eventBindings.push(this.eventBuilder.add(name, expression, target));
|
||||
}
|
||||
|
||||
bindText(index, expression) {
|
||||
ListWrapper.push(this.textBindingIndices, index);
|
||||
ListWrapper.push(this.textBindings, expression);
|
||||
this.textBindingIndices.push(index);
|
||||
this.textBindings.push(expression);
|
||||
}
|
||||
|
||||
setContentTagSelector(value: string) { this.contentTagSelector = value; }
|
||||
@ -240,11 +239,11 @@ export class DirectiveBuilder {
|
||||
}
|
||||
|
||||
bindHostAction(actionName: string, actionExpression: string, expression: ASTWithSource) {
|
||||
ListWrapper.push(this.hostActions, new HostAction(actionName, actionExpression, expression));
|
||||
this.hostActions.push(new HostAction(actionName, actionExpression, expression));
|
||||
}
|
||||
|
||||
bindEvent(name, expression, target = null) {
|
||||
ListWrapper.push(this.eventBindings, this.eventBuilder.add(name, expression, target));
|
||||
this.eventBindings.push(this.eventBuilder.add(name, expression, target));
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,9 +265,9 @@ export class EventBuilder extends AstTransformer {
|
||||
fullName, new ASTWithSource(adjustedAst, source.source, source.location));
|
||||
var event = new Event(name, target, fullName);
|
||||
if (isBlank(target)) {
|
||||
ListWrapper.push(this.localEvents, event);
|
||||
this.localEvents.push(event);
|
||||
} else {
|
||||
ListWrapper.push(this.globalEvents, event);
|
||||
this.globalEvents.push(event);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -285,7 +284,7 @@ export class EventBuilder extends AstTransformer {
|
||||
}
|
||||
|
||||
if (isEventAccess) {
|
||||
ListWrapper.push(this.locals, ast);
|
||||
this.locals.push(ast);
|
||||
var index = this.locals.length - 1;
|
||||
return new AccessMember(this._implicitReceiver, `${index}`, (arr) => arr[index], null);
|
||||
} else {
|
||||
@ -306,13 +305,13 @@ export class EventBuilder extends AstTransformer {
|
||||
}
|
||||
|
||||
_merge(host: List<Event>, tobeAdded: List<Event>) {
|
||||
var names = ListWrapper.create();
|
||||
var names = [];
|
||||
for (var i = 0; i < host.length; i++) {
|
||||
ListWrapper.push(names, host[i].fullName);
|
||||
names.push(host[i].fullName);
|
||||
}
|
||||
for (var j = 0; j < tobeAdded.length; j++) {
|
||||
if (!ListWrapper.contains(names, tobeAdded[j].fullName)) {
|
||||
ListWrapper.push(host, tobeAdded[j]);
|
||||
host.push(tobeAdded[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import {PromiseWrapper, Promise} from 'angular2/src/facade/async';
|
||||
export class MockXHR extends XHR {
|
||||
private _expectations: List<_Expectation>;
|
||||
private _definitions: Map<string, string>;
|
||||
private _requests: List<Promise<string>>;
|
||||
private _requests: List<_PendingRequest>;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@ -17,13 +17,13 @@ export class MockXHR extends XHR {
|
||||
|
||||
get(url: string): Promise<string> {
|
||||
var request = new _PendingRequest(url);
|
||||
ListWrapper.push(this._requests, request);
|
||||
this._requests.push(request);
|
||||
return request.getPromise();
|
||||
}
|
||||
|
||||
expect(url: string, response: string) {
|
||||
var expectation = new _Expectation(url, response);
|
||||
ListWrapper.push(this._expectations, expectation);
|
||||
this._expectations.push(expectation);
|
||||
}
|
||||
|
||||
when(url: string, response: string) { MapWrapper.set(this._definitions, url, response); }
|
||||
@ -47,7 +47,7 @@ export class MockXHR extends XHR {
|
||||
var urls = [];
|
||||
for (var i = 0; i < this._expectations.length; i++) {
|
||||
var expectation = this._expectations[i];
|
||||
ListWrapper.push(urls, expectation.url);
|
||||
urls.push(expectation.url);
|
||||
}
|
||||
|
||||
throw new BaseException(`Unsatisfied requests: ${ListWrapper.join(urls, ', ')}`);
|
||||
|
@ -76,7 +76,7 @@ function parsePathString(route: string) {
|
||||
}
|
||||
|
||||
var segments = splitBySlash(route);
|
||||
var results = ListWrapper.create();
|
||||
var results = [];
|
||||
var specificity = 0;
|
||||
|
||||
// The "specificity" of a path is used to determine which route is used when multiple routes match
|
||||
@ -97,12 +97,12 @@ function parsePathString(route: string) {
|
||||
var segment = segments[i], match;
|
||||
|
||||
if (isPresent(match = RegExpWrapper.firstMatch(paramMatcher, segment))) {
|
||||
ListWrapper.push(results, new DynamicSegment(match[1]));
|
||||
results.push(new DynamicSegment(match[1]));
|
||||
specificity += (100 - i);
|
||||
} else if (isPresent(match = RegExpWrapper.firstMatch(wildcardMatcher, segment))) {
|
||||
ListWrapper.push(results, new StarSegment(match[1]));
|
||||
results.push(new StarSegment(match[1]));
|
||||
} else if (segment.length > 0) {
|
||||
ListWrapper.push(results, new StaticSegment(segment));
|
||||
results.push(new StaticSegment(segment));
|
||||
specificity += 100 * (100 - i);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ export class RouteRecognizer {
|
||||
*
|
||||
*/
|
||||
recognize(url: string): List<RouteMatch> {
|
||||
var solutions = ListWrapper.create();
|
||||
var solutions = [];
|
||||
|
||||
MapWrapper.forEach(this.redirects, (target, path) => {
|
||||
// "/" redirect case
|
||||
@ -77,13 +77,13 @@ export class RouteRecognizer {
|
||||
matchedUrl = match[0];
|
||||
unmatchedUrl = StringWrapper.substring(url, match[0].length);
|
||||
}
|
||||
ListWrapper.push(solutions, new RouteMatch({
|
||||
specificity: pathRecognizer.specificity,
|
||||
handler: pathRecognizer.handler,
|
||||
params: pathRecognizer.parseParams(url),
|
||||
matchedUrl: matchedUrl,
|
||||
unmatchedUrl: unmatchedUrl
|
||||
}));
|
||||
solutions.push(new RouteMatch({
|
||||
specificity: pathRecognizer.specificity,
|
||||
handler: pathRecognizer.handler,
|
||||
params: pathRecognizer.parseParams(url),
|
||||
matchedUrl: matchedUrl,
|
||||
unmatchedUrl: unmatchedUrl
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/// <reference path="../../typings/jasmine/jasmine"/>
|
||||
/// <reference path="../../typings/jasmine/jasmine.d.ts"/>
|
||||
|
||||
import {BaseException, global} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
@ -95,7 +95,7 @@ export function flushMicrotasks(): void {
|
||||
function _setTimeout(fn: Function, delay: number, ... args): number {
|
||||
var cb = _fnAndFlush(fn);
|
||||
var id = _scheduler.scheduleFunction(cb, delay, args);
|
||||
ListWrapper.push(_pendingTimers, id);
|
||||
_pendingTimers.push(id);
|
||||
_scheduler.scheduleFunction(_dequeueTimer(id), delay);
|
||||
return id;
|
||||
}
|
||||
@ -124,7 +124,7 @@ function _fnAndFlush(fn: Function): Function {
|
||||
}
|
||||
|
||||
function _scheduleMicrotask(microtask: Function): void {
|
||||
ListWrapper.push(_microtasks, microtask);
|
||||
_microtasks.push(microtask);
|
||||
}
|
||||
|
||||
function _dequeueTimer(id: number): Function {
|
||||
|
@ -8,12 +8,10 @@ export class Log {
|
||||
|
||||
constructor() { this._result = []; }
|
||||
|
||||
add(value): void { ListWrapper.push(this._result, value); }
|
||||
add(value): void { this._result.push(value); }
|
||||
|
||||
fn(value) {
|
||||
return (a1 = null, a2 = null, a3 = null, a4 = null, a5 = null) => {
|
||||
ListWrapper.push(this._result, value);
|
||||
}
|
||||
return (a1 = null, a2 = null, a3 = null, a4 = null, a5 = null) => { this._result.push(value); }
|
||||
}
|
||||
|
||||
result(): string { return ListWrapper.join(this._result, "; "); }
|
||||
@ -72,8 +70,8 @@ export function stringifyElement(el): string {
|
||||
|
||||
// Attributes in an ordered way
|
||||
var attributeMap = DOM.attributeMap(el);
|
||||
var keys = ListWrapper.create();
|
||||
MapWrapper.forEach(attributeMap, (v, k) => { ListWrapper.push(keys, k); });
|
||||
var keys = [];
|
||||
MapWrapper.forEach(attributeMap, (v, k) => { keys.push(k); });
|
||||
ListWrapper.sort(keys);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
|
Reference in New Issue
Block a user