mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
WebHitTestResult: Expect null href attribute
Patch by Eugene Shalygin BUG: 404320
This commit is contained in:
parent
8ffd2f20df
commit
b508ed2260
@ -48,6 +48,9 @@ WebHitTestResult::WebHitTestResult(const WebPage *page, const QPoint &pos)
|
||||
" return false;"
|
||||
" return window.getSelection().containsNode(e, true);"
|
||||
"}"
|
||||
"function attributeStr(e, a) {"
|
||||
" return e.getAttribute(a) || '';"
|
||||
"}"
|
||||
"var res = {"
|
||||
" baseUrl: document.baseURI,"
|
||||
" alternateText: e.getAttribute('alt'),"
|
||||
@ -63,16 +66,16 @@ WebHitTestResult::WebHitTestResult(const WebPage *page, const QPoint &pos)
|
||||
"var r = e.getBoundingClientRect();"
|
||||
"res.boundingRect = [r.top, r.left, r.width, r.height];"
|
||||
"if (e.tagName.toLowerCase() == 'img')"
|
||||
" res.imageUrl = e.getAttribute('src').trim();"
|
||||
" res.imageUrl = attributeStr(e, 'src').trim();"
|
||||
"if (e.tagName.toLowerCase() == 'a') {"
|
||||
" res.linkTitle = e.text;"
|
||||
" res.linkUrl = e.getAttribute('href').trim();"
|
||||
" res.linkUrl = attributeStr(e, 'href').trim();"
|
||||
"}"
|
||||
"while (e) {"
|
||||
" if (res.linkTitle == '' && e.tagName.toLowerCase() == 'a')"
|
||||
" res.linkTitle = e.text;"
|
||||
" if (res.linkUrl == '' && e.tagName.toLowerCase() == 'a')"
|
||||
" res.linkUrl = e.getAttribute('href').trim();"
|
||||
" res.linkUrl = attributeStr(e, 'href').trim();"
|
||||
" if (res.mediaUrl == '' && isMediaElement(e)) {"
|
||||
" res.mediaUrl = e.currentSrc;"
|
||||
" res.mediaPaused = e.paused;"
|
||||
|
Loading…
Reference in New Issue
Block a user