twine-rails 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/twine.js.coffee +7 -3
- data/lib/twine-rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cfa6fddf2f3973717106b4ea3f1fa7a23acf812
|
4
|
+
data.tar.gz: 0c51f0e8e010e1805a59899cb4c3d8db9ab116d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef7f8733040a84c26018034d9ac71cbb59867cf7563033f86d9eacec75bd1e754cdcdc49612808faa3a8eaae6d8693d126a3fb970bbd12760a3c5d714bd9a041
|
7
|
+
data.tar.gz: 0622961af0ac057700b44e5a499f5697146a2baef5092551e74ac0896fb4a9581d7b615e44bd9e5131b2e2bac6dffac717ec919ef568cde55797138093dda477
|
@@ -17,6 +17,9 @@ rootNode = null
|
|
17
17
|
|
18
18
|
currentBindingCallbacks = null
|
19
19
|
|
20
|
+
Twine.getAttribute = (node, attr) ->
|
21
|
+
node.getAttribute("data-#{attr}") || node.getAttribute(attr)
|
22
|
+
|
20
23
|
# Cleans up all existing bindings and sets the root node and context.
|
21
24
|
Twine.reset = (newContext, node = document.documentElement) ->
|
22
25
|
for key of elements
|
@@ -45,12 +48,12 @@ bind = (context, node, forceSaveContext) ->
|
|
45
48
|
if node.bindingId
|
46
49
|
Twine.unbind(node)
|
47
50
|
|
48
|
-
for type, binding of Twine.bindingTypes when definition =
|
51
|
+
for type, binding of Twine.bindingTypes when definition = Twine.getAttribute(node, type)
|
49
52
|
element = {bindings: []} unless element # Defer allocation to prevent GC pressure
|
50
53
|
fn = binding(node, context, definition, element)
|
51
54
|
element.bindings.push(fn) if fn
|
52
55
|
|
53
|
-
if newContextKey =
|
56
|
+
if newContextKey = Twine.getAttribute(node, 'context')
|
54
57
|
keypath = keypathForKey(newContextKey)
|
55
58
|
if keypath[0] == '$root'
|
56
59
|
context = rootContext
|
@@ -311,7 +314,8 @@ for attribute in ['placeholder', 'checked', 'disabled', 'href', 'title', 'readOn
|
|
311
314
|
setupAttributeBinding('innerHTML', 'unsafe-html')
|
312
315
|
|
313
316
|
preventDefaultForEvent = (event) ->
|
314
|
-
(event.type == 'submit' || event.currentTarget.nodeName.toLowerCase() == 'a') &&
|
317
|
+
(event.type == 'submit' || event.currentTarget.nodeName.toLowerCase() == 'a') &&
|
318
|
+
Twine.getAttribute(event.currentTarget, 'allow-default') != '1'
|
315
319
|
|
316
320
|
setupEventBinding = (eventName) ->
|
317
321
|
Twine.bindingTypes["bind-event-#{eventName}"] = (node, context, definition) ->
|
data/lib/twine-rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twine-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Li
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coffee-rails
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
88
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.
|
89
|
+
rubygems_version: 2.4.5.1
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: Minimalistic two-way bindings
|