1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

WebHitTestResult: Trim value of src/href attributes

BUG: 403619
FIXED-IN: 3.1.0
This commit is contained in:
David Rosca 2019-01-26 12:29:18 +01:00
parent 0bb78c8501
commit 6678a98d91
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -63,16 +63,16 @@ WebHitTestResult::WebHitTestResult(const WebPage *page, const QPoint &pos)
"var r = e.getBoundingClientRect();" "var r = e.getBoundingClientRect();"
"res.boundingRect = [r.top, r.left, r.width, r.height];" "res.boundingRect = [r.top, r.left, r.width, r.height];"
"if (e.tagName.toLowerCase() == 'img')" "if (e.tagName.toLowerCase() == 'img')"
" res.imageUrl = e.getAttribute('src');" " res.imageUrl = e.getAttribute('src').trim();"
"if (e.tagName.toLowerCase() == 'a') {" "if (e.tagName.toLowerCase() == 'a') {"
" res.linkTitle = e.text;" " res.linkTitle = e.text;"
" res.linkUrl = e.getAttribute('href');" " res.linkUrl = e.getAttribute('href').trim();"
"}" "}"
"while (e) {" "while (e) {"
" if (res.linkTitle == '' && e.tagName.toLowerCase() == 'a')" " if (res.linkTitle == '' && e.tagName.toLowerCase() == 'a')"
" res.linkTitle = e.text;" " res.linkTitle = e.text;"
" if (res.linkUrl == '' && e.tagName.toLowerCase() == 'a')" " if (res.linkUrl == '' && e.tagName.toLowerCase() == 'a')"
" res.linkUrl = e.getAttribute('href');" " res.linkUrl = e.getAttribute('href').trim();"
" if (res.mediaUrl == '' && isMediaElement(e)) {" " if (res.mediaUrl == '' && isMediaElement(e)) {"
" res.mediaUrl = e.currentSrc;" " res.mediaUrl = e.currentSrc;"
" res.mediaPaused = e.paused;" " res.mediaPaused = e.paused;"