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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ddc2b0e558e86d41b9a5826a676b7f787e8716a
4
- data.tar.gz: 86d5ab892a32b9302323cc2932f0f61c11999e98
3
+ metadata.gz: 3cfa6fddf2f3973717106b4ea3f1fa7a23acf812
4
+ data.tar.gz: 0c51f0e8e010e1805a59899cb4c3d8db9ab116d9
5
5
  SHA512:
6
- metadata.gz: 4b5fd19805c7616bdab5c0e97f09348e5e10a0ea525193cf5fcceea89398bc66596d0cff836d6c20a4afe3191cc1b70e821080d89f6ef72bb0530deef076eea4
7
- data.tar.gz: 37e98561a3c75913471c3434d64ebfaf619156f582640e3ee28f609c0be12e20ca514b06b74f7519647548cf3a1b1542c2cfb3827bd7091c3b9444d13299beb8
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 = (node.getAttribute(type) || node.getAttribute("data-#{type}"))
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 = node.getAttribute('context')
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') && event.currentTarget.getAttribute('allow-default') != '1'
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) ->
@@ -1,3 +1,3 @@
1
1
  module TwineRails
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
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.3
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-11-18 00:00:00.000000000 Z
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.2.2
89
+ rubygems_version: 2.4.5.1
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Minimalistic two-way bindings