public static Element GetLink(string url)
{
// Setup initial conditions.
if (!Helper.String.HasValue(url)) return null;
url = url.ToLowerCase().Trim();
// Enumerate the colleciton of items.
foreach (Element link in jQuery.Select("link[type='text/css']").GetElements())
{
ElementAttribute href = link.GetAttributeNode(Html.Href);
if (Script.IsNullOrUndefined(href)) continue;
if (url == href.Value.ToLowerCase().Trim()) return link;
}
// Not Found: check if the CSS file is referenced with a fully-qualified domain.
if (!url.StartsWith("http"))
{
Element link = GetLink(Helper.Url.PrependDomain(url));
if (link != null) return link;
}
// Finish up (Not Found).
return null;
}
#endregion