2c19efdb by Adam Heath

This fixes a NPE in Ribets.Binding::constructor; a previous commit

reduced the size by removing access to this.options, and changing it to
options, but it was this.options that was auto-vivified into a new
object when the incoming options was null.  The fix made here also
happens to reduce the size a further 15 bytes.
1 parent e682703a
...@@ -14,7 +14,8 @@ class Rivets.Binding ...@@ -14,7 +14,8 @@ class Rivets.Binding
14 # All information about the binding is passed into the constructor; the DOM 14 # All information about the binding is passed into the constructor; the DOM
15 # element, the type of binding, the model object and the keypath at which 15 # element, the type of binding, the model object and the keypath at which
16 # to listen for changes. 16 # to listen for changes.
17 constructor: (@el, @type, @model, @keypath, @options = {}) -> 17 constructor: (@el, @type, @model, @keypath, options) ->
18 @options = (options ||= {})
18 unless binder = Rivets.binders[type] 19 unless binder = Rivets.binders[type]
19 for identifier, value of Rivets.binders 20 for identifier, value of Rivets.binders
20 if identifier isnt '*' and identifier.indexOf('*') isnt -1 21 if identifier isnt '*' and identifier.indexOf('*') isnt -1
...@@ -452,14 +453,16 @@ rivets = ...@@ -452,14 +453,16 @@ rivets =
452 config: Rivets.config 453 config: Rivets.config
453 454
454 # Sets configuration options by merging an object literal. 455 # Sets configuration options by merging an object literal.
455 configure: (options={}) -> 456 configure: (options) ->
457 options ||= {}
456 for property, value of options 458 for property, value of options
457 Rivets.config[property] = value 459 Rivets.config[property] = value
458 return 460 return
459 461
460 # Binds a set of model objects to a parent DOM element. Returns a Rivets.View 462 # Binds a set of model objects to a parent DOM element. Returns a Rivets.View
461 # instance. 463 # instance.
462 bind: (el, models = {}) -> 464 bind: (el, models) ->
465 models ||= {}
463 view = new Rivets.View(el, models) 466 view = new Rivets.View(el, models)
464 view.bind() 467 view.bind()
465 view 468 view
......