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

When Scroll Page: theme.js:4 Uncaught TypeError: Cannot read property 'split' of undefined #1525

Closed
aimer1124 opened this issue Sep 8, 2016 · 6 comments

Comments

@aimer1124
Copy link

aimer1124 commented Sep 8, 2016

When i scroll my page in my Gitbook Content,the browser console is something wrong.Like this

theme.js:4 Uncaught TypeError: Cannot read property 'split' of undefined

console

And when i scroll, the wrong number increase fast.The background color is black

background


Gitbook and node Version

➜  jmeter-tutorial git:(master) ✗ gitbook --version
CLI version: 2.3.0
GitBook version: 3.2.0
➜  jmeter-tutorial git:(master) ✗ node -v
v4.4.3

My PC Version

ProductName:    Mac OS X
ProductVersion: 10.11.2
BuildVersion:   15C50
Chrome: 53.0.2785.116 (64-bit)

This is my gitbook homepage,but when i use Firefox browser,everything goes ok.

@maxkoryukov
Copy link

I have the very similar error:

theme.js:12924 Uncaught TypeError: Cannot read property 'top' of undefined

I have not-uglified line number (12924), just because I forced gitbook to use not-compressed default-theme (see also GitbookIO/theme-default#43)

So, in my case the errors was caused by the non-existent bookmark in the SUMMARY.md. Lets say:

  • in SUMMARY.md I have a link like
    * [about section](page.md#about)
  • but my page.md does not contain a chapter named about. Even if I have an explicit
    <a name="about"></a>
    this does not help - A-tag will not be recognized by name;

The error occurs in the GitbookIO/theme-default package , in the file /src/js/theme/navigation.js, line 63, function getElementTopPosition. In the following code:

dest = $el.position().top;

$el doesn't contain any tag, $el.position() returns undefined.

@maxkoryukov
Copy link

Actually, this issue should be moved to the default-theme repo

@SamyPesse
Copy link
Member

This issue can stay in this repository, since we moved to one repository for all packages now.

I'll close this issue once v4 is released as stable.

maxkoryukov added a commit to maxkoryukov/gitbook-plugin-theme-i-want-be-scoped-but-gitbook-wont that referenced this issue Feb 19, 2017
maxkoryukov added a commit to maxkoryukov/gitbook-plugin-theme-i-want-be-scoped-but-gitbook-wont that referenced this issue Feb 19, 2017
@maxkoryukov
Copy link

Fixed in GitbookIO/theme-default@fd742a1

@maxkoryukov
Copy link

ping @SamyPesse @AaronO to close this issue - it is closed, I've attached a link to a commit with a patch

@morsko1
Copy link

morsko1 commented Aug 29, 2018

hi @maxkoryukov,
you commented that this issue fixed by GitbookIO/theme-default@fd742a1

but in my case it didn`t solve issue of console errors when scrolling page:
image 049

if i use your fix of closed PR - there are no errors in console.

so can you confirm that GitbookIO/theme-default@fd742a1 fixed the console errors when scrolling?

and if it was not fixed by GitbookIO/theme-default@fd742a1 - could you reopen your closed PR please?

thanks

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

4 participants