Example #1
0
        /// <inheritdoc />
        public string GetAttributeValue(string attributeName)
        {
            if (attributeName.ToLowerInvariant() == "tagname")
            {
                return(TagName);
            }

            object attributeValue;

            try
            {
                attributeValue = GetWithFailOver(() => AsHtmlElement.getAttribute(attributeName, 0));
            }
            catch
            {
                Logger.LogDebug("Getting attribute: {0}", attributeName);
                throw;
            }
            if (DidReturnObjectReference(attributeValue))
            {
                attributeValue = RetrieveNodeValue(attributeName);
            }

            if (attributeValue == DBNull.Value || attributeValue == null)
            {
                return(null);
            }

            return(attributeValue.ToString());
        }
Example #2
0
        /// <inheritdoc />
        public string GetAttributeValue(string attributeName)
        {
            if (attributeName.ToLowerInvariant() == "tagname")
            {
                return(TagName);
            }

            object attributeValue;

            try
            {
                if (JSElement.UsePropertyInsteadOfAttribute.Contains(attributeName))
                {
                    attributeValue = GetWithFailOver(() => new Expando(AsHtmlElement).GetValue(attributeName));
                }
                else
                {
                    attributeValue = GetWithFailOver(() => AsHtmlElement.getAttribute(attributeName, 0));
                }
            }
            catch
            {
                Logger.LogDebug("Getting attribute: {0}", attributeName);
                throw;
            }
            if (DidReturnObjectReference(attributeValue))
            {
                attributeValue = RetrieveNodeValue(attributeName);
            }

            if (attributeValue == DBNull.Value || attributeValue == null)
            {
                return(null);
            }

            var value = attributeValue.ToString();

            if (attributeName.ToLowerInvariant() == "selected")
            {
                if (value.ToLowerInvariant() == "selected")
                {
                    value = "True";
                }
            }

            return(value);
        }
Example #3
0
        /// <inheritdoc />
        public string GetAttributeValue(string attributeName)
        {
            if (attributeName.ToLowerInvariant() == "tagname")
            {
                return(TagName);
            }

            var attributeValue = AsHtmlElement.getAttribute(attributeName, 0);

            if (DidReturnObjectReference(attributeValue))
            {
                attributeValue = RetrieveNodeValue(attributeName);
            }

            if (attributeValue == DBNull.Value || attributeValue == null)
            {
                return(null);
            }

            return(attributeValue.ToString());
        }
Example #4
0
        /// <inheritdoc />
        public void SetAttributeValue(string attributeName, string value)
        {
            value = HandleAttributesWhichHaveNoValuePart(attributeName, value);

            AsHtmlElement.setAttribute(attributeName, value, 0);
        }