* Finds the closest ancestor anchor element (including the target itself). * * @param {HTMLElement} target The element to start scanning from. * @return {HTMLElement} An element which is the closest ancestor anchor.
(target)
| 949 | * @return {HTMLElement} An element which is the closest ancestor anchor. |
| 950 | */ |
| 951 | function anchorTarget(target) { |
| 952 | while (target) { |
| 953 | if (target.nodeName === 'A') return target; |
| 954 | target = target.parentNode; |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | /** |
| 959 | * Handles anchor elements with a hash fragment for non-HTML5 browsers |