vuejs-rails 0.10.4 → 0.10.6

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: 0c8cb6ed9f857d7eccdf3659c6c70d48cddc61a2
4
- data.tar.gz: dfcd6db0450d372dbb3de553210f7728113a78e5
3
+ metadata.gz: 9d150645ff9f4d971660edc3638ed0bada16b0f1
4
+ data.tar.gz: 182b33432c638630d73517bcdc0dde2aeaf90347
5
5
  SHA512:
6
- metadata.gz: bdf53d882901013543396ff0403bd0278d0bd5b06984ff365ddba78bea80d90e1b70eb78571fc54dc12331560d0c13159b24f7daa5daf0c2a637120818a0dd0e
7
- data.tar.gz: a436615ce3c78a45cf70dfefb25dcbc51b490c5f4ec79e3bc054479354bf83cbf0ef418a599d57b1951b34432029bb335017ef1d4e31c99fd7ec3777aee8c2c6
6
+ metadata.gz: 67481d7174e622371e14f21165c5ef5b903a3365c56ef4359b14e418d9906753e5e9685df67cd3e41be1bb4fdaaf90ad3f49c2f03e05852d1eec20a616a0e6b4
7
+ data.tar.gz: 225372c50b287585b4c5f4498266dec4ce5391dc75e91e667ca2aef050121066a343c1c703c4196d67a8f24d487c249c1aac3590be19ba7e099b4b578f2eac85
@@ -1,5 +1,5 @@
1
1
  module Vue
2
2
  module Rails
3
- VERSION = "0.10.4"
3
+ VERSION = "0.10.6"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*
2
- Vue.js v0.10.4
2
+ Vue.js v0.10.6
3
3
  (c) 2014 Evan You
4
4
  License: MIT
5
5
  */
@@ -213,12 +213,14 @@ var config = require('./config'),
213
213
  ViewModel = require('./viewmodel'),
214
214
  utils = require('./utils'),
215
215
  makeHash = utils.hash,
216
- assetTypes = ['directive', 'filter', 'partial', 'effect', 'component']
217
-
218
- // require these so Browserify can catch them
219
- // so they can be used in Vue.require
220
- require('./observer')
221
- require('./transition')
216
+ assetTypes = ['directive', 'filter', 'partial', 'effect', 'component'],
217
+ // Internal modules that are exposed for plugins
218
+ pluginAPI = {
219
+ utils: utils,
220
+ config: config,
221
+ transition: require('./transition'),
222
+ observer: require('./observer')
223
+ }
222
224
 
