reinitialisation bug (v2b1)

68 views
Skip to first unread message

RwL

unread,
Aug 18, 2010, 3:00:30 PM8/18/10
to jscrollpane
I'm pretty sure this is a bug; here's a testcase I created for
verification:

http://www.lifford.org/exp/jscrollpane-reinit/

In a vertical-only scrolling scenario, reinitialising jScrollPane
(either via the api or simply by re-calling .jScrollPane() on the
original element) strips out the width of the div.jspPane and causes a
rendering issue: the absolutely-positioned div renders only as wide as
its text content. The expected behavior is that it'll fill the
available width, as it does on page load after the first call
to .jScrollPane().

Kelvin Luck

unread,
Aug 18, 2010, 4:40:44 PM8/18/10
to jscro...@googlegroups.com
Hi,

Can you please try with the latest revision of jScrollPane - I made some
tweaks this morning to fix a bug regarding padding (see
http://jscrollpane.kelvinluck.com/runeimp.html ).

You can find the latest version in the git repository or on my site or you
can download it directly from github:
http://github.com/vitch/jScrollPane/raw/master/script/jquery.jscrollpane.js

Another thing you could try is to manually set the width on the ul to 100%.

In fact, I think you have found a bug... If I look at my autoReinitialise
example I can see that the width is only set every second time the
scrollpane is initialised:
http://jscrollpane.kelvinluck.com/auto_reinitialise.html

I'll investigate further and get back to you...

Cheers,

Kelvin :)

Kelvin Luck

unread,
Aug 18, 2010, 4:59:29 PM8/18/10
to jscro...@googlegroups.com
Hi,

Ignore the previous email. Found the problem and fixed it:

http://github.com/vitch/jScrollPane/commit/1083785087f1ed80a623ff45a0208b40471dd9c0

Please try again with the latest jScrollPane code from my site or github,

Thanks for the bug report,

Kelvin :)

On Wed, 18 Aug 2010 21:40:44 +0100, Kelvin Luck <kel...@kelvinluck.com>
wrote:

Rob Lifford

unread,
Aug 18, 2010, 5:14:04 PM8/18/10
to jscro...@googlegroups.com
Nice -- another bug may have been introduced in the process, though:

http://www.lifford.org/exp/jscrollpane-reinit/ (updated to use latest v2 beta 2)

Note how my original target div for jScrollPane has a set width of
400px, which is respected on load, but on reinit it gets set to auto,
so it expands to fill the space (I have a pretty narrow max-width set
on the body).

The re-init does not strip the width on jspPane, but it does get set
to the new too-wide width of the parent.

Also (and apologies in advance if you think this should've been a
separate thread) in the project I'm working on and presently updating
to jScrollPane 2, I have jScrollPanes controlling large areas of the
interface (working with the UI.Layout plugin) and sometimes have small
scrollable list boxes (like in my testcase) nested inside them.
Re-initializing the outer one can strip the scrollbars out of the
inner one, because of this (currently line 146 in the latest beta 2
unminified) line of code:

container.find('.jspVerticalBar,.jspHorizontalBar').remove().end();

Can you think of any reason not to make that...

container.find('> .jspVerticalBar, > .jspHorizontalBar').remove().end();

...so we only remove direct children scrollbars of the current container?

Thanks a ton for this plugin and the very hard work you put in
supporting it, Kelvin!

RL

> --
> You received this message because you are subscribed to the Google Groups
> "jscrollpane" group.
> To post to this group, send email to jscro...@googlegroups.com.
> To unsubscribe from this group, send email to
> jscrollpane...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jscrollpane?hl=en.
>
>

Kelvin Luck

unread,
Aug 18, 2010, 5:50:22 PM8/18/10
to jscro...@googlegroups.com
Hi Rob,

Thanks for the detailed test case. I'll have to have a look into it
tomorrow morning (I'm in the UK and it's getting pretty late).

Re. the second part of your email, you are completely right. Not sure how
that slipped my mind (although I haven't done any tests yet with nested
scrollbars). Anyway - the fix is done:
http://github.com/vitch/jScrollPane/commit/05f5bed1bae868d1403ca556a1960afcc483b30c

