volt 0.8.14 → 0.8.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/Readme.md +8 -2
  4. data/VERSION +1 -1
  5. data/app/volt/controllers/notices_controller.rb +1 -1
  6. data/app/volt/models/user.rb +2 -2
  7. data/app/volt/tasks/live_query/live_query_pool.rb +1 -1
  8. data/app/volt/tasks/query_tasks.rb +1 -1
  9. data/app/volt/tasks/store_tasks.rb +1 -1
  10. data/app/volt/tasks/user_tasks.rb +2 -2
  11. data/lib/volt/boot.rb +2 -2
  12. data/lib/volt/cli/asset_compile.rb +31 -27
  13. data/lib/volt/cli.rb +64 -65
  14. data/lib/volt/config.rb +25 -23
  15. data/lib/volt/console.rb +17 -16
  16. data/lib/volt/controllers/model_controller.rb +82 -80
  17. data/lib/volt/data_stores/data_store.rb +2 -2
  18. data/lib/volt/data_stores/mongo_driver.rb +2 -2
  19. data/lib/volt/extra_core/inflections.rb +2 -2
  20. data/lib/volt/extra_core/inflector/inflections.rb +185 -183
  21. data/lib/volt/extra_core/inflector/methods.rb +50 -48
  22. data/lib/volt/extra_core/string.rb +2 -2
  23. data/lib/volt/models/array_model.rb +93 -92
  24. data/lib/volt/models/cursor.rb +3 -2
  25. data/lib/volt/models/model.rb +248 -251
  26. data/lib/volt/models/model_hash_behaviour.rb +44 -44
  27. data/lib/volt/models/model_helpers.rb +38 -36
  28. data/lib/volt/models/model_state.rb +16 -17
  29. data/lib/volt/models/model_wrapper.rb +25 -24
  30. data/lib/volt/models/persistors/array_store.rb +145 -143
  31. data/lib/volt/models/persistors/base.rb +18 -16
  32. data/lib/volt/models/persistors/flash.rb +24 -22
  33. data/lib/volt/models/persistors/local_store.rb +46 -44
  34. data/lib/volt/models/persistors/model_identity_map.rb +10 -8
  35. data/lib/volt/models/persistors/model_store.rb +76 -76
  36. data/lib/volt/models/persistors/params.rb +19 -17
  37. data/lib/volt/models/persistors/query/query_listener.rb +65 -63
  38. data/lib/volt/models/persistors/query/query_listener_pool.rb +12 -10
  39. data/lib/volt/models/persistors/store.rb +28 -28
  40. data/lib/volt/models/persistors/store_factory.rb +12 -10
  41. data/lib/volt/models/persistors/store_state.rb +33 -31
  42. data/lib/volt/models/url.rb +96 -104
  43. data/lib/volt/models/validations.rb +56 -54
  44. data/lib/volt/models/validators/length_validator.rb +24 -22
  45. data/lib/volt/models/validators/presence_validator.rb +14 -12
  46. data/lib/volt/page/bindings/attribute_binding.rb +106 -106
  47. data/lib/volt/page/bindings/base_binding.rb +23 -21
  48. data/lib/volt/page/bindings/component_binding.rb +3 -1
  49. data/lib/volt/page/bindings/content_binding.rb +34 -34
  50. data/lib/volt/page/bindings/each_binding.rb +113 -113
  51. data/lib/volt/page/bindings/event_binding.rb +38 -34
  52. data/lib/volt/page/bindings/if_binding.rb +56 -54
  53. data/lib/volt/page/bindings/template_binding/grouped_controllers.rb +24 -22
  54. data/lib/volt/page/bindings/template_binding.rb +182 -185
  55. data/lib/volt/page/channel.rb +79 -77
  56. data/lib/volt/page/channel_stub.rb +29 -27
  57. data/lib/volt/page/document.rb +6 -5
  58. data/lib/volt/page/document_events.rb +54 -52
  59. data/lib/volt/page/page.rb +139 -138
  60. data/lib/volt/page/string_template_renderer.rb +36 -36
  61. data/lib/volt/page/sub_context.rb +26 -25
  62. data/lib/volt/page/targets/attribute_section.rb +27 -25
  63. data/lib/volt/page/targets/attribute_target.rb +7 -6
  64. data/lib/volt/page/targets/base_section.rb +27 -26
  65. data/lib/volt/page/targets/binding_document/base_node.rb +3 -1
  66. data/lib/volt/page/targets/binding_document/component_node.rb +85 -82
  67. data/lib/volt/page/targets/binding_document/html_node.rb +11 -9
  68. data/lib/volt/page/targets/dom_section.rb +78 -77
  69. data/lib/volt/page/targets/dom_target.rb +8 -6
  70. data/lib/volt/page/targets/dom_template.rb +90 -88
  71. data/lib/volt/page/targets/helpers/comment_searchers.rb +51 -49
  72. data/lib/volt/page/tasks.rb +59 -57
  73. data/lib/volt/page/template_renderer.rb +17 -14
  74. data/lib/volt/page/url_tracker.rb +26 -24
  75. data/lib/volt/reactive/computation.rb +87 -88
  76. data/lib/volt/reactive/dependency.rb +30 -28
  77. data/lib/volt/reactive/eventable.rb +64 -62
  78. data/lib/volt/reactive/hash_dependency.rb +25 -23
  79. data/lib/volt/reactive/reactive_accessors.rb +34 -32
  80. data/lib/volt/reactive/reactive_array.rb +162 -162
  81. data/lib/volt/reactive/reactive_hash.rb +37 -35
  82. data/lib/volt/router/routes.rb +99 -101
  83. data/lib/volt/server/component_handler.rb +20 -21
  84. data/lib/volt/server/component_templates.rb +72 -70
  85. data/lib/volt/server/html_parser/attribute_scope.rb +109 -99
  86. data/lib/volt/server/html_parser/each_scope.rb +17 -16
  87. data/lib/volt/server/html_parser/if_view_scope.rb +51 -49
  88. data/lib/volt/server/html_parser/sandlebars_parser.rb +184 -177
  89. data/lib/volt/server/html_parser/textarea_scope.rb +24 -22
  90. data/lib/volt/server/html_parser/view_handler.rb +66 -65
  91. data/lib/volt/server/html_parser/view_parser.rb +23 -21
  92. data/lib/volt/server/html_parser/view_scope.rb +142 -141
  93. data/lib/volt/server/rack/asset_files.rb +81 -79
  94. data/lib/volt/server/rack/component_code.rb +17 -15
  95. data/lib/volt/server/rack/component_html_renderer.rb +14 -12
  96. data/lib/volt/server/rack/component_paths.rb +72 -71
  97. data/lib/volt/server/rack/index_files.rb +36 -39
  98. data/lib/volt/server/rack/opal_files.rb +43 -41
  99. data/lib/volt/server/rack/source_map_server.rb +23 -21
  100. data/lib/volt/server/socket_connection_handler.rb +46 -45
  101. data/lib/volt/server/socket_connection_handler_stub.rb +21 -19
  102. data/lib/volt/server.rb +60 -58
  103. data/lib/volt/spec/setup.rb +3 -3
  104. data/lib/volt/tasks/dispatcher.rb +24 -23
  105. data/lib/volt/tasks/task_handler.rb +35 -33
  106. data/lib/volt/utils/ejson.rb +8 -6
  107. data/lib/volt/utils/generic_counting_pool.rb +33 -31
  108. data/lib/volt/utils/generic_pool.rb +73 -70
  109. data/lib/volt/utils/local_storage.rb +42 -38
  110. data/lib/volt/volt/environment.rb +1 -1
  111. data/lib/volt.rb +44 -42
  112. data/spec/apps/kitchen_sink/app/main/assets/css/todos.css +28 -0
  113. data/spec/apps/kitchen_sink/app/main/config/routes.rb +1 -0
  114. data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +2 -2
  115. data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +17 -0
  116. data/spec/apps/kitchen_sink/app/main/views/main/main.html +1 -0
  117. data/spec/apps/kitchen_sink/app/main/views/todos/index.html +24 -0
  118. data/spec/apps/kitchen_sink/config.ru +1 -1
  119. data/spec/controllers/reactive_accessors_spec.rb +5 -5
  120. data/spec/extra_core/inflector_spec.rb +2 -2
  121. data/spec/integration/list_spec.rb +68 -0
  122. data/spec/models/model_spec.rb +57 -57
  123. data/spec/models/persistors/params_spec.rb +6 -6
  124. data/spec/models/persistors/store_spec.rb +7 -7
  125. data/spec/models/validations_spec.rb +3 -3
  126. data/spec/page/bindings/content_binding_spec.rb +7 -7
  127. data/spec/page/bindings/template_binding_spec.rb +4 -5
  128. data/spec/page/sub_context_spec.rb +2 -2
  129. data/spec/reactive/computation_spec.rb +10 -10
  130. data/spec/reactive/dependency_spec.rb +2 -2
  131. data/spec/reactive/eventable_spec.rb +4 -4
  132. data/spec/reactive/reactive_array_spec.rb +13 -13
  133. data/spec/router/routes_spec.rb +5 -5
  134. data/spec/server/html_parser/sandlebars_parser_spec.rb +9 -9
  135. data/spec/server/html_parser/view_parser_spec.rb +27 -27
  136. data/spec/server/rack/asset_files_spec.rb +5 -5
  137. data/spec/server/rack/component_paths_spec.rb +2 -2
  138. data/spec/tasks/live_query_spec.rb +2 -2
  139. data/spec/tasks/query_tasks.rb +1 -1
  140. data/spec/tasks/query_tracker_spec.rb +1 -1
  141. data/spec/templates/targets/binding_document/component_node_spec.rb +2 -2
  142. data/spec/utils/generic_counting_pool_spec.rb +2 -2
  143. data/spec/utils/generic_pool_spec.rb +2 -2
  144. data/templates/component/controllers/main_controller.rb +1 -1
  145. data/templates/model/model.rb.tt +2 -2
  146. data/templates/newgem/app/newgem/controllers/main_controller.rb.tt +2 -2
  147. data/templates/project/app/main/controllers/main_controller.rb +1 -1
  148. data/templates/project/config.ru +1 -1
  149. metadata +10 -3
  150. data/app/volt/assets/js/vertxbus.js +0 -216
@@ -3,12 +3,13 @@ require 'volt/page/targets/attribute_section'
3
3
  require 'volt/page/targets/binding_document/component_node'
4
4
  require 'volt/page/targets/binding_document/html_node'
5
5
 
6
- # AttributeTarget's provide an interface that can render bindings into
7
- # a string that can then be used to update a attribute binding.
6
+ module Volt
7
+ # AttributeTarget's provide an interface that can render bindings into
8
+ # a string that can then be used to update a attribute binding.
9
+ class AttributeTarget < ComponentNode
8
10
 
9
- class AttributeTarget < ComponentNode
10
-
11
- def dom_section(*args)
12
- return AttributeSection.new(self, *args)
11
+ def dom_section(*args)
12
+ return AttributeSection.new(self, *args)
13
+ end
13
14
  end
14
15
  end
@@ -1,39 +1,40 @@
1
1
  require 'volt/page/targets/dom_template'
2
2
 
3
+ module Volt
3
4
  # Class to describe the interface for sections
4
- class BaseSection
5
- @@template_cache = {}
5
+ class BaseSection
6
+ @@template_cache = {}
6
7
 
7
- def remove
8
- raise "not implemented"
9
- end
10
-
11
- def remove_anchors
12
- raise "not implemented"
13
- end
8
+ def remove
9
+ raise "not implemented"
10
+ end
14
11
 
