Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
collapsible-last not reset during a refresh #4645
I ran into an issue using jqmobile in conjunction with knockout recently. Essentially, I have knockout generating new COLLAPSIBLE elements inside a COLLAPSIBLE-SET via knockout templates.
That part works just find, but I noticed odd behavior with the styling. It seemed almost as if every added collapsible was the last one, based on the way the corners were being styled.
Turns out, it looks like the refresh method never "resets" the flag "collapsible-last" on any elements. The "last" element has it set properly, but if you're dynamically adding collapsibles and calling refresh to update styling, they all end up marked as "last"
Adding the noted line of code below corrects the problem. Essentially, it just makes sure that collapsible-last is false for all collapsibles in the set before setting it true for the real last one.
Hi @drventure, thanks for reporting, good catch btw!
@uGoMobi would you agree, if the code in collapsibleSet.js _refresh would be changed to
I would remove the data object instead of setting it to "false".
I noticed you are new on Github and haven't forked the jQuery Mobile repo (yet).
I will change the code to fix this issue.
Hi, and Thanks for the comments. Yeah, I'm pretty new to git in general (I've mainly worked with TFS, Subversion and mercurial, kind of a windows guy). I started down the road of pull requests and such, but my eyes were starting to glaze over on all of it, so I thought I'd just go ahead and report this issue directly, as it's such a minor thing.
But thanks for that link. Hadn't seen that one, so I'll work through it and see what I can set up.
I agree about the removeclass. That would seem more in keeping with the rest of the library, now that you mention it.
If you're a Windows guy the new "Clone in Windows" tool from Github might be handy. Never tried it myself though.
BTW - I didn't change your fix to removeClass, but just changed it from setting the data object to false to completely remove it.
Yeah, sorry about that. i saw your response and misread the code you posted.. Right after I sent that, I realized that was a different change to fix something similar, but not quite the same as the -last tag, and that you'd used that jqmRemoveData function to just remove the tag.
Still getting used to JQuery, knockout and all the libraries/dom manipulation stuff. Quite a bit different from my background.
I'll check out that Clone in Windows tool. I've also read that GIT interoperates quite well with mercurial, so I hope to do some playing around there too.