Thanks again - I'll look into your other problem ASAP,

Kelvin :)

Kelvin Luck

unread,
Aug 19, 2010, 5:01:10 AM8/19/10
to jscro...@googlegroups.com
Hi Rob,

I've fixed the problem with regards to the width being reset. Turned out
to be a super simple fix:
http://github.com/vitch/jScrollPane/commit/274aaca214ad3c5f26b136ae1458a3b78e316ff9#diff-1

I'm surprised that all the other examples seem to work fine with that line
removed - I think I added it in while trying to get the dynamic width
example to work. But I just did a quick check across browsers and all
seemed to be OK.

I also put together an example page like yours for testing:
http://jscrollpane.kelvinluck.com/fixed_width.html

Thanks again for the bug report - let me know if you run into any other
difficulties,

Kelvin :)

Muckinger

unread,
Aug 19, 2010, 9:26:27 AM8/19/10
to jscrollpane
Hi Kelvin,

i also have a problem with

when i load content via ajax into the scollpane and use
autoReinitialise: true, the div with class "jspPane" gets wider every
intervall.
The content are floated divs, but enclosed with a div with clearfix.
It seems that this funktion always gets another, bigger value:
previousPaneWidth = pane.innerWidth();

Any thoughts about that?

Ans thx for the great plugin and your work!

Muckinger

Kelvin Luck

unread,
Aug 19, 2010, 11:55:49 AM8/19/10
to jscro...@googlegroups.com
Hi,

Are you using the latest version of the script? Do you have a URL I could
take a look at?

Cheers,

Kelvin :)

On Thu, 19 Aug 2010 14:26:27 +0100, Muckinger <marcu...@googlemail.com>
wrote:

RwL

unread,
Aug 20, 2010, 11:35:56 AM8/20/10
to jscrollpane
Awesome but maybe not 100% there yet; take a look at updates to my
testcase:

http://www.lifford.org/exp/jscrollpane-reinit/

When the content is not scrollable there's still the potential for
undesired rendering on first load... I think it's wise to always set
an explicit pixel width on jspPane whenever horizontal scrolling isn't
necessary.

Also noted a possible glitch if I add padding to the element that
calls jScrollPane; that's in the updated testcase as well.

Regards,
RL

On Aug 19, 4:01 am, "Kelvin Luck" <kel...@kelvinluck.com> wrote:
> Hi Rob,
>
> I've fixed the problem with regards to the width being reset. Turned out  
> to be a super simple fix:http://github.com/vitch/jScrollPane/commit/274aaca214ad3c5f26b136ae14...
>
> I'm surprised that all the other examples seem to work fine with that line  
> removed - I think I added it in while trying to get the dynamic width  
> example to work. But I just did a quick check across browsers and all  
> seemed to be OK.
>
> I also put together an example page like yours for testing:http://jscrollpane.kelvinluck.com/fixed_width.html
>
> Thanks again for the bug report - let me know if you run into any other  
> difficulties,
>
> Kelvin :)
>
>
>
>
>
>
>
> On Wed, 18 Aug 2010 22:14:04 +0100, Rob Lifford <r...@lifford.org> wrote:
> > Nice -- another bug may have been introduced in the process, though:
>
> >http://www.lifford.org/exp/jscrollpane-reinit/(updated to use latest v2  
> >>http://github.com/vitch/jScrollPane/commit/1083785087f1ed80a623ff45a0...
>
> >> Please try again with the latest jScrollPane code from my site or  
> >> github,
>
> >> Thanks for the bug report,
>
> >> Kelvin :)
>
> >> On Wed, 18 Aug 2010 21:40:44 +0100, Kelvin Luck <kel...@kelvinluck.com>
> >> wrote:
>
> >>> Hi,
>
> >>> Can you please try with the latest revision of jScrollPane - I made  
> >>> some
> >>> tweaks this morning to fix a bug regarding padding (see
> >>>http://jscrollpane.kelvinluck.com/runeimp.html).
>
> >>> You can find the latest version in the git repository or on my site or  
> >>> you
> >>> can download it directly from github:
>
> >>>http://github.com/vitch/jScrollPane/raw/master/script/jquery.jscrollp...
>
> >>> Another thing you could try is to manually set the width on the ul to
> >>> 100%.
>
> >>> In fact, I think you have found a bug... If I look at my  
> >>> autoReinitialise
> >>> example I can see that the width is only set every second time the
> >>> scrollpane is initialised:
> >>>http://jscrollpane.kelvinluck.com/auto_reinitialise.html
>
> >>> I'll investigate further and get back to you...
>
> >>> Cheers,
>
> >>> Kelvin :)
>