15
- def insert_anchor_before_end
16
- raise "not implemented"
17
- end
12
+ def remove_anchors
13
+ raise "not implemented"
14
+ end
18
15
 
19
- def set_content_to_template(page, template_name)
20
- if self.is_a?(DomSection)
21
- dom_template = (@@template_cache[template_name] ||= DomTemplate.new(page, template_name))
16
+ def insert_anchor_before_end
17
+ raise "not implemented"
18
+ end
22
19
 
23
- return set_template(dom_template)
24
- else
25
- template = page.templates[template_name]
20
+ def set_content_to_template(page, template_name)
21
+ if self.is_a?(DomSection)
22
+ dom_template = (@@template_cache[template_name] ||= DomTemplate.new(page, template_name))
26
23
 
27
- if template
28
- html = template['html']
29
- bindings = template['bindings']
24
+ return set_template(dom_template)
30
25
  else
31
- html = "<div>-- &lt; missing template #{template_name.inspect.gsub('<', '&lt;').gsub('>', '&gt;')} &gt; --</div>"
32
- bindings = {}
33
- end
26
+ template = page.templates[template_name]
27
+
28
+ if template
29
+ html = template['html']
30
+ bindings = template['bindings']
31
+ else
32
+ html = "<div>-- &lt; missing template #{template_name.inspect.gsub('<', '&lt;').gsub('>', '&gt;')} &gt; --</div>"
33
+ bindings = {}
34
+ end
34
35
 
