(parent, callback)
| 214 | * @return {?Element} |
| 215 | */ |
| 216 | export function lastChildElement(parent, callback) { |
| 217 | for ( |
| 218 | let child = parent.lastElementChild; |
| 219 | child; |
| 220 | child = child.previousElementSibling |
| 221 | ) { |
| 222 | if (callback(child)) { |
| 223 | return child; |
| 224 | } |
| 225 | } |
| 226 | return null; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Finds all child elements that satisfy the callback. |
no test coverage detected