public static bool SatisfiesTagName(string tagNameWithoutPrefix, TagMatchingRuleDescriptor rule) { if (tagNameWithoutPrefix == null) { throw new ArgumentNullException(nameof(tagNameWithoutPrefix)); } if (rule == null) { throw new ArgumentNullException(nameof(rule)); } if (string.IsNullOrEmpty(tagNameWithoutPrefix)) { return(false); } if (tagNameWithoutPrefix[0] == ElementOptOutCharacter) { // TagHelpers can never satisfy tag names that are prefixed with the opt-out character. return(false); } if (rule.TagName != ElementCatchAllName && rule.TagName != null && !string.Equals(tagNameWithoutPrefix, rule.TagName, StringComparison.OrdinalIgnoreCase)) { return(false); } return(true); }
public static bool SatisfiesRule( StringSegment tagNameWithoutPrefix, StringSegment parentTagNameWithoutPrefix, IReadOnlyList <KeyValuePair <string, string> > tagAttributes, TagMatchingRuleDescriptor rule) { var satisfiesTagName = SatisfiesTagName(tagNameWithoutPrefix, rule); if (!satisfiesTagName) { return(false); } var satisfiesParentTag = SatisfiesParentTag(parentTagNameWithoutPrefix, rule); if (!satisfiesParentTag) { return(false); } var satisfiesAttributes = SatisfiesAttributes(tagAttributes, rule); if (!satisfiesAttributes) { return(false); } return(true); }
public static bool SatisfiesParentTag(string parentTagNameWithoutPrefix, TagMatchingRuleDescriptor rule) { if (rule == null) { throw new ArgumentNullException(nameof(rule)); } if (rule.ParentTag != null && !string.Equals(parentTagNameWithoutPrefix, rule.ParentTag, StringComparison.OrdinalIgnoreCase)) { return(false); } return(true); }
public static bool SatisfiesRule( string tagNameWithoutPrefix, string parentTagNameWithoutPrefix, IEnumerable <KeyValuePair <string, string> > tagAttributes, TagMatchingRuleDescriptor rule) { if (tagNameWithoutPrefix == null) { throw new ArgumentNullException(nameof(tagNameWithoutPrefix)); } if (tagAttributes == null) { throw new ArgumentNullException(nameof(tagAttributes)); } if (rule == null) { throw new ArgumentNullException(nameof(rule)); } var satisfiesTagName = SatisfiesTagName(tagNameWithoutPrefix, rule); if (!satisfiesTagName) { return(false); } var satisfiesParentTag = SatisfiesParentTag(parentTagNameWithoutPrefix, rule); if (!satisfiesParentTag) { return(false); } var satisfiesAttributes = SatisfiesAttributes(tagAttributes, rule); if (!satisfiesAttributes) { return(false); } return(true); }
public static bool SatisfiesTagName(StringSegment tagNameWithoutPrefix, TagMatchingRuleDescriptor rule) { if (StringSegment.IsNullOrEmpty(tagNameWithoutPrefix)) { return(false); } if (tagNameWithoutPrefix[0] == ElementOptOutCharacter) { // TagHelpers can never satisfy tag names that are prefixed with the opt-out character. return(false); } if (rule.TagName != ElementCatchAllName && rule.TagName != null && !tagNameWithoutPrefix.Equals(rule.TagName, rule.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase)) { return(false); } return(true); }
public static bool SatisfiesAttributes(IEnumerable <KeyValuePair <string, string> > tagAttributes, TagMatchingRuleDescriptor rule) { if (tagAttributes == null) { throw new ArgumentNullException(nameof(tagAttributes)); } if (rule == null) { throw new ArgumentNullException(nameof(rule)); } if (!rule.Attributes.All( requiredAttribute => tagAttributes.Any( attribute => SatisfiesRequiredAttribute(attribute.Key, attribute.Value, requiredAttribute)))) { return(false); } return(true); }
public static bool SatisfiesAttributes(IReadOnlyList <KeyValuePair <string, string> > tagAttributes, TagMatchingRuleDescriptor rule) { if (!rule.Attributes.All(
public static bool SatisfiesParentTag(StringSegment parentTagNameWithoutPrefix, TagMatchingRuleDescriptor rule) { if (rule.ParentTag != null && !parentTagNameWithoutPrefix.Equals(rule.ParentTag, rule.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase)) { return(false); } return(true); }
public static bool SatisfiesAttributes(IReadOnlyList <KeyValuePair <string, string> > tagAttributes, TagMatchingRuleDescriptor rule) { if (tagAttributes == null) { throw new ArgumentNullException(nameof(tagAttributes)); } if (rule == null) { throw new ArgumentNullException(nameof(rule)); } if (!rule.Attributes.All(