35
- return set_content_and_rezero_bindings(html, bindings)
36
+ return set_content_and_rezero_bindings(html, bindings)
37
+ end
36
38
  end
37
39
  end
38
-
39
40
  end
@@ -1,3 +1,5 @@
1
- class BaseNode
1
+ module Volt
2
+ class BaseNode
2
3
 
4
+ end
3
5
  end
@@ -1,113 +1,116 @@
1
1
  require 'volt/page/targets/binding_document/html_node'
2
2
  require 'volt/reactive/eventable'
3
3
 
4
- # Component nodes contain an array of both HtmlNodes and ComponentNodes.
5
- # Instead of providing a full DOM API, component nodes are the branch
6
- # nodes and html nodes are the leafs. This is all we need to produce
7
- # the html from templates outside of a normal dom.
8
- class ComponentNode < BaseNode
9
- include Eventable
10
-
11
- attr_accessor :parent, :binding_id, :nodes
12
- def initialize(binding_id=nil, parent=nil, root=nil)
13
- @nodes = []
14
- @binding_id = binding_id
15
- @parent = parent
16
- @root = root
17
- end
18
-
19
- def changed!
20
- if @root
21
- @root.changed!
22
- else
23
- trigger!('changed')
4
+ module Volt
5
+ # Component nodes contain an array of both HtmlNodes and ComponentNodes.
6
+ # Instead of providing a full DOM API, component nodes are the branch
7
+ # nodes and html nodes are the leafs. This is all we need to produce
8
+ # the html from templates outside of a normal dom.
9
+ class ComponentNode < BaseNode
10
+ include Eventable
11
+
12
+ attr_accessor :parent, :binding_id, :nodes
13
+
14
+ def initialize(binding_id=nil, parent=nil, root=nil)
15
+ @nodes = []
16
+ @binding_id = binding_id
17
+ @parent = parent
18
+ @root = root
24
19
  end
25
20
 
26
- end
21
+ def changed!
22
+ if @root
23
+ @root.changed!
24
+ else
25
+ trigger!('changed')
26
+ end
27
27
 
28
- def text=(text)
29
- self.html = text
30
- end
28
+ end
31
29
 
32
- def html=(html)
33
- parts = html.split(/(\<\!\-\- \$\/?[0-9]+ \-\-\>)/).reject {|v| v == '' }
30
+ def text=(text)
31
+ self.html = text
32
+ end
34
33
 
