without-rails 1.2.2 → 1.2.3

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: 53e7aa0b5f38d84a04b935895212945890261c7b
4
- data.tar.gz: 611a769e68d1463ff373e337ee6b2106226393b1
3
+ metadata.gz: eedc29e4493595d396fa2f10ac5b5bd0694a7557
4
+ data.tar.gz: d0a90859b906f6f445234ba1ab66c31674df7e91
5
5
  SHA512:
6
- metadata.gz: 901b22fc905abc63b0b5e4f1e8364abf08bd9ac2b489352d47b1b83e30724ce9ab44d15de2bc94f43d4c16d07877ec32bd9b310164356134ced99225be602d5c
7
- data.tar.gz: ff63c6c55f078eee6be88a06ff14e2ffd7cca260d8824b29736fab939cad5f94f90cf96fa600f93fb4da964025c5f87297424424c1e4fbb7d1510618e3315104
6
+ metadata.gz: e02070d60f3cbfaf8d250b4f66b555e60265b0abedf5c05246c32ee5ac52a975daeb076225009bde1948462b8353d825536beb583c3c61ababd750977c1a4382
7
+ data.tar.gz: 22f9d91c706a2a7dd0e26afc61b933fe7bd48bd32b61a728c6107a15e20411dd72d8fbb987a309369957efd196057823ebe155822d768bbbf86e11e071f96143
@@ -1,5 +1,5 @@
1
1
  module Without
2
2
  module Rails
3
- VERSION = "1.2.2"
3
+ VERSION = "1.2.3"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  //
2
- // without.js v1.2.2: Yet another CoffeScript template (without `with`, coffescript and templates)
2
+ // without.js v1.2.3: Yet another CoffeScript template (without `with`, coffescript and templates)
3
3
  // https://github.com/ukoloff/without
4
4
  //
5
5
  !function(){
@@ -18,16 +18,39 @@ function adhocTag()
18
18
  return makeTag(name, empty)
19
19
  }
20
20
  }
21
+ function attributes(prefix, obj)
22
+ {
23
+ var v, me = ''
24
+ for(var k in obj)
25
+ if('object' == typeof(v = obj[k]))
26
+ me += attributes(prefix + k + '-', v)
27
+ else if(null != v && false !== v)
28
+ {
29
+ me += prefix + h(k)
30
+ if(true !== v)
31
+ me += '="' + h(v) + '"'
32
+ }
33
+ return me
34
+ }
21
35
  function children(a)
22
36
  {
23
- var e, len = a.length
24
- for(var i = 0; i < len; i++)
37
+ var e, len = a.length, prev
38
+ prev = html
39
+ html = ''
40
+ try
25
41
  {
26
- if(null == (e = a[i])) continue;
27
- if('function' == typeof e)
28
- e.call(_this)
29
- else
30
- html += h(e)
42
+ for(var i = 0; i < len; i++)
43
+ {
44
+ if(null == (e = a[i])) continue;
45
+ if('function' == typeof e)
46
+ e.call(_this)
47
+ else
48
+ html += h(e)
49
+ }
50
+ }
51
+ finally
52
+ {
53
+ html = prev + html
31
54
  }
32
55
  }
33
56
  function coffeeScript(a)
@@ -63,7 +86,7 @@ function compile()
63
86
  function template() { return withOut.apply(this, arguments) }
64
87
  }
65
88
  }
66
- if('undefined' != typeof module && module.exports)
89
+ if('object' == typeof module && module.exports)
67
90
  module.exports = withOut
68
91
  else if('function' == typeof define && define.amd)
69
92
  define(function() { return withOut })
@@ -155,35 +178,17 @@ function makeTag(name, empty)
155
178
  {
156
179
  return Tag
157
180
  function Tag() { tag(arguments) }
158
- function attr(k, v)
159
- {
160
- if(null == v || false === v) return
161
- html += ' ' + h(k)
162
- if(true !== v)
163
- html += '="' + h(v) + '"'
164
- }
165
- function nest(prefix, obj)
166
- {
167
- for(var k in obj)
168
- if('object' == typeof obj[k])
169
- nest(prefix + k + '-', obj[k])
170
- else
171
- attr(prefix + k, obj[k])
172
- }
173
181
  function tag(a)
174
182
  {
175
- html += '<' + name
176
183
  var at = a[0]
177
184
  if('object' == typeof at)
178
185
  {
179
- for(var k in at)
180
- if('data' == k && 'object' == typeof at[k])
181
- nest('data-', at[k])
182
- else
183
- attr(k, at[k])
184
- a = shift(a)
186
+ at = attributes(' ', at)
187
+ a = cdr(a)
185
188
  }
186
- html += '>'
189
+ else
190
+ at = ''
191
+ html += '<' + name + at + '>'
187
192
  if(empty && a.length)
188
193
  throw SyntaxError("<" + name + "> must have no content!")
189
194
  if(empty)
@@ -223,14 +228,15 @@ function nop()
223
228
  }
224
229
  function noTag(a)
225
230
  {
226
- children('object' == typeof a[0] ? shift(a) : a)
231
+ children('object' == typeof a[0] ? cdr(a) : a)
227
232
  }
228
233
  function print(a)
229
234
  {
230
- var e, len = a.length
235
+ var e, len = a.length, me = ''
231
236
  for(var i = 0; i < len; i++)
232
237
  if(null != (e = a[i]))
233
- html += h(e)
238
+ me += h(e)
239
+ html += me
234
240
  }
235
241
  function raw(a)
236
242
  {
@@ -340,7 +346,7 @@ function makeScope()
340
346
  }
341
347
  }
342
348
  var slice = [].slice
343
- function shift(a)
349
+ function cdr(a)
344
350
  {
345
351
  return slice.call(a, 1)
346
352
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: without-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stas Ukolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-16 00:00:00.000000000 Z
11
+ date: 2017-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties