Skip to content

Commit

Permalink
defaults to text type attribute if no type attribute is present on an…
Browse files Browse the repository at this point in the history
… input
  • Loading branch information
DubFriend committed Nov 10, 2014
1 parent 5400e07 commit 0ef50e3
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 8 deletions.
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ <h1>Repeater</h1>
<form action="echo.php" class="repeater">
<div data-repeater-list="group-a">
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="A"/>

<textarea name="textarea-input">A</textarea>
Expand All @@ -35,6 +37,8 @@ <h1>Repeater</h1>
<input data-repeater-delete type="button" value="Delete"/>
</div>
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="B"/>

<textarea name="textarea-input">B</textarea>
Expand Down
4 changes: 4 additions & 0 deletions issue_examples/jquery_uniform/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<form action="echo.php" class="repeater">
<div data-repeater-list="group-a">
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="A"/>

<textarea name="textarea-input">A</textarea>
Expand All @@ -34,6 +36,8 @@
<input data-repeater-delete type="button" value="Delete"/>
</div>
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="B"/>

<textarea name="textarea-input">B</textarea>
Expand Down
7 changes: 5 additions & 2 deletions jquery.repeater.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// jquery.repeater version 0.1.5
// jquery.repeater version 0.1.6
// https://github.com/DubFriend/jquery.repeater
// (MIT) 09-11-2014
// Brian Detering <[email protected]> (http://www.briandetering.net/)
Expand Down Expand Up @@ -571,7 +571,10 @@ var buildFormInputs = function (fig) {
else if($self.is('textarea')) {
addInputsBasic('textarea', $self);
}
else if($self.is('input[type="text"]')) {
else if(
$self.is('input[type="text"]') ||
$self.is('input') && !$self.attr('type')
) {
addInputsBasic('text', $self);
}
else if($self.is('input[type="password"]')) {
Expand Down
4 changes: 2 additions & 2 deletions jquery.repeater.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery.repeater",
"version": "0.1.5",
"version": "0.1.6",
"description": "repeatable form input interface",
"main": "index.html",
"directories": {
Expand Down
4 changes: 4 additions & 0 deletions repeater.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<form action="echo.php" class="repeater">
<div data-repeater-list="group-a">
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="A"/>

<textarea name="textarea-input">A</textarea>
Expand All @@ -19,6 +21,8 @@
<input data-repeater-delete type="button" value="Delete"/>
</div>
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="B"/>

<textarea name="textarea-input">B</textarea>
Expand Down
2 changes: 1 addition & 1 deletion repeater.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "repeater",
"version": "0.1.5",
"version": "0.1.6",
"title": "Repeater",
"author": {
"name": "Brian Detering",
Expand Down
5 changes: 4 additions & 1 deletion src/jquery.input.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,10 @@ var buildFormInputs = function (fig) {
else if($self.is('textarea')) {
addInputsBasic('textarea', $self);
}
else if($self.is('input[type="text"]')) {
else if(
$self.is('input[type="text"]') ||
$self.is('input') && !$self.attr('type')
) {
addInputsBasic('text', $self);
}
else if($self.is('input[type="password"]')) {
Expand Down
4 changes: 4 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<form action="echo.php" class="repeater">
<div data-repeater-list="group-a">
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="A"/>

<textarea name="textarea-input">A</textarea>
Expand All @@ -32,6 +34,8 @@
<input data-repeater-delete type="button" value="Delete"/>
</div>
<div data-repeater-item>
<input name="untyped-input" value="A"/>

<input type="text" name="text-input" value="B"/>

<textarea name="textarea-input">B</textarea>
Expand Down
1 change: 0 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ QUnit.module('repeater', {
this.$secondRepeater.find('[data-repeater-list]').data(
'repeater-list', 'group-b'
);
// this.$secondRepeater.repeater();
this.$secondRepeaterAddButton = this.$secondRepeater.find('[data-repeater-create]');
}
});
Expand Down

0 comments on commit 0ef50e3

Please sign in to comment.