OLD | NEW |
1 #import ("dart:html"); | 1 #import ("dart:html"); |
2 #import ("dart:json"); | 2 #import ("dart:json"); |
3 | 3 |
4 // Workaround for HTML lib missing feature. | 4 // Workaround for HTML lib missing feature. |
5 Range newRange() { | 5 Range newRange() { |
6 return document.createRange(); | 6 return document.createRange(); |
7 } | 7 } |
8 | 8 |
9 // Temporary range object to optimize performance computing client rects | 9 // Temporary range object to optimize performance computing client rects |
10 // from text nodes. | 10 // from text nodes. |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 // Trim useless nodes from the front. | 427 // Trim useless nodes from the front. |
428 while (root.nodes.length > 0 && | 428 while (root.nodes.length > 0 && |
429 isSkippable(root.nodes.first)) { | 429 isSkippable(root.nodes.first)) { |
430 root.nodes.first.remove(); | 430 root.nodes.first.remove(); |
431 changed = true; | 431 changed = true; |
432 } | 432 } |
433 | 433 |
434 // Trim useless nodes from the back. | 434 // Trim useless nodes from the back. |
435 while (root.nodes.length > 0 && | 435 while (root.nodes.length > 0 && |
436 isSkippable(root.nodes.last())) { | 436 isSkippable(root.nodes.last)) { |
437 root.nodes.last().remove(); | 437 root.nodes.last.remove(); |
438 changed = true; | 438 changed = true; |
439 } | 439 } |
440 } | 440 } |
441 return JSONFIXUPHACK(root.innerHTML); | 441 return JSONFIXUPHACK(root.innerHTML); |
442 } | 442 } |
443 | 443 |
444 String genPrettyHtmlFromElement(Element e) { | 444 String genPrettyHtmlFromElement(Element e) { |
445 e = e.clone(true); | 445 e = e.clone(true); |
446 return genCleanHtml(e); | 446 return genCleanHtml(e); |
447 } | 447 } |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 } | 1176 } |
1177 | 1177 |
1178 // Put it back into the element. | 1178 // Put it back into the element. |
1179 a.attributes['href'] = href; | 1179 a.attributes['href'] = href; |
1180 } | 1180 } |
1181 | 1181 |
1182 if (!title.toLowerCase().contains(currentTypeTiny.toLowerCase())) { | 1182 if (!title.toLowerCase().contains(currentTypeTiny.toLowerCase())) { |
1183 bool foundMatch = false; | 1183 bool foundMatch = false; |
1184 // Test out if the title is really an HTML tag that matches the | 1184 // Test out if the title is really an HTML tag that matches the |
1185 // current class name. | 1185 // current class name. |
1186 for (String tag in [title.split(" ")[0], title.split(".").last()]) { | 1186 for (String tag in [title.split(" ")[0], title.split(".").last]) { |
1187 try { | 1187 try { |
1188 Element element = new Element.tag(tag); | 1188 Element element = new Element.tag(tag); |
1189 // TODO(jacobr): this is a really ugly way of doing this that will | 1189 // TODO(jacobr): this is a really ugly way of doing this that will |
1190 // stop working at some point soon. | 1190 // stop working at some point soon. |
1191 if (element.typeName == currentType) { | 1191 if (element.typeName == currentType) { |
1192 foundMatch = true; | 1192 foundMatch = true; |
1193 break; | 1193 break; |
1194 } | 1194 } |
1195 } catch (e) {} | 1195 } catch (e) {} |
1196 } | 1196 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 } | 1305 } |
1306 | 1306 |
1307 void documentLoaded(event) { | 1307 void documentLoaded(event) { |
1308 // Load the database of expected methods and properties with an HttpRequest. | 1308 // Load the database of expected methods and properties with an HttpRequest. |
1309 new HttpRequest.get('${window.location}.json', (req) { | 1309 new HttpRequest.get('${window.location}.json', (req) { |
1310 data = JSON.parse(req.responseText); | 1310 data = JSON.parse(req.responseText); |
1311 dbEntry = {'members': [], 'srcUrl': pageUrl}; | 1311 dbEntry = {'members': [], 'srcUrl': pageUrl}; |
1312 run(); | 1312 run(); |
1313 }); | 1313 }); |
1314 } | 1314 } |
OLD | NEW |