Commit 9a73cfc5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use getElementById

parent 42888a60
......@@ -73,7 +73,7 @@ void TestWebEngineScrollAddAttachment::handleScrollToAnchor(const QVariant &resu
void TestWebEngineScrollAddAttachment::slotScrollToAttachment()
{
mTestWebEngine->page()->runJavaScript(MessageViewer::WebEngineScript::searchElementPosition(QStringLiteral("#module")), invoke(this, &TestWebEngineScrollAddAttachment::handleScrollToAnchor));
mTestWebEngine->page()->runJavaScript(MessageViewer::WebEngineScript::searchElementPosition(QStringLiteral("module")), invoke(this, &TestWebEngineScrollAddAttachment::handleScrollToAnchor));
}
int main(int argc, char *argv[])
......
......@@ -98,7 +98,7 @@ QString WebEngineScript::findAllAnchorsAndForms()
QString WebEngineScript::searchElementPosition(const QString &elementStr)
{
const QString source = QString::fromLatin1("var element = document.querySelector('%1'); "
const QString source = QString::fromLatin1("var element = document.getElementById('%1'); "
"if (element) { "
" var geometry = element.getBoundingClientRect(); "
" [(geometry.left + window.scrollX), (geometry.top + window.scrollY)]; "
......
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