Skip to content

Commit 80ffa16

Browse files
author
GrayYoung
committed
Update to version 1.1.7 -- optimization
1 parent 4260ddb commit 80ffa16

9 files changed

Lines changed: 34 additions & 35 deletions

File tree

demos/browser.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<html>
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5-
<!-- saved from url=(0014)about:internet -->
65
<title>jQuery.Utilities - jQuery.Browser</title>
76
<link rel="stylesheet" href="res/css/common.css" />
7+
<!-- saved from url=(0014)about:internet -->
88
<script type="text/javascript" src="res/js/lib/jquery/dist/jquery.min.js"></script>
99
<script type="text/javascript" src="res/js/lib/jquery.migrate/jquery-migrate-1.2.1.min.js"></script>
1010
<script type="text/javascript" src="res/js/utilities/jquery.browser.js"></script>
@@ -13,18 +13,20 @@
1313
var $dataTable = $('table');
1414

1515
for ( var b in jQuery.browser) {
16-
if (b) {
16+
if (b) {
1717
$('tfoot', $dataTable).append('<tr class="warning"><th>' + b + '</th><td>' + jQuery.browser[b] + '</td><td /><td /></tr>');
18-
}
18+
}
1919
}
20-
});
20+
$('caption').text(navigator.userAgent);
21+
});
2122
</script>
2223
</head>
2324
<body>
2425
<section class="container-fluid">
2526
<h1>jQuery.Utilities - jQuery.Browser</h1>
2627
<div class="table-responsive">
2728
<table class="table table-striped table-bordered table-hover">
29+
<caption></caption>
2830
<thead>
2931
<tr>
3032
<th class="sorter-false">Browser</th>

