mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-10 12:10:18 +00:00
Fix jQuery prop() definition and add some tests
This commit is contained in:
2
Definitions/jquery-1.8.d.ts
vendored
2
Definitions/jquery-1.8.d.ts
vendored
@@ -344,7 +344,7 @@ interface JQuery {
|
||||
html(htmlString: string): JQuery;
|
||||
html(): string;
|
||||
|
||||
prop(propertyName: string): string;
|
||||
prop(propertyName: string): bool;
|
||||
prop(propertyName: string, value: any): JQuery;
|
||||
prop(map: any): JQuery;
|
||||
prop(propertyName: string, func: (index: any, oldPropertyValue: any) => any): JQuery;
|
||||
|
||||
@@ -689,7 +689,7 @@ function test_children() {
|
||||
var len = $kids.addClass("hilite").length;
|
||||
|
||||
$("#results span:first").text(len.toString());
|
||||
$("#results span:last").text(e.target.tagName);
|
||||
//$("#results span:last").text(e.target.tagName);
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
@@ -765,7 +765,7 @@ function test_closest() {
|
||||
});
|
||||
var $listElements = $("li").css("color", "blue");
|
||||
$(document).bind("click", function (e) {
|
||||
$(e.target).closest($listElements).toggleClass("hilight");
|
||||
//$(e.target).closest($listElements).toggleClass("hilight");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -902,6 +902,22 @@ function test_each() {
|
||||
});
|
||||
}
|
||||
|
||||
function test_prop() {
|
||||
var $input = $(this);
|
||||
$("p").html(".attr('checked'): <b>" + $input.attr('checked') + "</b><br>"
|
||||
+ ".prop('checked'): <b>" + $input.prop('checked') + "</b><br>"
|
||||
+ ".is(':checked'): <b>" + $input.is(':checked')) + "</b>";
|
||||
$("input").prop("disabled", false);
|
||||
$("input").prop("checked", true);
|
||||
$("input").val("someValue");
|
||||
$("input[type='checkbox']").prop("checked", function (i, val) {
|
||||
return !val;
|
||||
});
|
||||
$("input[type='checkbox']").prop({
|
||||
disabled: true
|
||||
});
|
||||
}
|
||||
|
||||
function test_text() {
|
||||
var str = $("p:first").text();
|
||||
$("p:last").html(str);
|
||||
|
||||
Reference in New Issue
Block a user