On 2022-01-07 11:59, René wrote: > Hi, > > I'm pretty happy to use the fn in the subject although it's > depreciated. Do you have any sample how to use the JavaScriptCore? > Let's say, I've got the ptr to the JSCContext. Now what?! How do I get > the `document.activeElement`?? Pls note I don't need the whole > solution - just the fn names and / or code snaps I need to take a look > at. Ta
I never used this API directly but you can check the API tests code. For example, the snippet below invokes `getElementByID` on `document`through JSC: https://github.com/WebKit/WebKit/blob/fc75ddbe79df026e3d858beed32d004769b5ec11/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp#L610 GRefPtr<JSCValue> jsDocument = adoptGRef(webkit_frame_get_js_value_for_dom_object(frame, WEBKIT_DOM_OBJECT(document))); GRefPtr<JSCValue> jsInputElement = adoptGRef(jsc_value_object_invoke_method(jsDocument.get(), "getElementById", G_TYPE_STRING, elementID, G_TYPE_NONE)); To get `activeElement`, maybe you could use `jsc_value_object_get_property` instead of `invoke_method`. Cheers, Lauro > > Rene > _______________________________________________ > webkit-gtk mailing list > webkit-gtk@lists.webkit.org > https://lists.webkit.org/mailman/listinfo/webkit-gtk _______________________________________________ webkit-gtk mailing list webkit-gtk@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-gtk