Code Duplication    Length = 43-43 lines in 2 locations

public/js/tinymce/themes/modern/theme.js 1 location

@@ 1726-1768 (lines=43) @@
1723
        }
1724
        return false;
1725
      },
1726
      find: function (container) {
1727
        var matches = [], i, l;
1728
        var selectors = this._selectors;
1729
        function collect(items, selector, index) {
1730
          var i, l, fi, fl, item;
1731
          var filters = selector[index];
1732
          for (i = 0, l = items.length; i < l; i++) {
1733
            item = items[i];
1734
            for (fi = 0, fl = filters.length; fi < fl; fi++) {
1735
              if (!filters[fi](item, i, l)) {
1736
                fi = fl + 1;
1737
                break;
1738
              }
1739
            }
1740
            if (fi === fl) {
1741
              if (index === selector.length - 1) {
1742
                matches.push(item);
1743
              } else {
1744
                if (item.items) {
1745
                  collect(item.items(), selector, index + 1);
1746
                }
1747
              }
1748
            } else if (filters.direct) {
1749
              return;
1750
            }
1751
            if (item.items) {
1752
              collect(item.items(), selector, index);
1753
            }
1754
          }
1755
        }
1756
        if (container.items) {
1757
          for (i = 0, l = selectors.length; i < l; i++) {
1758
            collect(container.items(), selectors[i], 0);
1759
          }
1760
          if (l > 1) {
1761
            matches = unique(matches);
1762
          }
1763
        }
1764
        if (!Collection) {
1765
          Collection = Selector.Collection;
1766
        }
1767
        return new Collection(matches);
1768
      }
1769
    });
1770
1771
    var Collection$1, proto;

public/js/tinymce/themes/inlite/theme.js 1 location

@@ 1186-1228 (lines=43) @@
1183
        }
1184
        return false;
1185
      },
1186
      find: function (container) {
1187
        var matches = [], i, l;
1188
        var selectors = this._selectors;
1189
        function collect(items, selector, index) {
1190
          var i, l, fi, fl, item;
1191
          var filters = selector[index];
1192
          for (i = 0, l = items.length; i < l; i++) {
1193
            item = items[i];
1194
            for (fi = 0, fl = filters.length; fi < fl; fi++) {
1195
              if (!filters[fi](item, i, l)) {
1196
                fi = fl + 1;
1197
                break;
1198
              }
1199
            }
1200
            if (fi === fl) {
1201
              if (index === selector.length - 1) {
1202
                matches.push(item);
1203
              } else {
1204
                if (item.items) {
1205
                  collect(item.items(), selector, index + 1);
1206
                }
1207
              }
1208
            } else if (filters.direct) {
1209
              return;
1210
            }
1211
            if (item.items) {
1212
              collect(item.items(), selector, index);
1213
            }
1214
          }
1215
        }
1216
        if (container.items) {
1217
          for (i = 0, l = selectors.length; i < l; i++) {
1218
            collect(container.items(), selectors[i], 0);
1219
          }
1220
          if (l > 1) {
1221
            matches = unique(matches);
1222
          }
1223
        }
1224
        if (!Collection) {
1225
          Collection = Selector.Collection;
1226
        }
1227
        return new Collection(matches);
1228
      }
1229
    });
1230
1231
    var Collection$1, proto;