I Love Open Source

While working with the jQuery plugin HorizontalNav.js, I found a small bug in the code. In my project I was using HorizontalNav.js along with another plugin, Touchdown.js, and I am conditionally changing between the two menu displays depending on the window size.

Screenshot of duplicating div elements

The bug I found is really minor, but HorizontalNav.js was appending a new element each time it was activated. There should have been a conditional check to make sure the element didn’t already exist before another element was appended.

I filed an issue on Github explaining the bug and then looked into how I could fix the code for my project. In a matter of minutes I had added the conditional statement needed and tested my code. I knew my fix was not just useful to myself, but would also be useful to the plugin as a whole. I forked the original author’s repository and submitted a pull request with my code for fixing the bug that I had filed. About 15 minutes later, the author had accepted my pull request and everyone was happy.

code contribution

This is my favorite aspect of open source code projects. Everyone has the power to contribute. When you find a bug record what steps are needed to replicate it. Report the bug and be sure to provide as much information as possible. Then if you think you can fix the bug, do so and contribute your patch back to the original project. If you cannot fix the bug, that is okay. You can still be a part of the solution by answering follow-up questions in a timely manner.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>