protected virtual bool HasRelCanonicalPointingToDifferentUrl(IDomElement e, string orginalUrl) { return(e.HasAttribute("rel") && !string.IsNullOrWhiteSpace(e.Attributes["rel"]) && string.Equals(e.Attributes["rel"], "canonical", StringComparison.OrdinalIgnoreCase) && e.HasAttribute("href") && !string.IsNullOrWhiteSpace(e.Attributes["href"]) && !string.Equals(e.Attributes["href"], orginalUrl, StringComparison.OrdinalIgnoreCase)); }
protected virtual bool HasRelCanonicalPointingToDifferentUrl(IDomElement e, string orginalUrl) { return e.HasAttribute("rel") && !string.IsNullOrWhiteSpace(e.Attributes["rel"]) && string.Equals(e.Attributes["rel"], "canonical", StringComparison.OrdinalIgnoreCase) && e.HasAttribute("href") && !string.IsNullOrWhiteSpace(e.Attributes["href"]) && !string.Equals(e.Attributes["href"], orginalUrl, StringComparison.OrdinalIgnoreCase); }
/// <summary> /// Has "rel" canonical pointing To different url /// </summary> /// <param name="element"></param> /// <param name="orginalUrl"></param> /// <returns></returns> protected virtual bool HasRelCanonicalPointingToDifferentUrl(IDomElement element, string orginalUrl) { return(element.HasAttribute(Rel) && !string.IsNullOrWhiteSpace(element.Attributes[Rel]) && string.Equals(element.Attributes[Rel], Canonical, StringComparison.OrdinalIgnoreCase) && element.HasAttribute(Href) && !string.IsNullOrWhiteSpace(element.Attributes[Href]) && !string.Equals(element.Attributes[Href], orginalUrl, StringComparison.OrdinalIgnoreCase)); }
private bool IsValidOGNode(IDomElement elem) { if (!elem.HasAttribute("property")) { return(false); } return(elem.GetAttribute("property").StartsWith("og:")); }
public override MatchResult Match <TDependencyObject, TDependencyProperty>(StyleSheet styleSheet, ref IDomElement <TDependencyObject, TDependencyProperty> domElement, SelectorMatcher[] fragments, ref int currentIndex) { if (!domElement.HasAttribute(PropertyName)) { return(MatchResult.ItemFailed); } var dependencyProperty = domElement.Attributes[PropertyName]; domElement.EnsureAttributeWatcher(dependencyProperty); // just check if it exists - here: is not null if (Value == null) { return(domElement.GetAttributeValue(dependencyProperty) != null ? MatchResult.Success : MatchResult.ItemFailed); } if (Operator == "=") { return(domElement.GetAttributeValue(dependencyProperty)?.ToString() == Value ? MatchResult.Success : MatchResult.ItemFailed); } //else if (Operator == "~=") //{ // var v = domElement.GetAttributeValue(dependencyProperty); // if (v is IEnumerable e) // { // foreach (var item in e) // { // if (item?.ToString() == Value) // { // return MatchResult.Success; // } // } // } // return MatchResult.ItemFailed; //} //else if (Operator == "|=") //{ // var v = domElement.GetAttributeValue(dependencyProperty); // if (v is IEnumerable e) // { // foreach (var item in e) // { // if (item?.ToString() == Value) // { // return MatchResult.Success; // } // } // } // return MatchResult.ItemFailed; //} return(MatchResult.ItemFailed); }
protected virtual bool HasRelNoFollow(IDomElement e) { return _config.IsRespectAnchorRelNoFollowEnabled && (e.HasAttribute("rel") && e.GetAttribute("rel").ToLower().Trim() == "nofollow"); }
private bool HasRelNoFollow(IDomElement e) { return _isRespectAnchorRelNoFollowEnabled && (e.HasAttribute("rel") && e.GetAttribute("rel").ToLower().Trim() == "nofollow"); }
private bool HasRelNoFollow(IDomElement e) { return(_isRespectAnchorRelNoFollowEnabled && (e.HasAttribute("rel") && e.GetAttribute("rel").ToLower().Trim() == "nofollow")); }
protected virtual bool HasRelNoFollow(IDomElement e) { return(_config.IsRespectAnchorRelNoFollowEnabled && (e.HasAttribute("rel") && e.GetAttribute("rel").ToLower().Trim() == "nofollow")); }
/// <summary> /// True, if element has "rel" attribute == "nofollow" /// </summary> /// <param name="element"></param> /// <returns></returns> protected virtual bool HasRelNoFollow(IDomElement element) { return(Config.IsRespectAnchorRelNoFollowEnabled && element.HasAttribute(Rel) && element.GetAttribute(Rel).ToLower().Trim() == NoFollow); }