223
225
  ViewModel.options = config.globalAssets = {
224
226
  directives : require('./directives'),
@@ -239,7 +241,7 @@ assetTypes.forEach(function (type) {
239
241
  }
240
242
  if (!value) return hash[id]
241
243
  if (type === 'partial') {
242
- value = utils.toFragment(value)
244
+ value = utils.parseTemplateOption(value)
243
245
  } else if (type === 'component') {
244
246
  value = utils.toConstructor(value)
245
247
  } else if (type === 'filter') {
@@ -294,8 +296,8 @@ ViewModel.use = function (plugin) {
294
296
  /**
295
297
  * Expose internal modules for plugins
296
298
  */
297
- ViewModel.require = function (path) {
298
- return require('./' + path)
299
+ ViewModel.require = function (module) {
300
+ return pluginAPI[module]
299
301
  }
300
302
 
301
303
  ViewModel.extend = extend
@@ -357,7 +359,7 @@ function extend (options) {
357
359
  * For options such as `data`, `vms`, `directives`, 'partials',
358
360
  * they should be further extended. However extending should only
359
361
  * be done at top level.
360
- *
362
+ *
361
363
  * `proto` is an exception because it's handled directly on the
362
364
  * prototype.
363
365
  *
@@ -517,13 +519,15 @@ Object.defineProperty(module.exports, 'delimiters', {
517
519
  })
518
520
  });
519
521
  require.register("vue/src/utils.js", function(exports, require, module){
520
- var config = require('./config'),
521
- toString = ({}).toString,
522
- win = window,
523
- console = win.console,
524
- def = Object.defineProperty,
525
- OBJECT = 'object',
526
- THIS_RE = /[^\w]this[^\w]/,
522
+ var config = require('./config'),
523
+ toString = ({}).toString,
524
+ win = window,
525
+ console = win.console,
526
+ def = Object.defineProperty,
527
+ OBJECT = 'object',
528
+ THIS_RE = /[^\w]this[^\w]/,
529
+ BRACKET_RE_S = /\['([^']+)'\]/g,
530
+ BRACKET_RE_D = /\["([^"]+)"\]/g,
527
531
  hasClassList = 'classList' in document.documentElement,
528
532
  ViewModel // late def
529
533
 
@@ -532,6 +536,16 @@ var defer =
532
536
  win.webkitRequestAnimationFrame ||
533
537
  win.setTimeout
534
538
 
539
+ /**
540
+ * Normalize keypath with possible brackets into dot notations
541
+ */
542
+ function normalizeKeypath (key) {
543
+ return key.indexOf('[') < 0
544
+ ? key
545
+ : key.replace(BRACKET_RE_S, '.$1')
546
+ .replace(BRACKET_RE_D, '.$1')
547
+ }
548
+
535
549
  var utils = module.exports = {
536
550
 
537
551
  /**
@@ -539,11 +553,17 @@ var utils = module.exports = {
539
553
  */
540
554
  toFragment: require('./fragment'),
541
555
 
556
+ /**
557
+ * Parse the various types of template options
558
+ */
559
+ parseTemplateOption: require('./template-parser.js'),
560
+
542
561
  /**
543
562
  * get a value from an object keypath
544
563
  */
545
564
  get: function (obj, key) {
546
565
  /* jshint eqeqeq: false */
566
+ key = normalizeKeypath(key)
547
567
  if (key.indexOf('.') < 0) {
548
568
  return obj[key]
549
569
  }
@@ -560,6 +580,7 @@ var utils = module.exports = {
560
580
  */
561
581
  set: function (obj, key, val) {
562
582
  /* jshint eqeqeq: false */
583
+ key = normalizeKeypath(key)
563
584
  if (key.indexOf('.') < 0) {
564
585
  obj[key] = val
565
586
  return
@@ -731,7 +752,7 @@ var utils = module.exports = {
731
752
  }
732
753
  if (partials) {
733
754
  for (key in partials) {
734
- partials[key] = utils.toFragment(partials[key])
755
+ partials[key] = utils.parseTemplateOption(partials[key])
735
756
  }
736
757
  }
737
758
  if (filters) {
@@ -740,7 +761,7 @@ var utils = module.exports = {
740
761
  }
741
762
  }
742
763
  if (template) {
743
- options.template = utils.toFragment(template)
764
+ options.template = utils.parseTemplateOption(template)
744
765
  }
745
766
  },
746
767
 
@@ -810,7 +831,7 @@ function enableDebug () {
810
831
  console.log(msg)
811
832
  }
812
833
  }
813
-
834
+
814
835
  /**
815
836
  * warnings, traces by default
816
837
  * can be suppressed by `silent` option.
@@ -858,29 +879,12 @@ map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'
858
879
 
859
880
  var TAG_RE = /<([\w:]+)/
860
881
 
861
- module.exports = function (template) {
862
-
863
- if (typeof template !== 'string') {
864
- return template
865
- }
866
-
867
- // template by ID
868
- if (template.charAt(0) === '#') {
869
- var templateNode = document.getElementById(template.slice(1))
870
- if (!templateNode) return
871
- // if its a template tag and the browser supports it,
872
- // its content is already a document fragment!
873
- if (templateNode.tagName === 'TEMPLATE' && templateNode.content) {
874
- return templateNode.content
875
- }
876
- template = templateNode.innerHTML
877
- }
878
-
882
+ module.exports = function (templateString) {
879
883
  var frag = document.createDocumentFragment(),
880
- m = TAG_RE.exec(template)
884
+ m = TAG_RE.exec(templateString)
881
885
  // text only
882
886
  if (!m) {
883
- frag.appendChild(document.createTextNode(template))
887
+ frag.appendChild(document.createTextNode(templateString))
884
888
  return frag
885
889
  }
886
890
 
@@ -891,7 +895,7 @@ module.exports = function (template) {
891
895
  suffix = wrap[2],
892
896
  node = document.createElement('div')
893
897
 
894
- node.innerHTML = prefix + template.trim() + suffix
898
+ node.innerHTML = prefix + templateString.trim() + suffix
895
899
  while (depth--) node = node.lastChild
896
900
 
897
901
  // one element
@@ -922,7 +926,7 @@ var Emitter = require('./emitter'),
922
926
  DepsParser = require('./deps-parser'),
923
927
  ExpParser = require('./exp-parser'),
924
928
  ViewModel,
925
-
929
+
926
930
  // cache methods
927
931
  slice = [].slice,
928
932
  extend = utils.extend,
@@ -982,20 +986,6 @@ function Compiler (vm, options) {
982
986
  compiler.children = []
983
987
  compiler.emitter = new Emitter(vm)
984
988
 
985
- // create bindings for computed properties
986
- if (options.methods) {
987
- for (key in options.methods) {
988
- compiler.createBinding(key)
989
- }
990
- }
991
-
992
- // create bindings for methods
993
- if (options.computed) {
994
- for (key in options.computed) {
995
- compiler.createBinding(key)
996
- }
997
- }
998
-
999
989
  // VM ---------------------------------------------------------------------
1000
990
 
1001
991
  // set VM properties
@@ -1011,6 +1001,10 @@ function Compiler (vm, options) {
1011
1001
  compiler.parent = parentVM.$compiler
1012
1002
  parentVM.$compiler.children.push(compiler)
1013
1003
  vm.$parent = parentVM
1004
+ // inherit lazy option
1005
+ if (!('lazy' in options)) {
1006
+ options.lazy = compiler.parent.options.lazy
1007
+ }
1014
1008
  }
1015
1009
  vm.$root = getRoot(compiler).vm
1016
1010
 
@@ -1020,6 +1014,20 @@ function Compiler (vm, options) {
1020
1014
  // this is necesarry for all hooks and data observation events
1021
1015
  compiler.setupObserver()
1022
1016
 
1017
+ // create bindings for computed properties
1018
+ if (options.methods) {
1019
+ for (key in options.methods) {
1020
+ compiler.createBinding(key)
1021
+ }
1022
+ }
1023
+
1024
+ // create bindings for methods
1025
+ if (options.computed) {
1026
+ for (key in options.computed) {
1027
+ compiler.createBinding(key)
1028
+ }
1029
+ }
1030
+
1023
1031
  // initialize data
1024
1032
  var data = compiler.data = options.data || {},
1025
1033
  defaultData = options.defaultData
@@ -1437,37 +1445,48 @@ CompilerProto.compileElement = function (node, root) {
1437
1445
  node.vue_effect = this.eval(utils.attr(node, 'effect'))
1438
1446
 
1439
1447
  var prefix = config.prefix + '-',
1440
- attrs = slice.call(node.attributes),
1441
1448
  params = this.options.paramAttributes,
1442
- attr, isDirective, exp, directives, directive, dirname
1449
+ attr, attrname, isDirective, exp, directives, directive, dirname
1450
+
1451
+ // v-with has special priority among the rest
1452
+ // it needs to pull in the value from the parent before
1453
+ // computed properties are evaluated, because at this stage
1454
+ // the computed properties have not set up their dependencies yet.
1455
+ if (root) {
1456
+ var withExp = utils.attr(node, 'with')
1457
+ if (withExp) {
1458
+ directives = this.parseDirective('with', withExp, node, true)
1459
+ for (j = 0, k = directives.length; j < k; j++) {
1460
+ this.bindDirective(directives[j], this.parent)
1461
+ }
1462
+ }
1463
+ }
1443
1464
 
1465
+ var attrs = slice.call(node.attributes)
1444
1466
  for (i = 0, l = attrs.length; i < l; i++) {
1445
1467
 
1446
1468
  attr = attrs[i]
1469
+ attrname = attr.name
1447
1470
  isDirective = false
1448
1471
 
1449
- if (attr.name.indexOf(prefix) === 0) {
1472
+ if (attrname.indexOf(prefix) === 0) {
1450
1473
  // a directive - split, parse and bind it.
1451
1474
  isDirective = true
1452
- dirname = attr.name.slice(prefix.length)
1475
+ dirname = attrname.slice(prefix.length)
1453
1476
  // build with multiple: true
1454
1477
  directives = this.parseDirective(dirname, attr.value, node, true)
1455
1478
  // loop through clauses (separated by ",")
1456
1479
  // inside each attribute
1457
1480
  for (j = 0, k = directives.length; j < k; j++) {
1458
- directive = directives[j]
1459
- if (dirname === 'with') {
1460
- this.bindDirective(directive, this.parent)
1461
- } else {
1462
- this.bindDirective(directive)
1463
- }
1481
+ this.bindDirective(directives[j])
1464
1482
  }
1465
1483
  } else if (config.interpolate) {
1466
1484
  // non directive attribute, check interpolation tags
1467
1485
  exp = TextParser.parseAttr(attr.value)
1468
1486
  if (exp) {
1469
- directive = this.parseDirective('attr', attr.name + ':' + exp, node)
1470
- if (params && params.indexOf(attr.name) > -1) {
1487
+ directive = this.parseDirective('attr', exp, node)
1488
+ directive.arg = attrname
1489
+ if (params && params.indexOf(attrname) > -1) {
1471
1490
  // a param attribute... we should use the parent binding
1472
1491
  // to avoid circular updates like size={{size}}
1473
1492
  this.bindDirective(directive, this.parent)
@@ -1478,7 +1497,7 @@ CompilerProto.compileElement = function (node, root) {
1478
1497
  }
1479
1498
 
1480
1499
  if (isDirective && dirname !== 'cloak') {
1481
- node.removeAttribute(attr.name)
1500
+ node.removeAttribute(attrname)
1482
1501
  }
1483
1502
  }
1484
1503
 
@@ -1618,7 +1637,7 @@ CompilerProto.createBinding = function (key, directive) {
1618
1637
  compiler.defineExp(key, binding, directive)
1619
1638
  } else if (isFn) {
1620
1639
  bindings[key] = binding
1621
- binding.value = compiler.vm[key] = methods[key]
1640
+ compiler.defineVmProp(key, binding, methods[key])
1622
1641
  } else {
1623
1642
  bindings[key] = binding
1624
1643
  if (binding.root) {
@@ -1628,9 +1647,12 @@ CompilerProto.createBinding = function (key, directive) {
1628
1647
  compiler.defineComputed(key, binding, computed[key])
1629
1648
  } else if (key.charAt(0) !== '$') {
1630
1649
  // normal property
1631
- compiler.defineProp(key, binding)
1650
+ compiler.defineDataProp(key, binding)
1632
1651
  } else {
1633
- compiler.defineMeta(key, binding)
1652
+ // properties that start with $ are meta properties
1653
+ // they should be kept on the vm but not in the data object.
1654
+ compiler.defineVmProp(key, binding, compiler.data[key])
1655
+ delete compiler.data[key]
1634
1656
  }
1635
1657
  } else if (computed && computed[utils.baseKey(key)]) {
1636
1658
  // nested path on computed property
@@ -1652,10 +1674,10 @@ CompilerProto.createBinding = function (key, directive) {
1652
1674
  }
1653
1675
 
1654
1676
  /**
1655
- * Define the getter/setter for a root-level property on the VM
1656
- * and observe the initial value
1677
+ * Define the getter/setter to proxy a root-level
1678
+ * data property on the VM
1657
1679
  */
1658
- CompilerProto.defineProp = function (key, binding) {
1680
+ CompilerProto.defineDataProp = function (key, binding) {
1659
1681
  var compiler = this,
1660
1682
  data = compiler.data,
1661
1683
  ob = data.__emitter__
@@ -1685,14 +1707,13 @@ CompilerProto.defineProp = function (key, binding) {
1685
1707
  }
1686
1708
 
1687
1709
  /**
1688
- * Define a meta property, e.g. $index or $key,
1689
- * which is bindable but only accessible on the VM,
1710
+ * Define a vm property, e.g. $index, $key, or mixin methods
1711
+ * which are bindable but only accessible on the VM,
1690
1712
  * not in the data.
1691
1713
  */
1692
- CompilerProto.defineMeta = function (key, binding) {
1714
+ CompilerProto.defineVmProp = function (key, binding, value) {
1693
1715
  var ob = this.observer
1694
- binding.value = this.data[key]
1695
- delete this.data[key]
1716
+ binding.value = value
1696
1717
  def(this.vm, key, {
1697
1718
  get: function () {
1698
1719
  if (Observer.shouldGet) ob.emit('get', key)
@@ -1833,7 +1854,7 @@ CompilerProto.resolveComponent = function (node, data, test) {
1833
1854
  /**
1834
1855
  * Unbind and remove element
1835
1856
  */
1836
- CompilerProto.destroy = function () {
1857
+ CompilerProto.destroy = function (noRemove) {
1837
1858
 
1838
1859
  // avoid being called more than once
1839
1860
  // this is irreversible!
@@ -1854,6 +1875,14 @@ CompilerProto.destroy = function () {
1854
1875
  // unobserve data
1855
1876
  Observer.unobserve(compiler.data, '', compiler.observer)
1856
1877
 
1878
+ // destroy all children
1879
+ // do not remove their elements since the parent
1880
+ // may have transitions and the children may not
1881
+ i = children.length
1882
+ while (i--) {
1883
+ children[i].destroy(true)
1884
+ }
1885
+
1857
1886
  // unbind all direcitves
1858
1887
  i = directives.length
1859
1888
  while (i--) {
@@ -1886,12 +1915,6 @@ CompilerProto.destroy = function () {
1886
1915
  }
1887
1916
  }
1888
1917
 
1889
- // destroy all children
1890
- i = children.length
1891
- while (i--) {
1892
- children[i].destroy()
1893
- }
1894
-
1895
1918
  // remove self from parent
1896
1919
  if (parent) {
1897
1920
  j = parent.children.indexOf(compiler)
@@ -1899,10 +1922,12 @@ CompilerProto.destroy = function () {
1899
1922
  }
1900
1923
 
1901
1924
  // finally remove dom element
1902
- if (el === document.body) {
1903
- el.innerHTML = ''
1904
- } else {
1905
- vm.$remove()
1925
+ if (!noRemove) {
1926
+ if (el === document.body) {
1927
+ el.innerHTML = ''
1928
+ } else {
1929
+ vm.$remove()
1930
+ }
1906
1931
  }
1907
1932
  el.vue_vm = null
1908
1933
 
@@ -1948,7 +1973,8 @@ var Compiler = require('./compiler'),
1948
1973
  * and a few reserved methods
1949
1974
  */
1950
1975
  function ViewModel (options) {
1951
- // just compile. options are passed directly to compiler
1976
+ // compile if options passed, if false return. options are passed directly to compiler
1977
+ if (options === false) return
1952
1978
  new Compiler(this, options)
1953
1979
  }
1954
1980
 
@@ -1956,6 +1982,15 @@ function ViewModel (options) {
1956
1982
  // so it can be stringified/looped through as raw data
1957
1983
  var VMProto = ViewModel.prototype
1958
1984
 
1985
+ /**
1986
+ * init allows config compilation after instantiation:
1987
+ * var a = new Vue(false)
1988
+ * a.init(config)
1989
+ */
1990
+ def(VMProto, '$init', function (options) {
1991
+ new Compiler(this, options)
1992
+ })
1993
+
1959
1994
  /**
1960
1995
  * Convenience function to get a value from
1961
1996
  * a keypath
@@ -2013,8 +2048,8 @@ def(VMProto, '$unwatch', function (key, callback) {
2013
2048
  /**
2014
2049
  * unbind everything, remove everything
2015
2050
  */
2016
- def(VMProto, '$destroy', function () {
2017
- this.$compiler.destroy()
2051
+ def(VMProto, '$destroy', function (noRemove) {
2052
+ this.$compiler.destroy(noRemove)
2018
2053
  })
2019
2054
 
2020
2055
  /**
@@ -2110,6 +2145,7 @@ function query (el) {
2110
2145
  }
2111
2146
 
2112
2147
  module.exports = ViewModel
2148
+
2113
2149
  });
2114
2150
  require.register("vue/src/binding.js", function(exports, require, module){
2115
2151
  var Batcher = require('./batcher'),
@@ -2286,7 +2322,7 @@ function watchMutation (method) {
2286
2322
  inserted = args.slice(2)
2287
2323
  removed = result
2288
2324
  }
2289
-
2325
+
2290
2326
  // link & unlink
2291
2327
  linkArrayElements(this, inserted)
2292
2328
  unlinkArrayElements(this, removed)
@@ -2301,7 +2337,7 @@ function watchMutation (method) {
2301
2337
  })
2302
2338
 
2303
2339
  return result
2304
-
2340
+
2305
2341
  }, !hasProto)
2306
2342
  }
2307
2343
 
@@ -2670,7 +2706,8 @@ var dirId = 1,
2670
2706
  FILTER_TOKEN_RE = /[^\s'"]+|'[^']+'|"[^"]+"/g,
2671
2707
  NESTING_RE = /^\$(parent|root)\./,
2672
2708
  SINGLE_VAR_RE = /^[\w\.$]+$/,
2673
- QUOTE_RE = /"/g
2709
+ QUOTE_RE = /"/g,
2710
+ TextParser = require('./text-parser')
2674
2711
 
2675
2712
  /**
2676
2713
  * Directive class
@@ -2705,11 +2742,12 @@ function Directive (name, ast, definition, compiler, el) {
2705
2742
  return
2706
2743
  }
2707
2744
 
2708
- this.expression = (
2709
- this.isLiteral
2710
- ? compiler.eval(this.expression)
2711
- : this.expression
2712
- ).trim()
2745
+ if (TextParser.Regex.test(this.key)) {
2746
+ this.key = compiler.eval(this.key)
2747
+ if (this.isLiteral) {
2748
+ this.expression = this.key
2749
+ }
2750
+ }
2713
2751
 
2714
2752
  var filters = ast.filters,
2715
2753
  filter, fn, i, l, computed
@@ -2747,7 +2785,7 @@ function Directive (name, ast, definition, compiler, el) {
2747
2785
  var DirProto = Directive.prototype
2748
2786
 
2749
2787
  /**
2750
- * called when a new value is set
2788
+ * called when a new value is set
2751
2789
  * for computed properties, this will only be called once
2752
2790
  * during initialization.
2753
2791
  */
@@ -2827,7 +2865,7 @@ Directive.parse = function (str) {
2827
2865
  arg = str.slice(begin, i).trim()
2828
2866
  if (ARG_RE.test(arg)) {
2829
2867
  argIndex = i + 1
2830
- dir.arg = str.slice(begin, i).trim()
2868
+ dir.arg = arg
2831
2869
  }
2832
2870
  } else if (c === '|' && str.charAt(i + 1) !== '|' && str.charAt(i - 1) !== '|') {
2833
2871
  if (dir.key === undefined) {
@@ -2946,7 +2984,7 @@ var KEYWORDS =
2946
2984
  ',arguments,let,yield' +
2947
2985
  // allow using Math in expressions
2948
2986
  ',Math',
2949
-
2987
+
2950
2988
  KEYWORDS_RE = new RegExp(["\\b" + KEYWORDS.replace(/,/g, '\\b|\\b') + "\\b"].join('|'), 'g'),
2951
2989
  REMOVE_RE = /\/\*(?:.|\n)*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|'[^']*'|"[^"]*"|[\s\t\n]*\.[\s\t\n]*[$\w\.]+|[\{,]\s*[\w\$_]+\s*:/g,
2952
2990
  SPLIT_RE = /[^\w$]+/g,
@@ -3113,15 +3151,65 @@ exports.eval = function (exp, compiler, data) {
3113
3151
  }
3114
3152
  return res
3115
3153
  }
3154
+ });
3155
+ require.register("vue/src/template-parser.js", function(exports, require, module){
3156
+ var toFragment = require('./fragment');
3157
+
3158
+ /**
3159
+ * Parses a template string or node and normalizes it into a
3160
+ * a node that can be used as a partial of a template option
3161
+ *
3162
+ * Possible values include
3163
+ * id selector: '#some-template-id'
3164
+ * template string: '<div><span>my template</span></div>'
3165
+ * DocumentFragment object
3166
+ * Node object of type Template
3167
+ */
3168
+ module.exports = function(template) {
3169
+ var templateNode;
3170
+
3171
+ if (template instanceof window.DocumentFragment) {
3172
+ // if the template is already a document fragment -- do nothing
3173
+ return template
3174
+ }
3175
+
3176
+ if (typeof template === 'string') {
3177
+ // template by ID
3178
+ if (template.charAt(0) === '#') {
3179
+ templateNode = document.getElementById(template.slice(1))
3180
+ if (!templateNode) return
3181
+ } else {
3182
+ return toFragment(template)
3183
+ }
3184
+ } else if (template.nodeType) {
3185
+ templateNode = template
3186
+ } else {
3187
+ return
3188
+ }
3189
+
3190
+ // if its a template tag and the browser supports it,
3191
+ // its content is already a document fragment!
3192
+ if (templateNode.tagName === 'TEMPLATE' && templateNode.content) {
3193
+ return templateNode.content
3194
+ }
3195
+
3196
+ if (templateNode.tagName === 'SCRIPT') {
3197
+ return toFragment(templateNode.innerHTML)
3198
+ }
3199
+
3200
+ return toFragment(templateNode.outerHTML);
3201
+ }
3202
+
3116
3203
  });
3117
3204
  require.register("vue/src/text-parser.js", function(exports, require, module){
3118
3205
  var openChar = '{',
3119
3206
  endChar = '}',
3120
3207
  ESCAPE_RE = /[-.*+?^${}()|[\]\/\\]/g,
3121
- BINDING_RE = buildInterpolationRegex(),
3122
3208
  // lazy require
3123
3209
  Directive
3124
3210
 
3211
+ exports.Regex = buildInterpolationRegex()
3212
+
3125
3213
  function buildInterpolationRegex () {
3126
3214
  var open = escapeRegex(openChar),
3127
3215
  end = escapeRegex(endChar)
@@ -3133,13 +3221,13 @@ function escapeRegex (str) {
3133
3221
  }
3134
3222
 
3135
3223
  function setDelimiters (delimiters) {
3136
- exports.delimiters = delimiters
3137
3224
  openChar = delimiters[0]
3138
3225
  endChar = delimiters[1]
3139
- BINDING_RE = buildInterpolationRegex()
3226
+ exports.delimiters = delimiters
3227
+ exports.Regex = buildInterpolationRegex()
3140
3228
  }
3141
3229
 
3142
- /**
3230
+ /**
3143
3231
  * Parse a piece of text, return an array of tokens
3144
3232
  * token types:
3145
3233
  * 1. plain string
@@ -3147,10 +3235,10 @@ function setDelimiters (delimiters) {
3147
3235
  * 3. object with key & html = true
3148
3236
  */
3149
3237
  function parse (text) {
3150
- if (!BINDING_RE.test(text)) return null
3238
+ if (!exports.Regex.test(text)) return null
3151
3239
  var m, i, token, match, tokens = []
3152
3240
  /* jshint boss: true */
3153
- while (m = text.match(BINDING_RE)) {
3241
+ while (m = text.match(exports.Regex)) {
3154
3242
  i = m.index
3155
3243
  if (i > 0) tokens.push(text.slice(0, i))
3156
3244
  token = { key: m[1].trim() }
@@ -3275,7 +3363,7 @@ module.exports = {
3275
3363
  Observer.shouldGet = false
3276
3364
  utils.log('\ndone.')
3277
3365
  }
3278
-
3366
+
3279
3367
  }
3280
3368
  });
3281
3369
  require.register("vue/src/filters.js", function(exports, require, module){
@@ -3316,6 +3404,7 @@ filters.lowercase = function (value) {
3316
3404
  * 12345 => $12,345.00
3317
3405
  */
3318
3406
  filters.currency = function (value, sign) {
3407
+ value = parseFloat(value)
3319
3408
  if (!value && value !== 0) return ''
3320
3409
  sign = sign || '$'
3321
3410
  var s = Math.floor(value).toString(),
@@ -3542,8 +3631,6 @@ var transition = module.exports = function (el, stage, cb, compiler) {
3542
3631
 
3543
3632
  }
3544
3633
 
3545
- transition.codes = codes
3546
-
3547
3634
  /**
3548
3635
  * Togggle a CSS class to trigger transition
3549
3636
  */
@@ -3619,7 +3706,7 @@ function applyTransitionClass (el, stage, changeState, hasAnimation) {
3619
3706
  changeState()
3620
3707
  }
3621
3708
  return codes.CSS_L
3622
-
3709
+
3623
3710
  }
3624
3711
 
3625
3712
  }
@@ -3681,9 +3768,9 @@ function sniffEndEvents () {
3681
3768
  var el = document.createElement('vue'),
3682
3769
  defaultEvent = 'transitionend',
3683
3770
  events = {
3771
+ 'webkitTransition' : 'webkitTransitionEnd',
3684
3772
  'transition' : defaultEvent,
3685
- 'mozTransition' : defaultEvent,
3686
- 'webkitTransition' : 'webkitTransitionEnd'
3773
+ 'mozTransition' : defaultEvent
3687
3774
  },
3688
3775
  ret = {}
3689
3776
  for (var name in events) {
@@ -3697,6 +3784,10 @@ function sniffEndEvents () {
3697
3784
  : 'webkitAnimationEnd'
3698
3785
  return ret
3699
3786
  }
3787
+
3788
+ // Expose some stuff for testing purposes
3789
+ transition.codes = codes
3790
+ transition.sniff = sniffEndEvents
3700
3791
  });
3701
3792
  require.register("vue/src/batcher.js", function(exports, require, module){
3702
3793
  var utils = require('./utils')
@@ -3885,7 +3976,7 @@ var utils = require('../utils')
3885
3976
  module.exports = {
3886
3977
 
3887
3978
  bind: function () {
3888
-
3979
+
3889
3980
  this.parent = this.el.parentNode
3890
3981
  this.ref = document.createComment('vue-if')
3891
3982
  this.Ctor = this.compiler.resolveComponent(this.el)
@@ -3923,7 +4014,7 @@ module.exports = {
3923
4014
  this.childVM.$before(this.ref)
3924
4015
  }
3925
4016
  }
3926
-
4017
+
3927
4018
  },
3928
4019
 
3929
4020
  unbind: function () {
@@ -4196,6 +4287,13 @@ module.exports = {
4196
4287
  this.context = this.binding.isExp
4197
4288
  ? this.vm
4198
4289
  : this.binding.compiler.vm
4290
+ if (this.el.tagName === 'IFRAME' && this.arg !== 'load') {
4291
+ var self = this
4292
+ this.iframeBind = function () {
4293
+ self.el.contentWindow.addEventListener(self.arg, self.handler)
4294
+ }
4295
+ this.el.addEventListener('load', this.iframeBind)
4296
+ }
4199
4297
  },
4200
4298
 
4201
4299
  update: function (handler) {
@@ -4203,7 +4301,7 @@ module.exports = {
4203
4301
  utils.warn('Directive "v-on:' + this.expression + '" expects a method.')
4204
4302
  return
4205
4303
  }
4206
- this.unbind()
4304
+ this.reset()
4207
4305
  var vm = this.vm,
4208
4306
  context = this.context
4209
4307
  this.handler = function (e) {
@@ -4213,11 +4311,25 @@ module.exports = {
4213
4311
  context.$event = null
4214
4312
  return res
4215
4313
  }
4216
- this.el.addEventListener(this.arg, this.handler)
4314
+ if (this.iframeBind) {
4315
+ this.iframeBind()
4316
+ } else {
4317
+ this.el.addEventListener(this.arg, this.handler)
4318
+ }
4319
+ },
4320
+
4321
+ reset: function () {
4322
+ var el = this.iframeBind
4323
+ ? this.el.contentWindow
4324
+ : this.el
4325
+ if (this.handler) {
4326
+ el.removeEventListener(this.arg, this.handler)
4327
+ }
4217
4328
  },
4218
4329
 
4219
4330
  unbind: function () {
4220
- this.el.removeEventListener(this.arg, this.handler)
4331
+ this.reset()
4332
+ this.el.removeEventListener('load', this.iframeBind)
4221
4333
  }
4222
4334
  }
4223
4335
  });
@@ -4441,7 +4553,7 @@ module.exports = {
4441
4553
  if (!this.alone && !this.lock) {
4442
4554
  if (this.arg) {
4443
4555
  this.vm.$set(this.arg, value)
4444
- } else {
4556
+ } else if (this.vm.$data !== value) {
4445
4557
  this.vm.$data = value
4446
4558
  }
4447
4559
  }
@@ -4493,12 +4605,7 @@ module.exports = {
4493
4605
  }
4494
4606
  });
4495
4607
  require.register("vue/src/directives/style.js", function(exports, require, module){
4496
- var camelRE = /-([a-z])/g,
4497
- prefixes = ['webkit', 'moz', 'ms']
4498
-
4499
- function camelReplacer (m) {
4500
- return m[1].toUpperCase()
4501
- }
4608
+ var prefixes = ['-webkit-', '-moz-', '-ms-']
4502
4609
 
4503
4610
  /**
4504
4611
  * Binding for CSS styles
@@ -4508,27 +4615,34 @@ module.exports = {
4508
4615
  bind: function () {
4509
4616
  var prop = this.arg
4510
4617
  if (!prop) return
4511
- var first = prop.charAt(0)
4512
- if (first === '$') {
4618
+ if (prop.charAt(0) === '$') {
4513
4619
  // properties that start with $ will be auto-prefixed
4514
4620
  prop = prop.slice(1)
4515
4621
  this.prefixed = true
4516
- } else if (first === '-') {
4517
- // normal starting hyphens should not be converted
4518
- prop = prop.slice(1)
4519
4622
  }
4520
- this.prop = prop.replace(camelRE, camelReplacer)
4623
+ this.prop = prop
4521
4624
  },
4522
4625
 
4523
4626
  update: function (value) {
4524
- var prop = this.prop
4627
+ var prop = this.prop,
4628
+ isImportant
4629
+ /* jshint eqeqeq: true */
4630
+ // cast possible numbers/booleans into strings
4631
+ if (value != null) value += ''
4525
4632
  if (prop) {
4526
- this.el.style[prop] = value
4633
+ if (value) {
4634
+ isImportant = value.slice(-10) === '!important'
4635
+ ? 'important'
4636
+ : ''
4637
+ if (isImportant) {
4638
+ value = value.slice(0, -10).trim()
4639
+ }
4640
+ }
4641
+ this.el.style.setProperty(prop, value, isImportant)
4527
4642
  if (this.prefixed) {
4528
- prop = prop.charAt(0).toUpperCase() + prop.slice(1)
4529
4643
  var i = prefixes.length
4530
4644
  while (i--) {
4531
- this.el.style[prefixes[i] + prop] = value
4645
+ this.el.style.setProperty(prefixes[i] + prop, value, isImportant)
4532
4646
  }
4533
4647
  }
4534
4648
  } else {
@@ -4583,7 +4697,7 @@ module.exports = {
4583
4697
 
4584
4698
  // just set innerHTML...
4585
4699
  el.innerHTML = ''
4586
- el.appendChild(partial.cloneNode(true))
4700
+ el.appendChild(partial)
4587
4701
 
4588
4702
  }
4589
4703
  }
@@ -4655,4 +4769,4 @@ if (typeof exports == 'object') {
4655
4769
  define(function(){ return require('vue'); });
4656
4770
  } else {
4657
4771
  window['Vue'] = require('vue');
4658
- }})();
4772
+ }})();
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vuejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.4
4
+ version: 0.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Butler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-11-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple asset-pipeline wrapper for vue.js by Evan You
14
14
  email:
@@ -17,7 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - .gitignore
20
+ - ".gitignore"
21
21
  - Gemfile
22
22
  - LICENSE.md
23
23
  - Rakefile
@@ -36,17 +36,17 @@ require_paths:
36
36
  - lib
37
37
  required_ruby_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  required_rubygems_version: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  requirements: []
48
48
  rubyforge_project: vuejs-rails
49
- rubygems_version: 2.0.3
49
+ rubygems_version: 2.2.2
50
50
  signing_key:
51
51
  specification_version: 4
52
52
  summary: vue.js asset pipeline provider/wrapper