问题
How can manipulate the DOM tree in webkit2gtk-4.0?
Old version:
WebKit.DOM.Document doc = get_dom_document();
WebKit.DOM.Element el = doc.create_element("div");
el.append_child(doc.create_text_node(color));
((WebKit.DOM.EventTarget) el).add_event_listener("dblclick", (Callback) on_div_clicked, false, this);
doc.body.insert_before(el, null);
compile:
valac --pkg gtk+-3.0 --pkg libsoup-2.4 --pkg webkitgtk-3.0
New version compile:
valac --pkg gtk+-3.0 --pkg webkit2gtk-4.0
error:
error: The symbol `DOM' could not be found
private WebKit.DOM.Document get_document()
http://www.valadoc.org/#!api=webkit2gtk-web-extension-4.0/WebKit.DOM.Document How to add webkit2gtk-web-extension-4.0 ?
回答1:
Add --pkg webkit2gtk-web-extension-4.0
to your compile flags.
来源:https://stackoverflow.com/questions/36821199/vala-webkit-webview-dom-manipulation