demos/clear-form.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
<meta charset="UTF-8">
55
<title>jQuery.Utilities - jQuery.clearForm</title>
66
<link rel="stylesheet" type="text/css" href="res/css/common.css" />
7+
<!-- saved from url=(0014)about:internet -->
78
<script type="text/javascript" src="res/js/lib/jquery/dist/jquery.min.js"></script>
89
<script type="text/javascript" src="res/js/utilities/jquery.clearForm.js"></script>
910
<script type="text/javascript">
1011
$(document).ready(function() {
1112
var count = 0;
1213
var $messages = $('#messages');
13-
14+
1415
$('#resetForm').click(function(event) {
1516
$(this).closest('form').clearForm({
1617
itemCleared : function(event, ui) {
@@ -22,7 +23,7 @@
2223
});
2324
event.preventDefault();
2425
});
25-
26+
2627
$('#resetFieldset').click(function(event) {
2728
$(this).closest('fieldset').clearForm({
2829
itemCleared : function(event, ui) {
@@ -34,7 +35,7 @@
3435
});
3536
event.preventDefault();
3637
});
37-
38+
3839
$('#emptyMessages').click(function(event) {
3940
$messages.empty();
4041
event.preventDefault();

demos/res/js/utilities/jquery.browser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Browser
3-
* Version: 1.1.6
3+
* Version: 1.1.7
44
* Author: Gray Young
55
*
6-
* Copyright 2014 Released under the MIT license.
6+
* Copyright 2016 Released under the MIT license.
77
*/
88

99
(function(factory) {

demos/res/js/utilities/jquery.clearForm.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Clear Form
3-
* Version: 1.1.6
3+
* Version: 1.1.7
44
* Author: Gray Young
55
*
6-
* Copyright 2014 Released under the MIT license.
6+
* Copyright 2016 Released under the MIT license.
77
*/
88

99
(function(factory) {
@@ -21,7 +21,7 @@
2121
textGroup : [ 'input', 'textarea' ],
2222
unitGroup : [ 'radio', 'checkbox' ],
2323
listGroup : [ 'select' ],
24-
excludeType : [ 'button', 'submit', 'reset' ]
24+
excludeType : [ 'button', 'image', 'submit', 'reset' ]
2525
};
2626
var _clearField = function(element) {
2727
var tagName = element.tagName.toLowerCase();
@@ -46,13 +46,11 @@
4646
var event = null, ui = {
4747
item : $(this)
4848
};
49-
50-
if ($.inArray(tagName, _supporType.textGroup) >= 0 || $.inArray(tagName, _supporType.listGroup) >= 0) {
51-
if ($.inArray(this.type, _supporType.excludeType) < 0) {
52-
_clearField(this);
53-
}
49+
50+
if(($.inArray(tagName, _supporType.textGroup) >= 0 || $.inArray(tagName, _supporType.listGroup) >= 0) && $.inArray(this.type, _supporType.excludeType) < 0) {
51+
_clearField(this);
5452
} else {
55-
$(':input:not(:button, :submit, :reset)', this).each(function() {
53+
$(':input:not(:' + _supporType.excludeType.join(', :') + ')', this).each(function() {
5654
_clearField(this);
5755
});
5856
if ($.type(opts.cleared) == 'function') {

dist/jquery.browser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Browser
3-
* Version: 1.1.6
3+
* Version: 1.1.7
44
* Author: Gray Young
55
*
6-
* Copyright 2014 Released under the MIT license.
6+
* Copyright 2016 Released under the MIT license.
77
*/
88

99
(function(factory) {

dist/jquery.browser.min.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Browser
3-
* Version: 1.1.6
3+
* Version: 1.1.7
44
* Author: Gray Young
55
*
6-
* Copyright 2014 Released under the MIT license.
6+
* Copyright 2016 Released under the MIT license.
77
*/
88
!function(e){"function"==typeof define&&define.amd?// AMD. Register as an anonymous module.
99
define(["jquery"],e):// Browser globals

dist/jquery.clearForm.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Clear Form
3-
* Version: 1.1.6
3+
* Version: 1.1.7
44
* Author: Gray Young
55
*
6-
* Copyright 2014 Released under the MIT license.
6+
* Copyright 2016 Released under the MIT license.
77
*/
88

99
(function(factory) {
@@ -21,7 +21,7 @@
2121
textGroup : [ 'input', 'textarea' ],
2222
unitGroup : [ 'radio', 'checkbox' ],
2323
listGroup : [ 'select' ],
24-
excludeType : [ 'button', 'submit', 'reset' ]
24+
excludeType : [ 'button', 'image', 'submit', 'reset' ]
2525
};
2626
var _clearField = function(element) {
2727
var tagName = element.tagName.toLowerCase();
@@ -46,13 +46,11 @@
4646
var event = null, ui = {
4747
item : $(this)
4848
};
49-
50-
if ($.inArray(tagName, _supporType.textGroup) >= 0 || $.inArray(tagName, _supporType.listGroup) >= 0) {
51-
if ($.inArray(this.type, _supporType.excludeType) < 0) {
52-
_clearField(this);
53-
}
49+
50+
if(($.inArray(tagName, _supporType.textGroup) >= 0 || $.inArray(tagName, _supporType.listGroup) >= 0) && $.inArray(this.type, _supporType.excludeType) < 0) {
51+
_clearField(this);
5452
} else {
55-
$(':input:not(:button, :submit, :reset)', this).each(function() {
53+
$(':input:not(:' + _supporType.excludeType.join(', :') + ')', this).each(function() {
5654
_clearField(this);
5755
});
5856
if ($.type(opts.cleared) == 'function') {

dist/jquery.clearForm.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"gulp-load-plugins": "latest",
1818
"gulp-minify-css": "latest",
1919
"gulp-rename" : "latest",
20-
"gulp-sass": "<1.0.0",
20+
"gulp-sass": "latest",
2121
"gulp-size": "latest",
2222
"gulp-uglify": "latest",
2323
"jshint-stylish" : "latest"

0 commit comments

Comments
 (0)