Beispiel #1
0
        public static bool OnlyTargetsBareSelectors(this ContainerFragment.SelectorSet source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            // TODO: Probably need better handling here for stripping out attribute selectors (wrapped in square brackets) before performing
            // this check since there may be string values which cause false positives if there are any instances of "." or "#" in them
            return(!source.Any(s => s.Value.Contains(".") || s.Value.Contains("#")));
        }
Beispiel #2
0
            public SelectorSetWithSourceFragment(ContainerFragment.SelectorSet selector, ICSSFragment source)
            {
                if (selector == null)
                {
                    throw new ArgumentNullException("selector");
                }
                if (source == null)
                {
                    throw new ArgumentNullException("source");
                }

                Selector = selector;
                Source   = source;
            }
        private CSSFragmentBuilderSelector(string selectors, IEnumerable <ICSSFragmentBuilderComponent> children)
        {
            if (string.IsNullOrWhiteSpace(selectors))
            {
                throw new ArgumentException("Null/blank selectors specified");
            }
            if (children == null)
            {
                throw new ArgumentNullException("children");
            }
            var childrenList = children.ToList();

            if (childrenList.Any(c => c == null))
            {
                throw new ArgumentException("Null reference encountered in children set");
            }

            Selectors = new ContainerFragment.SelectorSet(
                selectors.Split(',').Select(selector => new ContainerFragment.WhiteSpaceNormalisedString(selector))
                );
            Children = childrenList.AsReadOnly();
        }