anchor.diff:  
           LocalHasRules := False;
           fkp2 := fkp;
  +        j2 := j;
           LocalCounter := 0;
  -        while (j < Integer(fgp.cxKeyArray)) and (fkp2.Key = fkp.Key) and (fkp2.ShiftFlags = fkp.ShiftFlags) do
  -        begin
  -          if not RuleIsExcludedByPlatform(fkp) then
  +        while (j < Integer(fgp.cxKeyArray)) do
  +        begin
  +          if not processed_rule[j] and not RuleIsExcludedByPlatform(fkp) and
  +            (fkp2.Key = fkp.Key) and (fkp2.ShiftFlags = fkp.ShiftFlags) then
             begin
               processed_rule[j] := True;
               Result := Result + JavaScript_Rule(FTabStop + FTabStop + FTabStop, IfThen(LocalHasRules, 'else ', ''), fgp, fkp);
  
positive.code: 
  function TCompileKeymanWeb.JavaScript_Rules(fgp: PFILE_GROUP): string;
  var
    j: Integer;
    HasRules: Boolean;
    fkp2, fkp: PFILE_KEY;
    processed_rule: array of Boolean;
  
negative.code:         end;
  
          Result := Result + FTabStop + FTabStop + '}' + nl;
          fkp := fkp2;
          j := j2 + 1;
          Inc(fkp);
          // Inc(j);
        end
        else
        begin
  