本文整理汇总了C#中ElementNode.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# ElementNode.GetAttribute方法的具体用法?C# ElementNode.GetAttribute怎么用?C# ElementNode.GetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElementNode
的用法示例。
在下文中一共展示了ElementNode.GetAttribute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryCreateSmartTag
public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
{
AttributeNode attr = element.GetAttribute("src") ?? element.GetAttribute("href");
if (attr == null)
return null;
Uri url = NormalizeUrl(attr);
if (url == null || (!attr.Value.StartsWith("//", StringComparison.Ordinal) && !attr.Value.Contains("://")))
return null;
return new RemoteDownloaderSmartTag(textView, textBuffer, element, attr);
}
示例2: IsEnabled
private static bool IsEnabled(ElementNode element)
{
if (element.Name != "img")
return false;
return element.GetAttribute("src", true) != null;
}
示例3: TryCreateSmartTag
public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
{
if (element.GetAttribute("ng-controller") != null)
{
return new HtmlAngularControllerSmartTag(textView, textBuffer, element);
}
return null;
}
示例4: TryCreateSmartTag
public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
{
if (element.GetAttribute("class") == null)
{
return new $safeitemname$SmartTag(textView, textBuffer, element);
}
return null;
}
示例5: Visit
public bool Visit(ElementNode element, object parameter)
{
if (_inputTypes.Contains(element.Name.ToLowerInvariant()))
{
var list = (List<string>)parameter;
var id = element.GetAttribute("id");
if (id != null && !list.Contains(id.Value))
list.Add(id.Value);
}
return true;
}
示例6: Visit
public bool Visit(ElementNode element, object parameter)
{
if (element.Name == "label")
{
var list = (HashSet<string>)parameter;
var forAttr = element.GetAttribute("for");
if (forAttr != null)
list.Add(forAttr.Value);
}
return true;
}
示例7: IsEnabled
private static bool IsEnabled(ElementNode element)
{
if (element.Name != "img")
return false;
AttributeNode src = element.GetAttribute("src", true);
if (src != null && src.Value.StartsWith("data:image/", StringComparison.Ordinal))
{
return true;
}
return false;
}
示例8: DoReplace
public override void DoReplace(ElementNode node, IList<Node> body)
{
body.Clear();
Node newBody = node.GetAttribute("for").Value.GetPropertyValueNode();
body.Add(newBody);
}
示例9: DoReplace
public override void DoReplace(ElementNode node, IList<Node> body)
{
AttributeNode forAttribute = node.GetAttribute(ReplacementSpecification.OriginalAttributeName);
AddAttribute(node, "name", new ExpressionNode(forAttribute.Value.GetPropertyNameSnippet()));
}