Skip to content

Commit f1d0e4b

Browse files
committed
Added placeholder support for textarea tags.
Closes #19
1 parent 1bb96c7 commit f1d0e4b

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

dist/jquery.localize.js

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ http://keith-wood.name/localisation.html
106106
localizeElement = function(elem, key, value) {
107107
if (elem.is('input')) {
108108
localizeInputElement(elem, key, value);
109+
} else if (elem.is('textarea')) {
110+
localizeInputElement(elem, key, value);
109111
} else if (elem.is('img')) {
110112
localizeImageElement(elem, key, value);
111113
} else if (elem.is('optgroup')) {

dist/jquery.localize.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jquery.localize.coffee

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ do ($ = jQuery) ->
8282

8383
localizeElement = (elem, key, value) ->
8484
if elem.is('input') then localizeInputElement(elem, key, value)
85+
else if elem.is('textarea') then localizeInputElement(elem, key, value)
8586
else if elem.is('img') then localizeImageElement(elem, key, value)
8687
else if elem.is('optgroup') then localizeOptgroupElement(elem, key, value)
8788
else unless $.isPlainObject(value) then elem.html(value)

test/localize_test.coffee

+5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ do ($ = jQuery) ->
6060
t.localize("test", @testOpts)
6161
equal t.attr("placeholder"), "input success"
6262

63+
test "textarea tag placeholder substitution", ->
64+
t = localizableTagWithRel("textarea", "test.input", placeholder: "placeholder fail")
65+
t.localize("test", @testOpts)
66+
equal t.attr("placeholder"), "input success"
67+
6368
test "titled input tag value substitution", ->
6469
t = localizableTagWithRel("input", "test.input_as_obj", val: "input_as_obj fail")
6570
t.localize("test", @testOpts)

test/localize_test.js

+8
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@
9292
t.localize("test", this.testOpts);
9393
return equal(t.attr("placeholder"), "input success");
9494
});
95+
test("textarea tag placeholder substitution", function() {
96+
var t;
97+
t = localizableTagWithRel("textarea", "test.input", {
98+
placeholder: "placeholder fail"
99+
});
100+
t.localize("test", this.testOpts);
101+
return equal(t.attr("placeholder"), "input success");
102+
});
95103
test("titled input tag value substitution", function() {
96104
var t;
97105
t = localizableTagWithRel("input", "test.input_as_obj", {

0 commit comments

Comments
 (0)