From fca37abf55b1e8b1639c8a885eda99e48d48d28d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 7 Sep 2016 12:31:48 +0200 Subject: [PATCH] QtWebEngine: Implement webelem.classes --- qutebrowser/browser/webengine/webengineelem.py | 3 +-- qutebrowser/javascript/webelem.js | 1 + tests/end2end/features/hints.feature | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/webengine/webengineelem.py b/qutebrowser/browser/webengine/webengineelem.py index 5413713e7..772c73416 100644 --- a/qutebrowser/browser/webengine/webengineelem.py +++ b/qutebrowser/browser/webengine/webengineelem.py @@ -71,8 +71,7 @@ class WebEngineElement(webelem.AbstractWebElement): def classes(self): """Get a list of classes assigned to this element.""" - log.stub() - return [] + return self._js_dict['class_name'].split() def tag_name(self): """Get the tag name of this element. diff --git a/qutebrowser/javascript/webelem.js b/qutebrowser/javascript/webelem.js index bf3d3b8ba..3e38c8adb 100644 --- a/qutebrowser/javascript/webelem.js +++ b/qutebrowser/javascript/webelem.js @@ -36,6 +36,7 @@ window._qutebrowser.webelem = (function() { "text": elem.text, "tag_name": elem.tagName, "outer_xml": elem.outerHTML, + "class_name": elem.className, "rects": [], // Gets filled up later }; diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index 674b692f7..042fc04b2 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -139,7 +139,6 @@ Feature: Using hints # The actual check is already done above Then no crash should happen - @qtwebengine_todo: webelem.classes is not implemented yet Scenario: Hinting with ACE editor When I open data/hints/ace/ace.html And I hint with args "inputs" and follow a