lib/zafu/process/context.rb in zafu-0.8.5 vs lib/zafu/process/context.rb in zafu-0.8.6
- old
+ new
@@ -37,20 +37,22 @@
end
else
out "<% #{node}.each do |#{var}| %>"
end
+ raw_dom_prefix = node.raw_dom_prefix
with_context(:node => node.move_to(var, node.klass.first, :query => node.opts[:query])) do
# We pass the :query option for RubyLess resolution by using the QueryBuilder finder
steal_and_eval_html_params_for(@markup, @params)
# The id set here should be used as prefix for sub-nodes to ensure uniqueness of generated DOM ids
if node.list_context?
# we are still in a list (example: previous context was [[Node]], current is [Node])
else
- node.dom_prefix ||= dom_name
+ # Change dom_prefix if it isn't our own (inherited).
+ node.dom_prefix = dom_name unless raw_dom_prefix
node.propagate_dom_scope!
if need_dom_id?
@markup.set_id(node.dom_id)
end
@@ -163,12 +165,12 @@
end
# Change context for a given scope.
def with_context(cont, merge = true)
raise "Block missing" unless block_given?
- cont_bak = @context.dup
+ cont_bak = @context
if merge
- @context.merge!(cont)
+ @context = @context.merge(cont)
else
@context = cont
end
res = yield
@context = cont_bak