AngularDart多选操作在JS模式下进入无限循环

时间:2014-02-06 14:24:09

标签: dart angular-dart

我有一个AngularDart应用程序,显示如下的多选框: dart multiple selection

我在左侧选择一个或多个条目,点击>它走到了右边。在Dartium中效果很好,但在Javascript中,浏览器进入无限循环,冻结标签甚至浏览器(在Chrome,Firefox和IE中也是如此)。我正在使用shadow_dom使其在其他浏览器上运行,而这只适用于使用Dart 1.0的Chrome。

开发人员工具如下所示: developer tools view of the multiple select

我真的没有看到在Dart端执行任何特定代码,上面显示的事件处理程序包含的代码很少对我有意义。当我暂停Javascript无限循环时,它会将我带到这个位置:

AbstractNgRepeatDirective._onCollectionChange$1 (myappui.dart.js:14365)
(anonymous function) (VM5977:3)
relaxFnApply (myappui.dart.js:15739)
Scope_$watchCollection_closure4.call$3 (myappui.dart.js:7031)
_Watch.fn$3 (myappui.dart.js:7124)
Scope._digestHandleDirty$5 (myappui.dart.js:6535)
Scope._digestComputeLastDirty$0 (myappui.dart.js:6497)
Scope._digestWhileDirtyLoop$0 (myappui.dart.js:6433)
Scope.$$digest$0 (myappui.dart.js:6419)
Scope._autoDigestOnTurnDone$0 (myappui.dart.js:6269)
(anonymous function) (VM5930:3)
_rootRun (myappui.dart.js:20398)
_ZoneDelegate.run$2 (myappui.dart.js:26185)
NgZone._finishTurn$2 (myappui.dart.js:7267)
NgZone._onRunBase$4 (myappui.dart.js:7239)
NgZone._onRunUnary$5 (myappui.dart.js:7246)
(anonymous function) (VM5919:3)
_ZoneDelegate.runUnary$3 (myappui.dart.js:26192)
_CustomizedZone.runUnary$2 (myappui.dart.js:26419)
_BaseZone.runUnaryGuarded$2 (myappui.dart.js:26285)
_BaseZone_bindUnaryCallback_closure.call$1 (myappui.dart.js:26357)
invokeClosure_closure0.call$0 (myappui.dart.js:4573)
_IsolateContext.eval$1 (myappui.dart.js:2006)
_callInIsolate (myappui.dart.js:1740)
invokeClosure (myappui.dart.js:3224)
(anonymous function) (myappui.dart.js:3241)
invoke (shadow_dom.debug.js:2587)
dispatchBubbling (shadow_dom.debug.js:2535)
dispatchEvent (shadow_dom.debug.js:2489)
dispatchOriginalEvent (shadow_dom.debug.js:2467)

循环代码:

_onCollectionChange$1: [function(collection) {
  var previousNode, cursor, arrayChange, t1, newRowOrder, $length, nextNode, index, value, row, childScope, t2, t3, block;
  previousNode = J.$index$asx(J.get$elements$x(this._blockHole), 0);
  cursor = this._blockHole;
  arrayChange = !J.$eq(this._lastCollection, collection);
  if (arrayChange)
    this._lastCollection = collection;
  t1 = J.getInterceptor(collection);
  if (typeof collection !== "object" || collection === null || collection.constructor !== Array && !t1.$isIterable)
    collection = [];
  newRowOrder = this._computeNewRows$2(collection, null);
  t1 = J.getInterceptor$asx(collection);
  $length = t1.get$length(collection);
  if (typeof $length !== "number")
    return H.iae($length);
  nextNode = null;
  index = 0;
  for (; index < $length; ++index) {
    value = t1.elementAt$1(collection, index);
    if (index >= newRowOrder.length)
      return H.ioore(newRowOrder, index);
    row = newRowOrder[index];
    if (row.get$startNode() != null) {
      childScope = row.get$scope();
      nextNode = previousNode;
      do
        nextNode = J.get$nextNode$x(nextNode);
      while (nextNode != null);
      if (J.$eq(row.get$startNode(), nextNode))
        ;
      else
        row.get$block().moveAfter$1(cursor);
      previousNode = row.get$endNode();
    } else
      childScope = this._directive$_scope.$$new$1$lazy(this.get$_shalow());
    t2 = J.getInterceptor$asx(childScope);

while(nextNode!= null)永远不会为空...

do
  nextNode = J.get$nextNode$x(nextNode);
while (nextNode != null);

因为我对Dart比较陌生,所以我不得不说我不知道​​在哪里看。有什么建议吗?

相关pubspec.yaml:

dependencies:
  angular: 0.9.4
  browser: any
  myapp:
    path: ../myappLib
  intl: any
  json_object: any
  petitparser: any
  shadow_dom: any

更新罪魁祸首显然是shadow_dom。当我删除标签时,它可以在Chrome中运行(显然不再适用于Firefox和IE)。

1 个答案:

答案 0 :(得分:0)

问题在更新版本的shadow_dom(0.9。*)

中消失了