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

Side by Side Diff: utils/apidoc/mdn/extract.dart

Issue 10887023: Use new try-catch syntax in runtime/, tools/, and utils/. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | utils/css/css.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #import ("dart:html"); 1 #import ("dart:html");
2 #import ("dart:dom_deprecated", prefix:"dom"); 2 #import ("dart:dom_deprecated", prefix:"dom");
3 #import ("dart:json"); 3 #import ("dart:json");
4 4
5 // Workaround for HTML lib missing feature. 5 // Workaround for HTML lib missing feature.
6 Range newRange() { 6 Range newRange() {
7 return LevelDom.wrapRange(dom.document.createRange()); 7 return LevelDom.wrapRange(dom.document.createRange());
8 } 8 }
9 9
10 // Temporary range object to optimize performance computing client rects 10 // Temporary range object to optimize performance computing client rects
(...skipping 13 matching lines...) Expand all
24 _tempRange.setEndAfter(n); 24 _tempRange.setEndAfter(n);
25 return _tempRange.getBoundingClientRect(); 25 return _tempRange.getBoundingClientRect();
26 } 26 }
27 } 27 }
28 28
29 /** 29 /**
30 * CSS class that is added to elements in the DOM to indicate that they should 30 * CSS class that is added to elements in the DOM to indicate that they should
31 * be removed when extracting blocks of documentation. This is helpful when 31 * be removed when extracting blocks of documentation. This is helpful when
32 * running this script in a web browser as it is easy to visually see what 32 * running this script in a web browser as it is easy to visually see what
33 * blocks of information were extracted when using CSS such as DEBUG_CSS 33 * blocks of information were extracted when using CSS such as DEBUG_CSS
34 * which highlights elements that should be removed. 34 * which highlights elements that should be removed.
35 */ 35 */
36 final DART_REMOVED = "dart-removed"; 36 final DART_REMOVED = "dart-removed";
37 37
38 final DEBUG_CSS = """ 38 final DEBUG_CSS = """
39 <style type="text/css"> 39 <style type="text/css">
40 .dart-removed { 40 .dart-removed {
41 background-color: rgba(255, 0, 0, 0.5); 41 background-color: rgba(255, 0, 0, 0.5);
42 } 42 }
43 </style>"""; 43 </style>""";
44 44
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 // current class name. 1187 // current class name.
1188 for (String tag in [title.split(" ")[0], title.split(".").last()]) { 1188 for (String tag in [title.split(" ")[0], title.split(".").last()]) {
1189 try { 1189 try {
1190 dom.Element element = dom.document.createElement(tag); 1190 dom.Element element = dom.document.createElement(tag);
1191 // TODO(jacobr): this is a really ugly way of doing this that will 1191 // TODO(jacobr): this is a really ugly way of doing this that will
1192 // stop working at some point soon. 1192 // stop working at some point soon.
1193 if (element.typeName == currentType) { 1193 if (element.typeName == currentType) {
1194 foundMatch = true; 1194 foundMatch = true;
1195 break; 1195 break;
1196 } 1196 }
1197 } catch(e) {} 1197 } catch (e) {}
1198 } 1198 }
1199 if (!foundMatch) { 1199 if (!foundMatch) {
1200 dbEntry['skipped'] = true; 1200 dbEntry['skipped'] = true;
1201 dbEntry['cause'] = "Suspect title"; 1201 dbEntry['cause'] = "Suspect title";
1202 onEnd(); 1202 onEnd();
1203 return; 1203 return;
1204 } 1204 }
1205 } 1205 }
1206 1206
1207 Element root = document.query(".pageText"); 1207 Element root = document.query(".pageText");
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 1308
1309 void documentLoaded(event) { 1309 void documentLoaded(event) {
1310 // Load the database of expected methods and properties with an 1310 // Load the database of expected methods and properties with an
1311 // XMLHttpRequest. 1311 // XMLHttpRequest.
1312 new XMLHttpRequest.get('${window.location}.json', (req) { 1312 new XMLHttpRequest.get('${window.location}.json', (req) {
1313 data = JSON.parse(req.responseText); 1313 data = JSON.parse(req.responseText);
1314 dbEntry = {'members': [], 'srcUrl': pageUrl}; 1314 dbEntry = {'members': [], 'srcUrl': pageUrl};
1315 run(); 1315 run();
1316 }); 1316 });
1317 } 1317 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | utils/css/css.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698