jquery-qrcode
jquery-qrcode copied to clipboard
API suggestion
Why not optionally put the data in the div, like so?:
<div id="qrcode">This is my data.</div>
This would also fail gracefully and just display the data. The existing call for using the library would override this method.
this call seems pretty specific, so it may not be suitable in a library
why do you think such a call should be in the library and not in your application code ?
A few reasons:
- It feels like a sane default.
- The data to be displayed is in the QR code div, rather than separated in some (potentially static) JS file at worst, or at the bottom of my page at best.
- It fails better if the client has JS disabled.
I see you've updated the API call to take an argument, I was going off the GitHub page. What I propose is, in addition to:
jquery('#qrcode').qrcode({width: 64,height: 64,text: "size doesn't matter"});
that the following syntax be also supported:
jquery('#qrcode').qrcode();
Width, height and text could be retrieved from the div (and width/height set in CSS), which is a cleaner separation and more in line with the spirit of HTML/CSS.