From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Derek Davies Newsgroups: gmane.emacs.devel Subject: eww/shr "inspector" Date: Fri, 07 Feb 2020 15:47:03 -0500 Message-ID: <87a75udt14.fsf@ddavies.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="86253"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.2.0; emacs 26.3 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 07 21:48:46 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j0AYQ-000ML6-Id for ged-emacs-devel@m.gmane-mx.org; Fri, 07 Feb 2020 21:48:46 +0100 Original-Received: from localhost ([::1]:35112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0AYP-0004rS-LC for ged-emacs-devel@m.gmane-mx.org; Fri, 07 Feb 2020 15:48:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59028) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0AWq-0003CX-72 for emacs-devel@gnu.org; Fri, 07 Feb 2020 15:47:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j0AWo-0006Nj-Er for emacs-devel@gnu.org; Fri, 07 Feb 2020 15:47:07 -0500 Original-Received: from gateway31.websitewelcome.com ([192.185.143.51]:31052) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j0AWo-0006MK-6k for emacs-devel@gnu.org; Fri, 07 Feb 2020 15:47:06 -0500 Original-Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway31.websitewelcome.com (Postfix) with ESMTP id C8C1A139BF8 for ; Fri, 7 Feb 2020 14:47:04 -0600 (CST) Original-Received: from gator4032.hostgator.com ([192.185.4.43]) by cmsmtp with SMTP id 0AWmjpxmxSl8q0AWmjakDO; Fri, 07 Feb 2020 14:47:04 -0600 X-Authority-Reason: nr=8 Original-Received: from c-65-96-169-180.hsd1.ma.comcast.net ([65.96.169.180]:45974 helo=masha.ddavies.net) by gator4032.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1j0AWm-001aWe-EY for emacs-devel@gnu.org; Fri, 07 Feb 2020 14:47:04 -0600 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4032.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - ddavies.net X-BWhitelist: no X-Source-IP: 65.96.169.180 X-Source-L: No X-Exim-ID: 1j0AWm-001aWe-EY X-Source-Sender: c-65-96-169-180.hsd1.ma.comcast.net (masha.ddavies.net) [65.96.169.180]:45974 X-Source-Auth: ddavies@ddavies.net X-Email-Count: 1 X-Source-Cap: ZGRhdmllcztkZGF2aWVzO2dhdG9yNDAzMi5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.143.51 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:244899 Archived-At: Hi, I'm new to this list, have searched, but not found, info on eww/shr functionality for "inspcting". Hi! I'm new to this list, searched, but didn't find existing info. I'm trying to get "inspector" functionality out of (or into) eww/shr. So for any character position in an *eww* buffer one can find the stack of dom references, , leaf to root, that produced the character at the buffer position in question.. I've been hacking on this, but only since I haven't found this functionality in any emacs package. Please let me know if it exists. If not, I'm happy to discuss if and how this might be implemented and implement it. So far, I've got hacks to eww source that attempt to use shr hooks to get the start and end buffer positions of each dom node as shr renders them. This stack of dom references and buffer position pairs can then be queried to provide html/dom information corresponding to what has been rendered at a given buffer position. For instance, display the "path" of html elements, from document root to leaf, responsible for what is rendered at point in the *eww* buffer. Then it's easy to have "jump to start of leaf html element in page source" I see CSS related code in eww/shr in 26.3 and would also like to be able to inspect based on CSS selectors. It would be great to be able to do web dev in eww and have as much of what, say, the Firefox inspector offors, as possible. It would be very nice to not have to duplicate or tamper with eww/shr source code and provide this as a separate package, of course. Thanks in advance for your help and interest in this! Hopefully someone else has already done the work and you can point me to it :) Derek