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 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 } | 1114 } |
1115 | 1115 |
1116 // Flatten the list of known DOM types into a faster and case-insensitive | 1116 // Flatten the list of known DOM types into a faster and case-insensitive |
1117 // map. | 1117 // map. |
1118 domTypes = {}; | 1118 domTypes = {}; |
1119 for (final domType in domTypesRaw) { | 1119 for (final domType in domTypesRaw) { |
1120 domTypes[domType.toLowerCase()] = domType; | 1120 domTypes[domType.toLowerCase()] = domType; |
1121 } | 1121 } |
1122 | 1122 |
1123 // Fix up links. | 1123 // Fix up links. |
1124 const SHORT_LINK = new RegExp(r'^[\w/]+$'); | 1124 final SHORT_LINK = new RegExp(r'^[\w/]+$'); |
1125 const INNER_LINK = new RegExp(r'[Ee]n/(?:[\w/]+/|)([\w#.]+)(?:\(\))?$'); | 1125 final INNER_LINK = new RegExp(r'[Ee]n/(?:[\w/]+/|)([\w#.]+)(?:\(\))?$'); |
1126 const MEMBER_LINK = new RegExp(r'(\w+)[.#](\w+)'); | 1126 final MEMBER_LINK = new RegExp(r'(\w+)[.#](\w+)'); |
1127 const RELATIVE_LINK = new RegExp(r'^(?:../)*/?[Ee][Nn]/(.+)'); | 1127 final RELATIVE_LINK = new RegExp(r'^(?:../)*/?[Ee][Nn]/(.+)'); |
1128 | 1128 |
1129 // - Make relative links absolute. | 1129 // - Make relative links absolute. |
1130 // - If we can, take links that point to other MDN pages and retarget them | 1130 // - If we can, take links that point to other MDN pages and retarget them |
1131 // to appropriate pages in our docs. | 1131 // to appropriate pages in our docs. |
1132 // TODO(rnystrom): Add rel external to links we didn't fix. | 1132 // TODO(rnystrom): Add rel external to links we didn't fix. |
1133 for (AnchorElement a in document.queryAll('a')) { | 1133 for (AnchorElement a in document.queryAll('a')) { |
1134 // Get the raw attribute because we *don't* want the browser to fully- | 1134 // Get the raw attribute because we *don't* want the browser to fully- |
1135 // qualify the name for us since it has the wrong base address for the | 1135 // qualify the name for us since it has the wrong base address for the |
1136 // page. | 1136 // page. |
1137 var href = a.attributes['href']; | 1137 var href = a.attributes['href']; |
(...skipping 167 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 |