本文整理汇总了C#中CsQuery.CQ.AppendTo方法的典型用法代码示例。如果您正苦于以下问题:C# CQ.AppendTo方法的具体用法?C# CQ.AppendTo怎么用?C# CQ.AppendTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsQuery.CQ
的用法示例。
在下文中一共展示了CQ.AppendTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TypeTests
public void TypeTests()
{
ResetQunit();
// Type
var type = jQuery("#check2").Attr("type");
var thrown = false;
try
{
jQuery("#check2").Attr("type", "hidden");
}
catch
{
thrown = true;
}
Assert.IsTrue(thrown, "Exception thrown when trying to change type property");
Assert.AreEqual(type, jQuery("#check2").Attr("type"), "Verify that you can't change the type of an input element");
var check = document.CreateElement("input");
thrown = true;
try
{
jQuery(check).Attr("type", "checkbox");
}
catch
{
thrown = false;
}
Assert.IsTrue(thrown, "Exception thrown when trying to change type property");
Assert.AreEqual("checkbox", jQuery(check).Attr("type"), "Verify that you can change the type of an input element that isn't in the DOM");
ResetQunit();
var jcheck = jQuery("<input />");
thrown = false;
try
{
jcheck.Attr("type", "checkbox");
}
catch
{
thrown = true;
}
Assert.IsFalse(thrown, "No exception thrown when trying to change type property");
Assert.AreEqual("checkbox", jcheck.Attr("type"), "Verify that you can change the type of an input element that isn't in the DOM");
var button = jQuery("#button");
thrown = false;
try
{
button.Attr("type", "submit");
}
catch
{
thrown = true;
}
Assert.IsTrue(thrown, "Exception thrown when trying to change type property");
Assert.AreEqual("button", button.Attr("type"), "Verify that you can't change the type of a button element");
var jradio = new CQ("<input>", "{ 'value': 'sup', 'type': 'radio' }", Dom);
jradio = jradio.AppendTo("#testForm");
Assert.AreEqual(jradio.Val(), "sup", "Value is not reset when type is set after value on a radio");
// Setting attributes on svg elements (bug #3116)
var jsvg = jQuery("<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' baseProfile='full' width='200' height='200'>"
+ "<circle cx='200' cy='200' r='150' />"
+ "</svg>").AppendTo("body");
Assert.AreEqual(jsvg.Attr("cx", 100).Attr("cx"), "100", "Set attribute on svg element");
jsvg.Remove();
}