JsonFx.BuildTools.HtmlDistiller.HtmlDistiller.ParseAttributeValue C# (CSharp) Method

ParseAttributeValue() private method

private ParseAttributeValue ( ) : object
return object
        private object ParseAttributeValue()
        {
            this.SkipWhiteSpace();

            char ch = this.Current;
            if (ch != AttrDelimChar)
            {
                return String.Empty;
            }

            this.EmptyBuffer(1);
            this.SkipWhiteSpace();

            char quot = this.Current;
            bool isQuoted =
                (quot == SingleQuoteChar) ||
                (quot == DoubleQuoteChar);

            HtmlTag tag;
            if (isQuoted)
            {
                // consume open quote
                this.EmptyBuffer(1);

                // parse for inline script and data binding expressions
                tag = this.ParseBlocks();

                while (!this.IsEOF)
                {
                    ch = this.Current;

                    if ((ch == quot) ||
                        (ch == CloseTagChar) ||
                        (ch == OpenTagChar))
                    {
                        break;
                    }

                    // add to attribute value
                    this.Advance();
                }
            }
            else
            {
                // parse for common inline script
                tag = this.ParseBlocks();

                while (!this.IsEOF)
                {
                    ch = this.Current;

                    if ((ch == CloseTagChar) ||
                        (ch == OpenTagChar) ||
                        (Char.IsWhiteSpace(ch)))
                    {
                        break;
                    }

                    // add to attribute value
                    this.Advance();
                }
            }

            string value = this.FlushBuffer();
            if (isQuoted && this.Current == quot)
            {
                // consume close quote
                this.EmptyBuffer(1);
            }

            if (tag != null)
            {
                return tag;
            }

            return value;
        }