本文整理汇总了C#中IDomObject.SetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IDomObject.SetAttribute方法的具体用法?C# IDomObject.SetAttribute怎么用?C# IDomObject.SetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDomObject
的用法示例。
在下文中一共展示了IDomObject.SetAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateJavascriptPath
private bool UpdateJavascriptPath(bool foundFirstScript, IDomObject element)
{
if (foundFirstScript == false)
{
element.SetAttribute("src", Globals.FullPath(_scriptBundle.Path));
}
else
{
//Just make this local, cost of removing from dom is expensive
element.RemoveAttribute("src");
//element.Remove();
}
return true;
}
示例2: PrepareAttribute
private static void PrepareAttribute(IDomObject domElement, AttributeToCss attributeToCss)
{
string name = attributeToCss.AttributeName;
string value = attributeToCss.CssValue;
//When rendering images, we need to prevent breaking the WIDTH and HEIGHT attributes. See PreMailerTests.MoveCssInline_HasStyle_DoesNotBreakImageWidthAttribute().
//The old code could end up writing an image tag like <img width="206px"> which violates the HTML spec. It should render <img width="206">.
if (domElement.NodeName == @"IMG"
&& (name == "width" || name == "height")
&& value.EndsWith("px"))
{
value = value.Replace("px", string.Empty);
}
domElement.SetAttribute(name, value);
}
示例3: UpdateCssPath
private bool UpdateCssPath(bool foundFirstCss, IDomObject element)
{
if (foundFirstCss == false)
{
element.SetAttribute("href", Globals.FullPath(_styleBundle.Path));
}
else
{
element.Remove();
}
return true;
}