jeromeetienne / jquery-qrcode

qrcode generation standalone (doesn't depend on external services)
http://blog.jetienne.com/blog/2011/04/07/jquery-qrcode/
MIT License
4.85k stars 2.5k forks source link

API suggestion #47

Open skorokithakis opened 11 years ago

skorokithakis commented 11 years ago

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.

jeromeetienne commented 11 years ago

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 ?

skorokithakis commented 11 years ago

A few reasons:

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.