AlreadyM / jscrollpane

Automatically exported from code.google.com/p/jscrollpane
0 stars 0 forks source link

"h" undefined #205

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
on line 429:

var h = $target.attr('href');
if (h.substr(0, 1) == '#') {
    scrollTo(h);
}

... if the anchor has no "href" attribute, then "h.substr" will result in error 
because "h" is "undefined". The if-statement needs to check if "h" is 
"undefined":

if (h != undefined && h.substr(0, 1) == '#') { ... }

Original issue reported on code.google.com by billy...@gmail.com on 18 Jun 2010 at 11:09

GoogleCodeExporter commented 9 years ago
it should probably check if "h" is not "null" as well:

if (h != undefined && h != null && h.substr(0, 1) == '#') { ... }

Original comment by billy...@gmail.com on 18 Jun 2010 at 11:12

GoogleCodeExporter commented 9 years ago
Thanks for the bug report. This issue was fixed quite a long time ago though 
(the release on the downloads page is very old). Please make sure you are using 
the latest version either from svn here on googlecode or from my site (which is 
always up to date with svn):

http://www.kelvinluck.com/assets/jquery/jScrollPane/scripts/jScrollPane.js

Cheers,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 21 Jun 2010 at 8:18