vendor/assets/javascripts/modularity.js.coffee in modularity-rails-0.5.1 vs vendor/assets/javascripts/modularity.js.coffee in modularity-rails-0.5.2
- old
+ new
@@ -5,10 +5,13 @@
# Please see https://github.com/kevgo/modularity for more information.
class window.Module
# The container variable is required. Provide 'testing' in tests.
- constructor: (@container) ->
+ constructor: (container) ->
+ container = $(container) if (typeof container == 'string') and container != 'testing'
+ @container = container
+
return alert 'Error in Module constructor: No container given.' unless @container?
if container != 'testing'
return alert 'Error in Module constructor: The given container must be a jQuery object.' unless typeof container.jquery == 'string'
return alert "Error in Module constructor: The given container ('#{container.selector}') is empty." unless container? and container.length > 0
return alert "Error in Module constructor: The given container ('#{container.selector}') has more than one element." unless container? and container.length == 1