/// <summary> /// Get the value of a style property for the first element in the set of matched elements, and /// converts to a numeric type T. Any numeric type strings are ignored when converting to numeric /// values. /// </summary> /// /// <typeparam name="T"> /// The type. This should probably be a numeric type, but the method will attempt to convert to /// any IConvertible type passed. /// </typeparam> /// <param name="style"> /// The name of the CSS style to retrieve. /// </param> /// /// <returns> /// A value of type T. /// </returns> /// /// <url> /// http://api.jquery.com/css/#css1 /// </url> public T Css <T>(String style) where T : IConvertible { IDomElement el = FirstElement(); if (el == null) { return(default(T)); } if (Objects.IsNumericType(typeof(T))) { IStringScanner scanner = Scanner.Create(el.Style[style] ?? ""); T num; if (scanner.TryGetNumber <T>(out num)) { return(num); } else { return(default(T)); } } else { return((T)Objects.ChangeType(el.Style[style] ?? "", typeof(T))); } }