Kelvin Luck

unread,
Aug 20, 2010, 11:43:35 AM8/20/10
to jscro...@googlegroups.com
Hi,

Thanks for another great test case! Looks like the width: auto was useful
for something after all (the padding calculation). Looks like I also broke
this example:

http://jscrollpane.kelvinluck.com/runeimp.html

I'll investigate further and issue a fix ASAP.

Do you mind if I include you test cases in the jScrollPane repository/
website? I'm thinking I'll make another folder called contrib or something
and keep the third party examples/ tests in there...

Cheers,

Kelvin :)

Rob Lifford

unread,
Aug 20, 2010, 12:08:26 PM8/20/10
to jscro...@googlegroups.com
> Thanks for another great test case! Looks like the width: auto was useful
> for something after all (the padding calculation). Looks like I also broke
> this example:
>
> http://jscrollpane.kelvinluck.com/runeimp.html
>
> I'll investigate further and issue a fix ASAP.

Awesome.

> Do you mind if I include you test cases in the jScrollPane repository/
> website? I'm thinking I'll make another folder called contrib or something
> and keep the third party examples/ tests in there...

Don't mind at all -- go right ahead!

RL

Rob Lifford

unread,
Aug 20, 2010, 12:46:46 PM8/20/10
to jscro...@googlegroups.com
I think I may be able to contribute to this fix:

1) in this conditional:
if (!(isScrollableH || isScrollableV))
set the pane width to the container width:
pane.css({'top': 0, 'width': container.width() });

2) in the case of reinitialization, don't call pane.css('width',
null); until after the check to see that nothing has happened since
last initiliazation (so, I put it after the following code block):

if (!hasContainingSpaceChanged && pane.outerWidth() ==
contentWidth && pane.outerHeight() == contentHeight) {
// Nothing has changed since we last initialised
if (isScrollableH || isScrollableV) { // If we had already set a
width then re-set it
pane.css('width', previousPaneWidth + 'px');
}
// Then abort...
return;
}

This seems to be working on my current project; I just checked and it
seems to fix my testcase as well, but I then
rolled the changes out of my testcase so it continues to demonstrate the bug.

Hope that's helpful,
RL

Kelvin Luck

unread,
Aug 20, 2010, 1:12:11 PM8/20/10
to jscro...@googlegroups.com
Thanks for that Rob. I haven't had a chance to look into it yet but it
sounds like that will help me out.

Off the top of my head, the only thing I can see it causing problems with
is the dynamic width instances (e.g.
http://jscrollpane.kelvinluck.com/dynamic_width.html ). Hopefully it will
work though...

I'll have a fixed and tested version of jScrollPane up by Monday morning
GMT - hopefully all I'll need to do is use your fix!

Thanks again,

Kelvin :)

Rob Lifford

unread,
Aug 20, 2010, 2:22:00 PM8/20/10
to jscro...@googlegroups.com
My pleasure. For convenience, I've added another instance to the page
that has its width set to 100%...

Kelvin Luck

unread,
Aug 21, 2010, 9:44:16 AM8/21/10
to jscro...@googlegroups.com
Thanks!

I think I've fixed the problem - you can see your test page here:
http://jscrollpane.kelvinluck.com/issues/7/

And links to the fixes on the issues list here:
http://github.com/vitch/jScrollPane/issues/issue/7

Please grab the latest code and let me know if it works correctly in situ
on your page,

Thanks,

Kelvin :)

Reply all
Reply to author
Forward
0 new messages