Ticket #3876: javascript_element_proxy.3597.diff
| File javascript_element_proxy.3597.diff, 1.6 kB (added by rick, 3 years ago) |
|---|
-
activesupport/lib/active_support/json.rb
old new 3 3 module ActiveSupport 4 4 module JSON #:nodoc: 5 5 class CircularReferenceError < StandardError; end 6 6 # returns the literal string as its JSON encoded form. Useful for passing javascript variables into functions. 7 # 8 # page.call 'Element.show', ActiveSupport::JSON::Variable.new("$$(#items li)") 9 class Variable < String 10 def to_json 11 self 12 end 13 end 14 7 15 class << self 8 16 REFERENCE_STACK_VARIABLE = :json_reference_stack 9 17 -
actionpack/lib/action_view/helpers/prototype_helper.rb
old new 725 725 super(generator, "$$('#{pattern}')") 726 726 end 727 727 728 # Calls the each enumorable method on the array returned from the #select call. 729 # 730 # page.select('#versions li.selected').each do |page, element| 731 # page.call 'Element.removeClassName', element, 'selected' 732 # end 733 # 734 def each 735 @generator << '.each(function(element) {' 736 yield @generator, ActiveSupport::JSON::Variable.new('element') if block_given? 737 @generator << '});' 738 end 739 728 740 # TODO: Implement funky stuff like .each 729 741 end 730 742 end