35
- # Clear current nodes
36
- @nodes = []
34
+ def html=(html)
35
+ parts = html.split(/(\<\!\-\- \$\/?[0-9]+ \-\-\>)/).reject { |v| v == '' }
37
36
 
38
- current_node = self
37
+ # Clear current nodes
38
+ @nodes = []
39
39
 
40
- parts.each do |part|
41
- case part
42
- when /\<\!\-\- \$[0-9]+ \-\-\>/
43
- # Open
44
- binding_id = part.match(/\<\!\-\- \$([0-9]+) \-\-\>/)[1].to_i
40
+ current_node = self
45
41
 
46
- sub_node = ComponentNode.new(binding_id, current_node, @root || self)
47
- current_node << sub_node
48
- current_node = sub_node
49
- when /\<\!\-\- \$\/[0-9]+ \-\-\>/
50
- # Close
51
- # binding_id = part.match(/\<\!\-\- \$\/([0-9]+) \-\-\>/)[1].to_i
42
+ parts.each do |part|
43
+ case part
44
+ when /\<\!\-\- \$[0-9]+ \-\-\>/
45
+ # Open
46
+ binding_id = part.match(/\<\!\-\- \$([0-9]+) \-\-\>/)[1].to_i
52
47
 
53
- current_node = current_node.parent
54
- else
55
- # html string
56
- current_node << HtmlNode.new(part)
57
- end
58
- end
48
+ sub_node = ComponentNode.new(binding_id, current_node, @root || self)
49
+ current_node << sub_node
50
+ current_node = sub_node
51
+ when /\<\!\-\- \$\/[0-9]+ \-\-\>/
52
+ # Close
53
+ # binding_id = part.match(/\<\!\-\- \$\/([0-9]+) \-\-\>/)[1].to_i
59
54
 
60
- changed!
61
- end
55
+ current_node = current_node.parent
56
+ else
57
+ # html string
58
+ current_node << HtmlNode.new(part)
59
+ end
60
+ end
62
61
 
63
- def <<(node)
64
- @nodes << node
65
- end
62
+ changed!
63
+ end
66
64
 
67
- def to_html
68
- str = []
69
- @nodes.each do |node|
70
- str << node.to_html
65
+ def <<(node)
66
+ @nodes << node
71
67
  end
72
68
 
73
- return str.join('')
74
- end
69
+ def to_html
70
+ str = []
71
+ @nodes.each do |node|
72
+ str << node.to_html
73
+ end
75
74
 
76
- def find_by_binding_id(binding_id)
77
- if @binding_id == binding_id
78
- return self
75
+ return str.join('')
79
76
  end
80
77
 
81
- @nodes.each do |node|
82
- if node.is_a?(ComponentNode)
83
- val = node.find_by_binding_id(binding_id)
84
- return val if val
78
+ def find_by_binding_id(binding_id)
79
+ if @binding_id == binding_id
80
+ return self
85
81
  end
86
- end
87
82
 
88
- return nil
89
- end
83
+ @nodes.each do |node|
84
+ if node.is_a?(ComponentNode)
85
+ val = node.find_by_binding_id(binding_id)
86
+ return val if val
87
+ end
88
+ end
90
89
 
91
- def remove
92
- @nodes = []
90
+ return nil
91
+ end
93
92
 
94
- # puts "Component Node Removed"
95
- changed!
93
+ def remove
94
+ @nodes = []
96
95
 
97
- # @binding_id = nil
98
- end
96
+ # puts "Component Node Removed"
97
+ changed!
99
98
 
100
- def remove_anchors
101
- raise "not implemented"
99
+ # @binding_id = nil
100
+ end
102
101
 
103
- @parent.nodes.delete(self)
102
+ def remove_anchors
103
+ raise "not implemented"
104
104
 
105
- changed!
106
- @parent = nil
107
- @binding_id = nil
108
- end
105
+ @parent.nodes.delete(self)
109
106
 
