[Webkit-unassigned] [Bug 181790] New: webkit_dom_document_get_element_by_id () and webkit_dom_element_query_selector () unable to find element, but if I traverse DOM tree and match with e.g. _element_get_id() I can find the element
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Jan 18 02:00:09 PST 2018
https://bugs.webkit.org/show_bug.cgi?id=181790
Bug ID: 181790
Summary: webkit_dom_document_get_element_by_id () and
webkit_dom_element_query_selector () unable to find
element, but if I traverse DOM tree and match with
e.g. _element_get_id() I can find the element
Product: WebKit
Version: Other
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebKit Gtk
Assignee: webkit-unassigned at lists.webkit.org
Reporter: eg at gaute.vetsj.com
CC: bugs-noreply at webkitgtk.org
Created attachment 331607
--> https://bugs.webkit.org/attachment.cgi?id=331607&action=review
HTML file
While porting some WebKit1 code to WebKit2 using a web-extension to access the DOM tree I am unable to get DOM-objectes (DIV's) document_element_by_id() or element_query_selector() on the same HTML that previously worked with WebKit1. However, by displaying get_body()->get_inner_html() the sources is there (this is all done after the load signals). Also, traversing the tree using e.g.:
WebKitDOMElement * en;
WebKitDOMHTMLCollection * es = webkit_dom_element_get_children (WEBKIT_DOM_ELEMENT(b));
for (unsigned int i = 0; i < webkit_dom_html_collection_get_length (es); i++) {
WebKitDOMNode * n = webkit_dom_html_collection_item (es, i);
en = WEBKIT_DOM_ELEMENT (n);
if (ustring(webkit_dom_element_get_id (en)) == id) break;
g_object_unref (n);
en = NULL;
}
g_object_unref (es);
g_object_unref (b);
return en;
I can find the element. I also have problems using the element_query_selector(), which is unable to find the element. I have not been able to workaround this using something like:
webkit_dom_element_webkit_matches_selector (WEBKIT_DOM_ELEMENT(n), selector.c_str (), &gerr)
Any ideas on what could be wrong?
HTML is attached.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180118/5d5c99a2/attachment-0001.html>
More information about the webkit-unassigned
mailing list