| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * A script to assist in documenting the difference between the dart:html API | 6 * A script to assist in documenting the difference between the dart:html API |
| 7 * and the old DOM API. | 7 * and the old DOM API. |
| 8 */ | 8 */ |
| 9 #library('renames'); | 9 #library('renames'); |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 if (htmlMember.isPrivate) return new Set(); | 102 if (htmlMember.isPrivate) return new Set(); |
| 103 if (htmlMember is MethodMember) { | 103 if (htmlMember is MethodMember) { |
| 104 final tags = _getTags(findComment(htmlMember.span)); | 104 final tags = _getTags(findComment(htmlMember.span)); |
| 105 if (tags.containsKey('domName')) { | 105 if (tags.containsKey('domName')) { |
| 106 final domName = tags['domName']; | 106 final domName = tags['domName']; |
| 107 if (domName == 'none') return new Set(); | 107 if (domName == 'none') return new Set(); |
| 108 return _membersFromName(domName, domType, world.dom); | 108 return _membersFromName(domName, domType, world.dom); |
| 109 } | 109 } |
| 110 if (domType == null) return new Set(); | 110 if (domType == null) return new Set(); |
| 111 if (htmlMember.definition == null) return new Set(); | 111 if (htmlMember.definition == null) return new Set(); |
| 112 if (htmlMember.name == 'get\$on') { | 112 if (htmlMember.name == 'get:on') { |
| 113 final members = _members(domType.members['addEventListener']); | 113 final members = _members(domType.members['addEventListener']); |
| 114 members.addAll(_members(domType.members['dispatchEvent'])); | 114 members.addAll(_members(domType.members['dispatchEvent'])); |
| 115 members.addAll(_members(domType.members['removeEventListener'])); | 115 members.addAll(_members(domType.members['removeEventListener'])); |
| 116 return members; | 116 return members; |
| 117 } | 117 } |
| 118 if (htmlMember.isFactory && htmlMember.name == '' && | 118 if (htmlMember.isFactory && htmlMember.name == '' && |
| 119 domType.name.endsWith('Event')) { | 119 domType.name.endsWith('Event')) { |
| 120 return _members(domType.members['init${domType.name}']); | 120 return _members(domType.members['init${domType.name}']); |
| 121 } | 121 } |
| 122 return _members(_getDomMember(htmlMember.definition.body, domType)); | 122 return _members(_getDomMember(htmlMember.definition.body, domType)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 Map<String, String> _getTags(String comment) { | 238 Map<String, String> _getTags(String comment) { |
| 239 if (comment == null) return const <String, String>{}; | 239 if (comment == null) return const <String, String>{}; |
| 240 final re = new RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); | 240 final re = new RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); |
| 241 final tags = <String, String>{}; | 241 final tags = <String, String>{}; |
| 242 for (var m in re.allMatches(comment.trim())) { | 242 for (var m in re.allMatches(comment.trim())) { |
| 243 tags[m[1]] = m[2]; | 243 tags[m[1]] = m[2]; |
| 244 } | 244 } |
| 245 return tags; | 245 return tags; |
| 246 } | 246 } |
| 247 } | 247 } |
| OLD | NEW |