110
- def inspect
111
- "<ComponentNode:#{@binding_id} #{@nodes.inspect}>"
107
+ changed!
108
+ @parent = nil
109
+ @binding_id = nil
110
+ end
111
+
112
+ def inspect
113
+ "<ComponentNode:#{@binding_id} #{@nodes.inspect}>"
114
+ end
112
115
  end
113
116
  end
@@ -1,15 +1,17 @@
1
1
  require 'volt/page/targets/binding_document/base_node'
2
2
 
3
- class HtmlNode < BaseNode
4
- def initialize(html)
5
- @html = html
6
- end
3
+ module Volt
4
+ class HtmlNode < BaseNode
5
+ def initialize(html)
6
+ @html = html
7
+ end
7
8
 
8
- def to_html
9
- @html
10
- end
9
+ def to_html
10
+ @html
11
+ end
11
12
 
12
- def inspect
13
- "<HtmlNode #{@html.inspect}>"
13
+ def inspect
14
+ "<HtmlNode #{@html.inspect}>"
15
+ end
14
16
  end
15
17
  end
@@ -1,112 +1,113 @@
1
1
  require 'volt/page/targets/base_section'
2
2
  require 'volt/page/targets/helpers/comment_searchers'
3
3
 
4
- class DomSection < BaseSection
5
- include CommentSearchers
4
+ module Volt
5
+ class DomSection < BaseSection
6
+ include CommentSearchers
6
7
 
7
- def initialize(binding_name)
8
- @start_node = find_by_comment("$#{binding_name}")
9
- @end_node = find_by_comment("$/#{binding_name}")
10
- end
8
+ def initialize(binding_name)
9
+ @start_node = find_by_comment("$#{binding_name}")
10
+ @end_node = find_by_comment("$/#{binding_name}")
11
+ end
11
12
 
12
13
 
