In a jQuery UI Widget Factory widget, is it considered "kosher" to leave option keys undefined? Or must every option key be defined?
It would produce different results when you check an option that might have a boolean value. If the key is defined, then it will return
false. If the key is not defined, it would return
undefined. For a simple boolean test, it would not make any difference. But I do not know what code or common practice may lurk that might test for an explicit value of
false.
I suppose I just answered my own question - all of the keys should be defined, because you just don't know how the options object might be used by application code.
I'm writing a new plugin to replace
jquery.mobile.iscrollview, which is getting long in the tooth, and only supports iScroll4 (and that only through 4.2). I'm writing a more modular plugin that will target jQuery, jQuery UI, and jQuery Mobile and wrap IScroll5. (Will need
widget.js for use with just jQuery.) It will also work more intimately with the iScroll5 code, patching it, for example, to register and trigger events through jQuery.
So, it's basically a wrapper for iscroll5, which is not a jQuery plugin. It has it's own options object, which I reflect back to the widget (merging with additional options that only have meaning to the widget). But iscroll5 omits keys for many options that default to
false. (iScroll4 did not do this.) So, I am trying to decide how much I need to massage the iScroll5 options.