listjs-rails 1.1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cc24eac52a9e06779f0ad6055a3981f5682159d
4
- data.tar.gz: 109fd090f017c048139afb80ed2a2edc60b56212
3
+ metadata.gz: fad4d7e6bc49e3a724eb531422ed0afc1abb33d1
4
+ data.tar.gz: 7665533bcde3d533bfe5d115bbfcbb6261fb8ef0
5
5
  SHA512:
6
- metadata.gz: 2e728299ef57cbae89f361230407923e51e3012d8878aba58f6046cfd7df683458fd13bb5d33bbd50bca1688e17bde0fd3d79b816cbb90e061c42ef1832953ac
7
- data.tar.gz: c938c8702ed383531a4745a04f6970e9814f0da8bc7f23fc9cdc35ab80f35a0b838194e8e938a6607785a5fb999755a670a77d9123b07205e38aaf48b18301d4
6
+ metadata.gz: 9df47ef421b8cac67ab0774215962c24b0887d2474557ef57b6e565693004d596da0aa8a96aa4b78c572f78455af5584d8522e41ebdeea3d55cc6e857e8d2eaa
7
+ data.tar.gz: ca6eb0a39f3d9eaed97d01d6028cebaca17891bce11ea34461c1828566cbfa96deffd89324591ca63ce7ac2b0d78915448a4c14abd0fb23e30ec0e3872d721dd
@@ -478,7 +478,7 @@ var typeOf = require('type')
478
478
  * Note: This implementation doesn't consider elements that are also
479
479
  *
480
480
  *
481
-
481
+
482
482
  collections, such as `<form>` and `<select>`, to be array-like.
483
483
 
484
484
  @method test
@@ -866,4 +866,4 @@ require.alias("list.fuzzysearch.js/index.js", "list.fuzzysearch.js/index.js");if
866
866
  define(function(){ return require("list.fuzzysearch.js"); });
867
867
  } else {
868
868
  this["ListFuzzySearch"] = require("list.fuzzysearch.js");
869
- }})();
869
+ }})();
@@ -450,7 +450,7 @@ exports.unbind = function(el, type, fn, capture){
450
450
  return fn;
451
451
  };
452
452
  });
453
- require.register("javve-to-array/index.js", function(exports, require, module){
453
+ require.register("timoxley-to-array/index.js", function(exports, require, module){
454
454
  /**
455
455
  * Convert an array-like object into an `Array`.
456
456
  * If `collection` is already an `Array`, then will return a clone of `collection`.
@@ -465,9 +465,9 @@ module.exports = function toArray(collection) {
465
465
  if (collection === null) return [null]
466
466
  if (collection === window) return [window]
467
467
  if (typeof collection === 'string') return [collection]
468
- if (collection instanceof Array) return collection
468
+ if (isArray(collection)) return collection
469
469
  if (typeof collection.length != 'number') return [collection]
470
- if (typeof collection === 'function') return [collection]
470
+ if (typeof collection === 'function' && collection instanceof Function) return [collection]
471
471
 
472
472
  var arr = []
473
473
  for (var i = 0; i < collection.length; i++) {
@@ -479,6 +479,10 @@ module.exports = function toArray(collection) {
479
479
  return arr
480
480
  }
481
481
 
482
+ function isArray(arr) {
483
+ return Object.prototype.toString.call(arr) === "[object Array]";
484
+ }
485
+
482
486
  });
483
487
  require.register("javve-events/index.js", function(exports, require, module){
484
488
  var events = require('event'),
@@ -1033,8 +1037,19 @@ module.exports = function(list) {
1033
1037
  list.handlers.searchComplete = list.handlers.searchComplete || [];
1034
1038
 
1035
1039
  events.bind(getByClass(list.listContainer, list.searchClass), 'keyup', function(e) {
1036
- var target = e.target || e.srcElement; // IE have srcElement
1037
- searchMethod(target.value);
1040
+ var target = e.target || e.srcElement, // IE have srcElement
1041
+ alreadyCleared = (target.value === "" && !list.searched);
1042
+ if (!alreadyCleared) { // If oninput already have resetted the list, do nothing
1043
+ searchMethod(target.value);
1044
+ }
1045
+ });
1046
+
1047
+ // Used to detect click on HTML5 clear button
1048
+ events.bind(getByClass(list.listContainer, list.searchClass), 'input', function(e) {
1049
+ var target = e.target || e.srcElement;
1050
+ if (target.value === "") {
1051
+ searchMethod('');
1052
+ }
1038
1053
  });
1039
1054
 
1040
1055
  list.helpers.toString = toString;
@@ -1433,7 +1448,7 @@ require.alias("javve-events/index.js", "list.js/deps/events/index.js");
1433
1448
  require.alias("javve-events/index.js", "events/index.js");
1434
1449
  require.alias("component-event/index.js", "javve-events/deps/event/index.js");
1435
1450
 
1436
- require.alias("javve-to-array/index.js", "javve-events/deps/to-array/index.js");
1451
+ require.alias("timoxley-to-array/index.js", "javve-events/deps/to-array/index.js");
1437
1452
 
1438
1453
  require.alias("javve-get-by-class/index.js", "list.js/deps/get-by-class/index.js");
1439
1454
  require.alias("javve-get-by-class/index.js", "get-by-class/index.js");
@@ -555,4 +555,4 @@ require.alias("list.pagination.js/index.js", "list.pagination.js/index.js");if (
555
555
  define(function(){ return require("list.pagination.js"); });
556
556
  } else {
557
557
  this["ListPagination"] = require("list.pagination.js");
558
- }})();
558
+ }})();
@@ -1,5 +1,5 @@
1
1
  module Listjs
2
2
  module Rails
3
- VERSION = '1.1.0.1'
3
+ VERSION = '1.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: listjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artur Rodrigues
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-14 00:00:00.000000000 Z
11
+ date: 2014-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -112,4 +112,3 @@ specification_version: 4
112
112
  summary: Gem installation of javascript framework for list and table manipulation,
113
113
  List.js
114
114
  test_files: []
115
- has_rdoc: