Beispiel #1
0
        private void AddPseudoElement(Selector selector, Declaration declaration, Action <T, string> action)
        {
            IEnumerable <T> selectedNodes;

            try
            {
                selectedNodes = _dom.Select(selector).ToArray();
            }
            catch
            {
                return;
            }

            var    contentProperty = declaration.FirstOrDefault(o => o.Name == "content");
            string content         = null;

            if (contentProperty == null)
            {
                content = String.Empty;
            }
            else
            {
                content = contentProperty.Value.Trim().Trim('\"');
                declaration.Remove("content");
            }
            string html = String.Format("<div style=\"{0}\">{1}</div>", declaration.ToString(), content);

            foreach (var node in selectedNodes)
            {
                action(node, html);
            }
        }