示例#1
0
        public static void RemoveInlineCssItem(this HtmlNode node, string name)
        {
            if (HasInlineCssWithName(node, name))
            {
                var p = new InlineCssParser(ReadAttributeValue(node, @"style"));
                p.RemoveItem(name);

                var b = node.Attributes.First(
                    a => string.Equals(a.Name, @"style", StringComparison.InvariantCultureIgnoreCase));
                b.Value = p.InlineCss;
            }
        }
        public static void SetInlineCss(this HtmlNode node, string cssPropertyName, string cssPropertyValue)
        {
            var doc = node.OwnerDocument;

            var b =
                node.Attributes.FirstOrDefault(
                    a => string.Equals(a.Name, @"style", StringComparison.InvariantCultureIgnoreCase));
            if (b == null)
            {
                b = doc.CreateAttribute(@"style");
                node.Attributes.Add(b);
            }

            var p = new InlineCssParser(b.Value);
            p.SetValue(cssPropertyName, cssPropertyValue);

            b.Value = p.InlineCss;
        }
示例#3
0
        public static void SetInlineCss(this HtmlNode node, string cssPropertyName, string cssPropertyValue)
        {
            var doc = node.OwnerDocument;

            var b =
                node.Attributes.FirstOrDefault(
                    a => string.Equals(a.Name, @"style", StringComparison.InvariantCultureIgnoreCase));

            if (b == null)
            {
                b = doc.CreateAttribute(@"style");
                node.Attributes.Add(b);
            }

            var p = new InlineCssParser(b.Value);

            p.SetValue(cssPropertyName, cssPropertyValue);

            b.Value = p.InlineCss;
        }
示例#4
0
        public static string ReadInlineCssValue(this HtmlNode node, string name)
        {
            var p = new InlineCssParser(ReadAttributeValue(node, @"style"));

            return(p.GetValue(name));
        }
示例#5
0
        public static bool HasInlineCssWithName(this HtmlNode node, string name)
        {
            var p = new InlineCssParser(ReadAttributeValue(node, @"style"));

            return(p.HasName(name));
        }
        public static void RemoveInlineCssItem(this HtmlNode node, string name)
        {
            if (HasInlineCssWithName(node, name))
            {
                var p = new InlineCssParser(ReadAttributeValue(node, @"style"));
                p.RemoveItem(name);

                var b = node.Attributes.First(
                    a => string.Equals(a.Name, @"style", StringComparison.InvariantCultureIgnoreCase));
                b.Value = p.InlineCss;
            }
        }
 public static string ReadInlineCssValue(this HtmlNode node, string name)
 {
     var p = new InlineCssParser(ReadAttributeValue(node, @"style"));
     return p.GetValue(name);
 }
 public static bool HasInlineCssWithName(this HtmlNode node, string name)
 {
     var p = new InlineCssParser(ReadAttributeValue(node, @"style"));
     return p.HasName(name);
 }