Commit 75cec863 authored by Andrea Iacovitti's avatar Andrea Iacovitti

Remove potentially surrounding spaces from href value, as per spec.

If href is null or empty completeURL return the document url and we end up
to request the document itself for a stylesheet or favicon.
parent 010c241d
......@@ -115,10 +115,14 @@ void HTMLLinkElementImpl::parseAttribute(AttributeImpl *attr)
{
switch (attr->id())
{
case ATTR_HREF:
m_url = document()->completeURL(attr->val()->string());
process();
case ATTR_HREF: {
const QString hrefUrl = attr->val()->string().trimmed();
if (!hrefUrl.isEmpty()) {
m_url = document()->completeURL(hrefUrl);
}
process();
break;
}
case ATTR_REL:
case ATTR_TYPE:
process();
......@@ -181,11 +185,10 @@ void HTMLLinkElementImpl::process()
// IE extension: location of small icon for locationbar / bookmarks
// Uses both "shortcut icon" and "icon"
if ( part && rel.contains("icon") && !m_url.isEmpty() && !part->parentPart())
if (rel.contains("icon") && !m_url.isEmpty() && part && !part->parentPart()) {
part->browserExtension()->setIconUrl( KUrl(m_url.string()) );
// Stylesheet
else if (!m_isDisabled && rel.contains("stylesheet")) {
} // Stylesheet
else if (rel.contains("stylesheet") && !m_url.isEmpty() && !m_isDisabled) {
// no need to load style sheets which aren't for the screen output
// ### there may be in some situations e.g. for an editor or script to manipulate
khtml::MediaQueryEvaluator allEval(true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment