lol-html icon indicating copy to clipboard operation
lol-html copied to clipboard

Generating selector from document and element

Open toinbis opened this issue 5 years ago • 4 comments
trafficstars

Hi,

would it be possible in any ways to generate selector itselfusing lol-html? The input would be: a) the document that will be processed by HTMLRewriter in a worker later on; b) the element that needs to be selected (as generated by 'click' document event listener);

Output needed would be the (most effective) selector to be used to select this element on worker's execution.

Thanks!

P.S. am not familiar with internals of lol-html, it's a bit of a long-shot question. Thanks in advance for looking into it and replying.

toinbis avatar May 07 '20 17:05 toinbis

Hi @toinbis,

You could use the lol-html Rust library to make a selector generator, but that functionality doesn't exist out-of-the-box today. What is your use-case for generating selectors in Workers?

Electroid avatar Jun 11 '20 14:06 Electroid

Hi @Electroid - thanks a lot for responding!

Our app allows users to to load their web page in an 'visual editor', make modifications and have those modifications applied on runtime with worker. We provide a worker and the 'visual page editor', clients create the 'transformations' themselves.

Using same codebase for generating selectors and actually selecting elements on runtime seems a wise way to go...

toinbis avatar Jun 11 '20 20:06 toinbis

Hi @Electroid ,

maybe you could write a few guidelines on how to achieve this? We would probably try to find a rust developer to try to work on this...

Much appreciated in advance!

toinbis avatar Aug 10 '20 19:08 toinbis

I'm also interested in generating selectors, @toinbis did you finally get it?

aralroca avatar Jan 28 '24 00:01 aralroca