Function: xwidget-webkit-show-named-element
xwidget-webkit-show-named-element is an interactive and byte-compiled
function defined in xwidget.el.gz.
Signature
(xwidget-webkit-show-named-element XW ELEMENT-NAME)
Documentation
Make webkit xwidget XW show a named element ELEMENT-NAME.
For example, use this to display an anchor.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/xwidget.el.gz
(defun xwidget-webkit-show-named-element (xw element-name)
"Make webkit xwidget XW show a named element ELEMENT-NAME.
For example, use this to display an anchor."
(interactive (list (xwidget-webkit-current-session)
(read-string "Element name: "))
xwidget-webkit-mode)
;; TODO: This needs to be interfaced into browse-url somehow. The
;; tricky part is that we need to do this in two steps: A: load the
;; base url, wait for load signal to arrive B: navigate to the
;; anchor when the base url is finished rendering
(xwidget-webkit-execute-script
xw
(format "
(function (query) {
var el = document.getElementsByName(query)[0];
if (el !== undefined) {
window.scrollTo(0, el.offsetTop);
}
})('%s');"
element-name)))