jQueryPlugins
jQueryPlugins copied to clipboard
printBodyOptions handling
The 'printBodyOptions' is not being handled correctly.
As long as 'printBodyOptions' is sent as parameter, any undefined property of it (classNameToAdd or styleToAdd) will be added to its respective attribute as the text 'undefined'.
Sample (snippet of my code): $('#selector').printElement({ leaveOpen:true, printMode:'popup', pageTitle:'some title', printBodyOptions: {}, overrideElementCSS:['my.css'] });
Generated body tag: <body style="undefined" class="undefined">
Plus, if only 'classNameToAdd' is defined, the generated tag will contain ' style="undefined" ', despite the default value for styleToAdd.
I haven't looked at the code, but my opinion is that parameters should be handled through a merge, preserving default values when undefined.
The 'extend' method from jQuery is perfect for such merge operation: http://api.jquery.com/jQuery.extend/
And thanks for the awesome plugin!