diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index e22e1deff..1a03968ec 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -418,7 +418,7 @@ function test_slideToggle() { $("#aa").click(function () { $("div:not(.still)").slideToggle("slow", function () { var n = parseInt($("span").text(), 10); - $("span").text((n + 1).toString()); + $("span").text(n + 1); }); }); } @@ -763,7 +763,7 @@ function test_children() { var $kids = $(e.target).children(); var len = $kids.addClass("hilite").length; - $("#results span:first").text(len.toString()); + $("#results span:first").text(len); //$("#results span:last").text(e.target.tagName); e.preventDefault(); @@ -2143,13 +2143,13 @@ function test_html() { function test_inArray() { var arr: any[] = [4, "Pete", 8, "John"]; var $spans = $("span"); - $spans.eq(0).text(jQuery.inArray("John", arr).toString()); - $spans.eq(1).text(jQuery.inArray(4, arr).toString()); - $spans.eq(2).text(jQuery.inArray("Karl", arr).toString()); - $spans.eq(3).text(jQuery.inArray("Pete", arr, 2).toString()); + $spans.eq(0).text(jQuery.inArray("John", arr)); + $spans.eq(1).text(jQuery.inArray(4, arr)); + $spans.eq(2).text(jQuery.inArray("Karl", arr)); + $spans.eq(3).text(jQuery.inArray("Pete", arr, 2)); var arr2: number[] = [1, 2, 3, 4]; - $spans.eq(1).text(jQuery.inArray(4, arr2).toString()); + $spans.eq(1).text(jQuery.inArray(4, arr2)); } function test_index() { @@ -2384,7 +2384,7 @@ function test_isFunction() { ]; jQuery.each(objs, function (i) { var isFunc = jQuery.isFunction(objs[i]); - $("span").eq(i).text(isFunc.toString()); + $("span").eq(i).text(isFunc); }); $.isFunction(function () { }); } @@ -2749,7 +2749,7 @@ function test_mouseenter() { var n = 0; $("div.enterleave").mouseenter(function () { $("p:first", this).text("mouse enter"); - $("p:last", this).text((++n).toString()); + $("p:last", this).text(++n); }).mouseleave(function () { $("p:first", this).text("mouse leave"); }); @@ -2767,14 +2767,14 @@ function test_mouseleave() { $("p:first", this).text("mouse over"); }).mouseout(function () { $("p:first", this).text("mouse out"); - $("p:last", this).text((++i).toString()); + $("p:last", this).text(++i); }); var n = 0; $("div.enterleave").mouseenter(function () { $("p:first", this).text("mouse enter"); }).mouseleave(function () { $("p:first", this).text("mouse leave"); - $("p:last", this).text((++n).toString()); + $("p:last", this).text(++n); }); } @@ -2805,7 +2805,7 @@ function test_mouseout() { var i = 0; $("div.overout").mouseout(function () { $("p:first", this).text("mouse out"); - $("p:last", this).text((++i).toString()); + $("p:last", this).text(++i); }).mouseover(function () { $("p:first", this).text("mouse over"); }); @@ -2814,7 +2814,7 @@ function test_mouseout() { $("p:first", this).text("mouse enter"); }).bind("mouseleave", function () { $("p:first", this).text("mouse leave"); - $("p:last", this).text((++n).toString()); + $("p:last", this).text(++n); }); } @@ -2847,7 +2847,7 @@ function test_mouseover() { var i = 0; $("div.overout").mouseover(function () { $("p:first", this).text("mouse over"); - $("p:last", this).text((++i).toString()); + $("p:last", this).text(++i); }).mouseout(function () { $("p:first", this).text("mouse out"); }); diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 67baf90e3..41f0e15f7 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -3086,9 +3086,21 @@ interface JQuery { /** * Set the content of each element in the set of matched elements to the specified text. * - * @param textString A string of text to set as the content of each matched element. + * @param text The text to set as the content of each matched element. */ - text(textString: string): JQuery; + text(text: string): JQuery; + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param text The text to set as the content of each matched element. + */ + text(text: number): JQuery; + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param text The text to set as the content of each matched element. + */ + text(text: boolean): JQuery; /** * Set the content of each element in the set of matched elements to the specified text. *