Browse Source

fix jQuery.fn.val('') + initial gruntsetup

Robin Herbots 11 years ago
parent
commit
0d4ec46d4d

+ 56 - 0
Gruntfile.js

@@ -0,0 +1,56 @@
+module.exports = function (grunt) {
+    function createBanner() {
+        return '/*\n' +
+            '* <%= pkg.name %>\n' +
+            '* http://github.com/RobinHerbots/jquery.inputmask\n' +
+            '* Copyright (c) 2010 - <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
+            '* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)\n' +
+            '* Version: <%= pkg.version %>\n' +
+            '*/\n';
+    }
+
+    // Project configuration.
+    grunt.initConfig({
+        pkg: grunt.file.readJSON('package.json'),
+        uglify: {
+            options: {
+                banner: createBanner()
+            },
+            inputmask: {
+                files: {
+                    'dist/inputmask/<%= pkg.name %>.js': 'js/<%= pkg.name %>.js',
+                    'dist/inputmask/<%= pkg.name %>.extensions.js': 'js/<%= pkg.name %>.extensions.js',
+                    'dist/inputmask/<%= pkg.name %>.date.extensions.js': 'js/<%= pkg.name %>.date.extensions.js',
+                    'dist/inputmask/<%= pkg.name %>.numeric.extensions.js': 'js/<%= pkg.name %>.numeric.extensions.js',
+                    'dist/inputmask/<%= pkg.name %>.phone.extensions.js': 'js/<%= pkg.name %>.phone.extensions.js',
+                    'dist/inputmask/<%= pkg.name %>.regex.extensions.js': 'js/<%= pkg.name %>.regex.extensions.js',
+                }
+            },
+            inputmaskbundle: {
+                files: {
+                    'dist/<%= pkg.name %>.bundle.js': [
+                        'js/<%= pkg.name %>.js',
+                        'js/<%= pkg.name %>.extensions.js',
+                        'js/<%= pkg.name %>.date.extensions.js',
+                        'js/<%= pkg.name %>.numeric.extensions.js',
+                        'js/<%= pkg.name %>.phone.extensions.js',
+                        'js/<%= pkg.name %>.regex.extensions.js'
+                    ]
+                }
+            }
+        },
+        clean: ["dist"],
+        qunit: {
+            files: ['qunit/qunit.html']
+        }
+    });
+
+    // Load the plugin that provides the tasks.
+    grunt.loadNpmTasks('grunt-contrib-uglify');
+    grunt.loadNpmTasks('grunt-contrib-clean');
+    grunt.loadNpmTasks('grunt-contrib-qunit');
+
+    // Default task(s).
+    grunt.registerTask('default', ['clean', 'uglify']);
+
+};

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.1.10",
+  "version": "3.1.11",
   "main": [
     "./dist/inputmask/jquery.inputmask.js",
     "./dist/inputmask/jquery.inputmask.extensions.js",

+ 1 - 1
build.properties

@@ -7,7 +7,7 @@ distdir = dist
 
 build.major = 3
 build.minor = 1
-build.revision = 10
+build.revision = 11
 
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js

File diff suppressed because it is too large
+ 8 - 17
dist/inputmask/jquery.inputmask.date.extensions.js


File diff suppressed because it is too large
+ 8 - 4
dist/inputmask/jquery.inputmask.extensions.js


File diff suppressed because it is too large
+ 7 - 67
dist/inputmask/jquery.inputmask.js


File diff suppressed because it is too large
+ 8 - 10
dist/inputmask/jquery.inputmask.numeric.extensions.js


File diff suppressed because it is too large
+ 8 - 2
dist/inputmask/jquery.inputmask.phone.extensions.js


File diff suppressed because it is too large
+ 8 - 5
dist/inputmask/jquery.inputmask.regex.extensions.js


File diff suppressed because it is too large
+ 5 - 3142
dist/jquery.inputmask.bundle.js


File diff suppressed because it is too large
+ 0 - 107
dist/jquery.inputmask.bundle.min.js


+ 1 - 1
jquery.inputmask.jquery.json

@@ -8,7 +8,7 @@
 		"inputmask",
 		"mask"
     ],
-    "version": "3.1.10",
+    "version": "3.1.11",
     "author": {
         "name": "Robin Herbots",
         "url": "http://github.com/RobinHerbots/jquery.inputmask"

+ 3 - 2
js/jquery.inputmask.js

@@ -1363,9 +1363,8 @@
                             $input.prop("title", getMaskSet()["mask"]);
                         }
 
-                        //needed for IE8 and below
                         if (e && checkval != true) {
-                            e.preventDefault ? e.preventDefault() : e.returnValue = false;
+                            e.preventDefault();
 
                             var currentCaretPos = caret(input);
                             var keypressResult = opts.onKeyPress.call(this, e, getBuffer(), currentCaretPos.begin, opts);
@@ -1607,6 +1606,8 @@
                         var input = this;
                         checkVal(input, true, false, undefined, true);
                         valueOnFocus = getBuffer().join('');
+                        if (input._valueGet() == getBufferTemplate().join(''))
+                            input._valueSet('');
                     }).bind('complete.inputmask', opts.oncomplete
                     ).bind('incomplete.inputmask', opts.onincomplete
                     ).bind('cleared.inputmask', opts.oncleared);

+ 6 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.1.10",
+  "version": "3.1.11",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "main": [
     "./dist/inputmask/jquery.inputmask.js",
@@ -36,6 +36,11 @@
     "jquery": ">=1.7"
   },
   "devDependencies": {
+    "grunt": "^0.4.5",
+    "grunt-contrib-clean": "^0.6.0",
+    "grunt-contrib-concat": "^0.5.0",
+    "grunt-contrib-qunit": "^0.5.2",
+    "grunt-contrib-uglify": "^0.5.1",
     "jquery": ">=1.7"
   }
 }