Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when a method name starts with "$" #99

Open
myphysicslab opened this issue May 9, 2017 · 0 comments
Open

error when a method name starts with "$" #99

myphysicslab opened this issue May 9, 2017 · 0 comments

Comments

@myphysicslab
Copy link

An error occurs when navigating back to a page when the open card was for a method/function whose name starts with "$".

Here are steps to reproduce. I've done this on Mac OS X with Safari and Chrome.

  1. go to https://google.github.io/closure-library/api/goog.dom.DomHelper.html

  2. click one of the methods whose name start with "$" such as $dom. This opens the function "card".

  3. scroll down to getDocumentScroll(). (The $dom function should no longer be visible).

  4. click on goog.math.Coordinate to load that page.

  5. click the "back" browser button.

Result: you wind up back on the DomHelper page, but the $dom method is not open as it should be. In the Chrome browser console is this error message and stack:

dossier.js:36 Uncaught DOMException: Failed to execute 'querySelector' on 'Element': '#$dom'
is not a valid selector.
    at https://google.github.io/closure-library/api/dossier.js:214:161
    at Array.forEach (native)
    at lh (https://google.github.io/closure-library/api/dossier.js:214:134)
    at https://google.github.io/closure-library/api/dossier.js:214:390
    at e.c (https://google.github.io/closure-library/api/dossier.js:45:101)
    at nc (https://google.github.io/closure-library/api/dossier.js:48:195)
    at ic (https://google.github.io/closure-library/api/dossier.js:48:85)
    at C.l (https://google.github.io/closure-library/api/dossier.js:47:311)
    at Ob (https://google.github.io/closure-library/api/dossier.js:40:42)
    at <anonymous>

The error is occuring in the querySelector call in updatePageContent

  updatePageContent(data, snapshot, opt_path) {
    let newTitle = soy.renderAsFragment(pageTitle, {data});
    let newMain = soy.renderAsFragment(mainPageContent, {data});

    this.mainEl.innerHTML = '';
    this.mainEl.appendChild(newMain);
    document.title = newTitle.textContent;

    if (snapshot) {
      snapshot.getOpenCardList().forEach(id => {
        let card = this.mainEl.querySelector(`#${id.replace(/\./g, '\\.')}`);
        if (card) {
          card.classList.add('open');
        }
      });
      this.mainEl.parentElement.scrollTop = snapshot.getScroll();
    } else {
      this.mainEl.parentElement.scrollTop = 0;
    }

    if (opt_path) {
      this.historyService_.captureSnapshot(document.title, opt_path);
    }

    this.initProperties();
    this.updateSourceHighlight();
    this.navDrawer.updateCurrent();
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant