| 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 } | 672 } |
| 673 } | 673 } |
| 674 return cand; | 674 return cand; |
| 675 } | 675 } |
| 676 | 676 |
| 677 /** | 677 /** |
| 678 * Checks whether [e] is tagged as obsolete or deprecated using heuristics | 678 * Checks whether [e] is tagged as obsolete or deprecated using heuristics |
| 679 * for what these tags look like in the MDN docs. | 679 * for what these tags look like in the MDN docs. |
| 680 */ | 680 */ |
| 681 bool isObsolete(Element e) { | 681 bool isObsolete(Element e) { |
| 682 RegExp obsoleteRegExp = new RegExp(@"(^|\s)obsolete(?=\s|$)"); | 682 RegExp obsoleteRegExp = new RegExp(r"(^|\s)obsolete(?=\s|$)"); |
| 683 RegExp deprecatedRegExp = new RegExp(@"(^|\s)deprecated(?=\s|$)"); | 683 RegExp deprecatedRegExp = new RegExp(r"(^|\s)deprecated(?=\s|$)"); |
| 684 for (Element child in e.queryAll("span")) { | 684 for (Element child in e.queryAll("span")) { |
| 685 String t = child.text.toLowerCase(); | 685 String t = child.text.toLowerCase(); |
| 686 if (t.startsWith("obsolete") || t.startsWith("deprecated")) return true; | 686 if (t.startsWith("obsolete") || t.startsWith("deprecated")) return true; |
| 687 } | 687 } |
| 688 | 688 |
| 689 String text = e.text.toLowerCase(); | 689 String text = e.text.toLowerCase(); |
| 690 return obsoleteRegExp.hasMatch(text) || deprecatedRegExp.hasMatch(text); | 690 return obsoleteRegExp.hasMatch(text) || deprecatedRegExp.hasMatch(text); |
| 691 } | 691 } |
| 692 | 692 |
| 693 bool isFirstCharLowerCase(String str) { | 693 bool isFirstCharLowerCase(String str) { |
| (...skipping 420 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 = const RegExp(@'^[\w/]+$'); | 1124 const SHORT_LINK = const RegExp(r'^[\w/]+$'); |
| 1125 const INNER_LINK = const RegExp(@'[Ee]n/(?:[\w/]+/|)([\w#.]+)(?:\(\))?$'); | 1125 const INNER_LINK = const RegExp(r'[Ee]n/(?:[\w/]+/|)([\w#.]+)(?:\(\))?$'); |
| 1126 const MEMBER_LINK = const RegExp(@'(\w+)[.#](\w+)'); | 1126 const MEMBER_LINK = const RegExp(r'(\w+)[.#](\w+)'); |
| 1127 const RELATIVE_LINK = const RegExp(@'^(?:../)*/?[Ee][Nn]/(.+)'); | 1127 const RELATIVE_LINK = const 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 |