volt 0.8.14 → 0.8.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Readme.md +8 -2
- data/VERSION +1 -1
- data/app/volt/controllers/notices_controller.rb +1 -1
- data/app/volt/models/user.rb +2 -2
- data/app/volt/tasks/live_query/live_query_pool.rb +1 -1
- data/app/volt/tasks/query_tasks.rb +1 -1
- data/app/volt/tasks/store_tasks.rb +1 -1
- data/app/volt/tasks/user_tasks.rb +2 -2
- data/lib/volt/boot.rb +2 -2
- data/lib/volt/cli/asset_compile.rb +31 -27
- data/lib/volt/cli.rb +64 -65
- data/lib/volt/config.rb +25 -23
- data/lib/volt/console.rb +17 -16
- data/lib/volt/controllers/model_controller.rb +82 -80
- data/lib/volt/data_stores/data_store.rb +2 -2
- data/lib/volt/data_stores/mongo_driver.rb +2 -2
- data/lib/volt/extra_core/inflections.rb +2 -2
- data/lib/volt/extra_core/inflector/inflections.rb +185 -183
- data/lib/volt/extra_core/inflector/methods.rb +50 -48
- data/lib/volt/extra_core/string.rb +2 -2
- data/lib/volt/models/array_model.rb +93 -92
- data/lib/volt/models/cursor.rb +3 -2
- data/lib/volt/models/model.rb +248 -251
- data/lib/volt/models/model_hash_behaviour.rb +44 -44
- data/lib/volt/models/model_helpers.rb +38 -36
- data/lib/volt/models/model_state.rb +16 -17
- data/lib/volt/models/model_wrapper.rb +25 -24
- data/lib/volt/models/persistors/array_store.rb +145 -143
- data/lib/volt/models/persistors/base.rb +18 -16
- data/lib/volt/models/persistors/flash.rb +24 -22
- data/lib/volt/models/persistors/local_store.rb +46 -44
- data/lib/volt/models/persistors/model_identity_map.rb +10 -8
- data/lib/volt/models/persistors/model_store.rb +76 -76
- data/lib/volt/models/persistors/params.rb +19 -17
- data/lib/volt/models/persistors/query/query_listener.rb +65 -63
- data/lib/volt/models/persistors/query/query_listener_pool.rb +12 -10
- data/lib/volt/models/persistors/store.rb +28 -28
- data/lib/volt/models/persistors/store_factory.rb +12 -10
- data/lib/volt/models/persistors/store_state.rb +33 -31
- data/lib/volt/models/url.rb +96 -104
- data/lib/volt/models/validations.rb +56 -54
- data/lib/volt/models/validators/length_validator.rb +24 -22
- data/lib/volt/models/validators/presence_validator.rb +14 -12
- data/lib/volt/page/bindings/attribute_binding.rb +106 -106
- data/lib/volt/page/bindings/base_binding.rb +23 -21
- data/lib/volt/page/bindings/component_binding.rb +3 -1
- data/lib/volt/page/bindings/content_binding.rb +34 -34
- data/lib/volt/page/bindings/each_binding.rb +113 -113
- data/lib/volt/page/bindings/event_binding.rb +38 -34
- data/lib/volt/page/bindings/if_binding.rb +56 -54
- data/lib/volt/page/bindings/template_binding/grouped_controllers.rb +24 -22
- data/lib/volt/page/bindings/template_binding.rb +182 -185
- data/lib/volt/page/channel.rb +79 -77
- data/lib/volt/page/channel_stub.rb +29 -27
- data/lib/volt/page/document.rb +6 -5
- data/lib/volt/page/document_events.rb +54 -52
- data/lib/volt/page/page.rb +139 -138
- data/lib/volt/page/string_template_renderer.rb +36 -36
- data/lib/volt/page/sub_context.rb +26 -25
- data/lib/volt/page/targets/attribute_section.rb +27 -25
- data/lib/volt/page/targets/attribute_target.rb +7 -6
- data/lib/volt/page/targets/base_section.rb +27 -26
- data/lib/volt/page/targets/binding_document/base_node.rb +3 -1
- data/lib/volt/page/targets/binding_document/component_node.rb +85 -82
- data/lib/volt/page/targets/binding_document/html_node.rb +11 -9
- data/lib/volt/page/targets/dom_section.rb +78 -77
- data/lib/volt/page/targets/dom_target.rb +8 -6
- data/lib/volt/page/targets/dom_template.rb +90 -88
- data/lib/volt/page/targets/helpers/comment_searchers.rb +51 -49
- data/lib/volt/page/tasks.rb +59 -57
- data/lib/volt/page/template_renderer.rb +17 -14
- data/lib/volt/page/url_tracker.rb +26 -24
- data/lib/volt/reactive/computation.rb +87 -88
- data/lib/volt/reactive/dependency.rb +30 -28
- data/lib/volt/reactive/eventable.rb +64 -62
- data/lib/volt/reactive/hash_dependency.rb +25 -23
- data/lib/volt/reactive/reactive_accessors.rb +34 -32
- data/lib/volt/reactive/reactive_array.rb +162 -162
- data/lib/volt/reactive/reactive_hash.rb +37 -35
- data/lib/volt/router/routes.rb +99 -101
- data/lib/volt/server/component_handler.rb +20 -21
- data/lib/volt/server/component_templates.rb +72 -70
- data/lib/volt/server/html_parser/attribute_scope.rb +109 -99
- data/lib/volt/server/html_parser/each_scope.rb +17 -16
- data/lib/volt/server/html_parser/if_view_scope.rb +51 -49
- data/lib/volt/server/html_parser/sandlebars_parser.rb +184 -177
- data/lib/volt/server/html_parser/textarea_scope.rb +24 -22
- data/lib/volt/server/html_parser/view_handler.rb +66 -65
- data/lib/volt/server/html_parser/view_parser.rb +23 -21
- data/lib/volt/server/html_parser/view_scope.rb +142 -141
- data/lib/volt/server/rack/asset_files.rb +81 -79
- data/lib/volt/server/rack/component_code.rb +17 -15
- data/lib/volt/server/rack/component_html_renderer.rb +14 -12
- data/lib/volt/server/rack/component_paths.rb +72 -71
- data/lib/volt/server/rack/index_files.rb +36 -39
- data/lib/volt/server/rack/opal_files.rb +43 -41
- data/lib/volt/server/rack/source_map_server.rb +23 -21
- data/lib/volt/server/socket_connection_handler.rb +46 -45
- data/lib/volt/server/socket_connection_handler_stub.rb +21 -19
- data/lib/volt/server.rb +60 -58
- data/lib/volt/spec/setup.rb +3 -3
- data/lib/volt/tasks/dispatcher.rb +24 -23
- data/lib/volt/tasks/task_handler.rb +35 -33
- data/lib/volt/utils/ejson.rb +8 -6
- data/lib/volt/utils/generic_counting_pool.rb +33 -31
- data/lib/volt/utils/generic_pool.rb +73 -70
- data/lib/volt/utils/local_storage.rb +42 -38
- data/lib/volt/volt/environment.rb +1 -1
- data/lib/volt.rb +44 -42
- data/spec/apps/kitchen_sink/app/main/assets/css/todos.css +28 -0
- data/spec/apps/kitchen_sink/app/main/config/routes.rb +1 -0
- data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +2 -2
- data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +17 -0
- data/spec/apps/kitchen_sink/app/main/views/main/main.html +1 -0
- data/spec/apps/kitchen_sink/app/main/views/todos/index.html +24 -0
- data/spec/apps/kitchen_sink/config.ru +1 -1
- data/spec/controllers/reactive_accessors_spec.rb +5 -5
- data/spec/extra_core/inflector_spec.rb +2 -2
- data/spec/integration/list_spec.rb +68 -0
- data/spec/models/model_spec.rb +57 -57
- data/spec/models/persistors/params_spec.rb +6 -6
- data/spec/models/persistors/store_spec.rb +7 -7
- data/spec/models/validations_spec.rb +3 -3
- data/spec/page/bindings/content_binding_spec.rb +7 -7
- data/spec/page/bindings/template_binding_spec.rb +4 -5
- data/spec/page/sub_context_spec.rb +2 -2
- data/spec/reactive/computation_spec.rb +10 -10
- data/spec/reactive/dependency_spec.rb +2 -2
- data/spec/reactive/eventable_spec.rb +4 -4
- data/spec/reactive/reactive_array_spec.rb +13 -13
- data/spec/router/routes_spec.rb +5 -5
- data/spec/server/html_parser/sandlebars_parser_spec.rb +9 -9
- data/spec/server/html_parser/view_parser_spec.rb +27 -27
- data/spec/server/rack/asset_files_spec.rb +5 -5
- data/spec/server/rack/component_paths_spec.rb +2 -2
- data/spec/tasks/live_query_spec.rb +2 -2
- data/spec/tasks/query_tasks.rb +1 -1
- data/spec/tasks/query_tracker_spec.rb +1 -1
- data/spec/templates/targets/binding_document/component_node_spec.rb +2 -2
- data/spec/utils/generic_counting_pool_spec.rb +2 -2
- data/spec/utils/generic_pool_spec.rb +2 -2
- data/templates/component/controllers/main_controller.rb +1 -1
- data/templates/model/model.rb.tt +2 -2
- data/templates/newgem/app/newgem/controllers/main_controller.rb.tt +2 -2
- data/templates/project/app/main/controllers/main_controller.rb +1 -1
- data/templates/project/config.ru +1 -1
- metadata +10 -3
- 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
|
-
|
7
|
-
#
|
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
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
5
|
+
class BaseSection
|
6
|
+
@@template_cache = {}
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def remove_anchors
|
12
|
-
raise "not implemented"
|
13
|
-
end
|
8
|
+
def remove
|
9
|
+
raise "not implemented"
|
10
|
+
end
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
def remove_anchors
|
13
|
+
raise "not implemented"
|
14
|
+
end
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
def insert_anchor_before_end
|
17
|
+
raise "not implemented"
|
18
|
+
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
28
|
-
html = template['html']
|
29
|
-
bindings = template['bindings']
|
24
|
+
return set_template(dom_template)
|
30
25
|
else
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
template = page.templates[template_name]
|
27
|
+
|
28
|
+
if template
|
29
|
+
html = template['html']
|
30
|
+
bindings = template['bindings']
|
31
|
+
else
|
32
|
+
html = "<div>-- < missing template #{template_name.inspect.gsub('<', '<').gsub('>', '>')} > --</div>"
|
33
|
+
bindings = {}
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
+
return set_content_and_rezero_bindings(html, bindings)
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|
38
|
-
|
39
40
|
end
|
@@ -1,113 +1,116 @@
|
|
1
1
|
require 'volt/page/targets/binding_document/html_node'
|
2
2
|
require 'volt/reactive/eventable'
|
3
3
|
|
4
|
-
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
21
|
+
def changed!
|
22
|
+
if @root
|
23
|
+
@root.changed!
|
24
|
+
else
|
25
|
+
trigger!('changed')
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
self.html = text
|
30
|
-
end
|
28
|
+
end
|
31
29
|
|
32
|
-
|
33
|
-
|
30
|
+
def text=(text)
|
31
|
+
self.html = text
|
32
|
+
end
|
34
33
|
|
35
|
-
|
36
|
-
|
34
|
+
def html=(html)
|
35
|
+
parts = html.split(/(\<\!\-\- \$\/?[0-9]+ \-\-\>)/).reject { |v| v == '' }
|
37
36
|
|
38
|
-
|
37
|
+
# Clear current nodes
|
38
|
+
@nodes = []
|
39
39
|
|
40
|
-
|
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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
|
61
|
-
|
55
|
+
current_node = current_node.parent
|
56
|
+
else
|
57
|
+
# html string
|
58
|
+
current_node << HtmlNode.new(part)
|
59
|
+
end
|
60
|
+
end
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
end
|
62
|
+
changed!
|
63
|
+
end
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
@nodes.each do |node|
|
70
|
-
str << node.to_html
|
65
|
+
def <<(node)
|
66
|
+
@nodes << node
|
71
67
|
end
|
72
68
|
|
73
|
-
|
74
|
-
|
69
|
+
def to_html
|
70
|
+
str = []
|
71
|
+
@nodes.each do |node|
|
72
|
+
str << node.to_html
|
73
|
+
end
|
75
74
|
|
76
|
-
|
77
|
-
if @binding_id == binding_id
|
78
|
-
return self
|
75
|
+
return str.join('')
|
79
76
|
end
|
80
77
|
|
81
|
-
|
82
|
-
if
|
83
|
-
|
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
|
-
|
89
|
-
|
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
|
-
|
92
|
-
|
90
|
+
return nil
|
91
|
+
end
|
93
92
|
|
94
|
-
|
95
|
-
|
93
|
+
def remove
|
94
|
+
@nodes = []
|
96
95
|
|
97
|
-
|
98
|
-
|
96
|
+
# puts "Component Node Removed"
|
97
|
+
changed!
|
99
98
|
|
100
|
-
|
101
|
-
|
99
|
+
# @binding_id = nil
|
100
|
+
end
|
102
101
|
|
103
|
-
|
102
|
+
def remove_anchors
|
103
|
+
raise "not implemented"
|
104
104
|
|
105
|
-
|
106
|
-
@parent = nil
|
107
|
-
@binding_id = nil
|
108
|
-
end
|
105
|
+
@parent.nodes.delete(self)
|
109
106
|
|
110
|
-
|
111
|
-
|
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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module Volt
|
4
|
+
class HtmlNode < BaseNode
|
5
|
+
def initialize(html)
|
6
|
+
@html = html
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def to_html
|
10
|
+
@html
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
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
|
-
|
5
|
-
|
4
|
+
module Volt
|
5
|
+
class DomSection < BaseSection
|
6
|
+
include CommentSearchers
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
def text=(value)
|
15
|
+
%x{
|
16
|
+
this.$range().deleteContents();
|
17
|
+
this.$range().insertNode(document.createTextNode(#{value}));
|
18
|
+
}
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
def html=(value)
|
22
|
+
new_nodes = build_from_html(value)
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
self.nodes = `new_nodes.childNodes`
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
27
|
+
def remove
|
28
|
+
range = self.range()
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
%x{
|
31
|
+
range.deleteContents();
|
32
|
+
}
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
44
|
+
def insert_anchor_before_end(binding_name)
|
45
|
+
Element.find(@end_node).before("<!-- $#{binding_name} --><!-- $/#{binding_name} -->")
|
46
|
+
end
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
58
|
-
|
58
|
+
%x{
|
59
|
+
range.deleteContents();
|
59
60
|
|
60
|
-
|
61
|
-
|
61
|
+
for (var i=nodes.length-1; i >= 0; i--) {
|
62
|
+
var node = nodes[i];
|
62
63
|
|
63
|
-
|
64
|
-
|
64
|
+
node.parentNode.removeChild(node);
|
65
|
+
range.insertNode(node);
|
66
|
+
}
|
65
67
|
}
|
66
|
-
|
67
|
-
end
|
68
|
+
end
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
76
|
-
|
76
|
+
def set_template(dom_template)
|
77
|
+
dom_nodes, bindings = dom_template.make_new
|
77
78
|
|
78
|
-
|
79
|
-
|
79
|
+
children = nil
|
80
|
+
%x{
|
80
81
|
children = dom_nodes.childNodes;
|
81
82
|
}
|
82
83
|
|
83
|
-
|
84
|
-
|
84
|
+
# Update the nodes
|
85
|
+
self.nodes = children
|
85
86
|
|
86
|
-
|
87
|
+
%x{
|
87
88
|
dom_nodes = null;
|
88
89
|
}
|
89
90
|
|
90
|
-
|
91
|
-
|
91
|
+
return bindings
|
92
|
+
end
|
92
93
|
|
93
|
-
|
94
|
-
|
94
|
+
def range
|
95
|
+
return @range if @range
|
95
96
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
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
|
-
|
104
|
+
@range = range
|
104
105
|
|
105
|
-
|
106
|
-
|
106
|
+
return range
|
107
|
+
end
|
107
108
|
|
108
|
-
|
109
|
-
|
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
|
-
|
5
|
-
#
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|