13
- def text=(value)
14
- %x{
15
- this.$range().deleteContents();
16
- this.$range().insertNode(document.createTextNode(#{value}));
17
- }
18
- end
14
+ def text=(value)
15
+ %x{
16
+ this.$range().deleteContents();
17
+ this.$range().insertNode(document.createTextNode(#{value}));
18
+ }
19
+ end
19
20
 
20
- def html=(value)
21
- new_nodes = build_from_html(value)
21
+ def html=(value)
22
+ new_nodes = build_from_html(value)
22
23
 
23
- self.nodes = `new_nodes.childNodes`
24
- end
24
+ self.nodes = `new_nodes.childNodes`
25
+ end
25
26
 
26
- def remove
27
- range = self.range()
27
+ def remove
28
+ range = self.range()
28
29
 
29
- %x{
30
- range.deleteContents();
31
- }
32
- end
30
+ %x{
31
+ range.deleteContents();
32
+ }
33
+ end
33
34
 
34
- def remove_anchors
35
- %x{
36
- this.start_node.parentNode.removeChild(this.start_node);
37
- this.end_node.parentNode.removeChild(this.end_node);
38
- }
39
- @start_node = nil
40
- @end_node = nil
41
- end
35
+ def remove_anchors
36
+ %x{
37
+ this.start_node.parentNode.removeChild(this.start_node);
38
+ this.end_node.parentNode.removeChild(this.end_node);
39
+ }
40
+ @start_node = nil
41
+ @end_node = nil
42
+ end
42
43
 
43
- def insert_anchor_before_end(binding_name)
44
- Element.find(@end_node).before("<!-- $#{binding_name} --><!-- $/#{binding_name} -->")
45
- end
44
+ def insert_anchor_before_end(binding_name)
45
+ Element.find(@end_node).before("<!-- $#{binding_name} --><!-- $/#{binding_name} -->")
46
+ end
46
47
 
47
- def insert_anchor_before(binding_name, insert_after_binding)
48
- node = find_by_comment("$#{insert_after_binding}")
49
- Element.find(node).before("<!-- $#{binding_name} --><!-- $/#{binding_name} -->")
50
- end
48
+ def insert_anchor_before(binding_name, insert_after_binding)
49
+ node = find_by_comment("$#{insert_after_binding}")
50
+ Element.find(node).before("<!-- $#{binding_name} --><!-- $/#{binding_name} -->")
51
+ end
51
52
 
52
- # Takes in an array of dom nodes and replaces the current content
53
- # with the new nodes
54
- def nodes=(nodes)
55
- range = self.range()
53
+ # Takes in an array of dom nodes and replaces the current content
54
+ # with the new nodes
55
+ def nodes=(nodes)
56
+ range = self.range()
56
57
 
57
- %x{
58
- range.deleteContents();
58
+ %x{
59
+ range.deleteContents();
59
60
 
60
- for (var i=nodes.length-1; i >= 0; i--) {
61
- var node = nodes[i];
61
+ for (var i=nodes.length-1; i >= 0; i--) {
62
+ var node = nodes[i];
62
63
 
63
- node.parentNode.removeChild(node);
64
- range.insertNode(node);
64
+ node.parentNode.removeChild(node);
65
+ range.insertNode(node);
66
+ }
65
67
  }
66
- }
67
- end
68
+ end
68
69
 
69
- # Returns the nearest DOM node that contains all of the section.
70
- def container_node
71
- range = self.range()
72
- return `range.commonAncestorContainer`
73
- end
70
+ # Returns the nearest DOM node that contains all of the section.
71
+ def container_node
72
+ range = self.range()
73
+ return `range.commonAncestorContainer`
74
+ end
74
75
 
75
- def set_template(dom_template)
76
- dom_nodes, bindings = dom_template.make_new
76
+ def set_template(dom_template)
77
+ dom_nodes, bindings = dom_template.make_new
77
78
 
78
- children = nil
79
- %x{
79
+ children = nil
80
+ %x{
80
81
  children = dom_nodes.childNodes;
81
82
  }
82
83
 
83
- # Update the nodes
84
- self.nodes = children
84
+ # Update the nodes
85
+ self.nodes = children
85
86
 
86
- %x{
87
+ %x{
87
88
  dom_nodes = null;
88
89
  }
89
90
 
90
- return bindings
91
- end
91
+ return bindings
92
+ end
92
93
 
93
- def range
94
- return @range if @range
94
+ def range
95
+ return @range if @range
95
96
 
96
- range = nil
97
- %x{
98
- range = document.createRange();
99
- range.setStartAfter(this.start_node);
100
- range.setEndBefore(this.end_node);
101
- }
97
+ range = nil
98
+ %x{
99
+ range = document.createRange();
100
+ range.setStartAfter(this.start_node);
101
+ range.setEndBefore(this.end_node);
102
+ }
102
103
 
103
- @range = range
104
+ @range = range
104
105
 
105
- return range
106
- end
106
+ return range
107
+ end
107
108
 
108
- def inspect
109
- "<#{self.class.to_s}>"
109
+ def inspect
110
+ "<#{self.class.to_s}>"
111
+ end
110
112
  end
111
-
112
113
  end
@@ -1,11 +1,13 @@
1
1
  require 'volt/page/targets/base_section'
2
2
  require 'volt/page/targets/dom_section'
3
3
 
4
- # DomTarget's provide an interface that can render bindings into
5
- # the dom. Currently only one "dom" is supported, but multiple
6
- # may be allowed in the future (iframes?)
7
- class DomTarget < BaseSection
8
- def dom_section(*args)
9
- return DomSection.new(*args)
4
+ module Volt
5
+ # DomTarget's provide an interface that can render bindings into
6
+ # the dom. Currently only one "dom" is supported, but multiple
7
+ # may be allowed in the future (iframes?)
8
+ class DomTarget < BaseSection
9
+ def dom_section(*args)
10
+ return DomSection.new(*args)
11
+ end
10
12
  end
11
13
  end