Skip to content

Commit

Permalink
Fix handling of in-document links
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Jan 20, 2017
1 parent 22afdbd commit ac04d55
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export class WalkThroughPart extends BaseEditor {
this.content.addEventListener('click', event => {
let node = event.target;
if (node instanceof HTMLAnchorElement && node.href) {
let baseElement = window.document.getElementsByTagName('base')[0];
let baseElement = window.document.getElementsByTagName('base')[0] || window.location;
if (baseElement && node.href.indexOf(baseElement.href) >= 0 && node.hash) {
let scrollTarget = window.document.getElementById(node.hash.substr(1, node.hash.length - 1));
let scrollTarget = this.content.querySelector(node.hash);
if (scrollTarget) {
scrollTarget.scrollIntoView();
}
Expand Down

0 comments on commit ac04d55

Please sign in to comment.