From 4abb9e81a82099725da052c1fe8a0cb4ea94871b Mon Sep 17 00:00:00 2001 From: Evan Verworn Date: Tue, 24 Mar 2015 13:55:51 -0400 Subject: [PATCH 1/2] Fix ensure .init() can handle jquery objects --- src/rivets.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rivets.coffee b/src/rivets.coffee index ecb0d27d9..d91ae0ea3 100644 --- a/src/rivets.coffee +++ b/src/rivets.coffee @@ -66,6 +66,7 @@ Rivets = # returns a Rivets.View instance. init: (component, el, data = {}) -> el ?= document.createElement 'div' + el = if el instanceof jQuery then el[0] component = Rivets.public.components[component] el.innerHTML = component.template.call @, el scope = component.initialize.call @, el, data From 149e27584bd515c8b6a6b441d75cbee1063c703a Mon Sep 17 00:00:00 2001 From: Evan Verworn Date: Tue, 24 Mar 2015 15:32:21 -0400 Subject: [PATCH 2/2] Fixup - should probably check if jQuery is even a thing --- src/rivets.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rivets.coffee b/src/rivets.coffee index d91ae0ea3..4d298fb65 100644 --- a/src/rivets.coffee +++ b/src/rivets.coffee @@ -66,7 +66,7 @@ Rivets = # returns a Rivets.View instance. init: (component, el, data = {}) -> el ?= document.createElement 'div' - el = if el instanceof jQuery then el[0] + el = if !!(window['jQuery'] or window['$']) and el instanceof jQuery then el[0] else el component = Rivets.public.components[component] el.innerHTML = component.template.call @, el scope = component.initialize.call @, el, data