Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(812)

Unified Diff: client/html/src/DocumentFragmentWrappingImplementation.dart

Issue 8424012: Add optional arguments to our indexOf/lastIndexOf methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: client/html/src/DocumentFragmentWrappingImplementation.dart
===================================================================
--- client/html/src/DocumentFragmentWrappingImplementation.dart (revision 942)
+++ client/html/src/DocumentFragmentWrappingImplementation.dart (working copy)
@@ -99,10 +99,14 @@
Iterator<Element> iterator() => _filtered.iterator();
List<Element> getRange(int start, int length) =>
_filtered.getRange(start, length);
- int indexOf(Element element, int startIndex) =>
- _filtered.indexOf(element, startIndex);
- int lastIndexOf(Element element, int startIndex) =>
- _filtered.lastIndexOf(element, startIndex);
+ int indexOf(Element element, [int start = 0]) =>
+ _filtered.indexOf(element, start);
+
+ int lastIndexOf(Element element, [int start = null]) {
srdjan 2011/10/31 18:01:29 WHy not just [int start] (here and everywhere else
ngeoffray 2011/11/01 07:50:44 Last time I checked, not giving a default value fa
+ if (start === null) start = length - 1;
+ return _filtered.lastIndexOf(element, start);
+ }
+
Element last() => _filtered.last();
}
@@ -362,4 +366,4 @@
throw new UnsupportedOperationException(
"WebKit drop zone can't be set for document fragments.");
}
-}
+}

Powered by Google App Engine
This is Rietveld 408576698