public override Element namedItem(string name)
        {
            // Get the named item:
            Element ne = base.namedItem(name);

            // If it's type='radio' then build and return a RadioNodeList.
            if (ne.getAttribute("type") == "radio")
            {
                // Create it, populating it at the same time:
                return(new RadioNodeList(this, name));
            }

            return(ne);
        }
示例#2
0
        /// <summary>Removes the given element from any attribute caches. You must check AttributesCached first.</summary>
        public void RemoveCachedElement(Element ele)
        {
            List <string> toRemove = null;

            foreach (KeyValuePair <string, AttributeLookup> kvp in AttributeIndex)
            {
                string          attribute = kvp.Key;
                AttributeLookup lookup    = kvp.Value;

                // Got this attribute?
                string value = ele.getAttribute(attribute);

                if (value == null)
                {
                    continue;
                }

                // Remove it:
                if (lookup.Remove(value, ele))
                {
                    // Remove the lookup too!
                    if (toRemove == null)
                    {
                        toRemove = new List <string>();
                    }

                    toRemove.Add(attribute);
                }
            }

            if (toRemove == null)
            {
                return;
            }

            if (toRemove.Count == AttributeIndex.Count)
            {
                // Remove the whole thing:
                AttributeIndex = null;
                return;
            }

            for (int i = toRemove.Count - 1; i >= 0; i--)
            {
                // Remove from attrib index:
                AttributeIndex.Remove(toRemove[i]);
            }
        }