示例#1
0
        internal static GeckoNode CreateWrapper(nsIDOMNode domObject)
        {
            if (domObject == null)
            {
                return(null);
            }

            nsIDOMHTMLElement element = Xpcom.QueryInterface <nsIDOMHTMLElement>(domObject);

            if (element != null)
            {
                return(GeckoElement.Create(element));
            }

            nsIDOMAttr attr = Xpcom.QueryInterface <nsIDOMAttr>(domObject);

            if (attr != null)
            {
                return(GeckoAttribute.Create(attr));
            }

            nsIDOMComment comment = domObject as nsIDOMComment;

            if (comment != null)
            {
                return(GeckoComment.Create(comment));
            }

            return(new GeckoNode(domObject));
        }
        public GeckoAttribute CreateAttribute(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("name");
            }

            return(GeckoAttribute.Create(DomDocument.CreateAttribute(new nsAString(name))));
        }
        public GeckoAttribute CreateAttribute(string namespaceUri, string qualifiedName)
        {
            if (string.IsNullOrEmpty(namespaceUri))
            {
                throw new ArgumentException("namespaceUri");
            }
            if (string.IsNullOrEmpty(qualifiedName))
            {
                throw new ArgumentException("qualifiedName");
            }

            return(GeckoAttribute.Create(DomDocument.CreateAttributeNS(new nsAString(namespaceUri), new nsAString(qualifiedName))));
        }