Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #40310
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2021-07-20 04:06 -0700 |
| References | <n4OdnddWv_ZFp2z9nZ2dnUU7-QPNnZ2d@westnet.com.au> <b6e2d095-aa1d-4e4f-bd51-cef4b0d3c430n@googlegroups.com> |
| Message-ID | <db1af9fb-9614-481f-8eca-e344efc8c0cbn@googlegroups.com> (permalink) |
| Subject | Re: Get ::before value |
| From | Julio Di Egidio <julio@diegidio.name> |
On Sunday, 18 July 2021 at 17:27:26 UTC+2, Michael Haufe (TNO) wrote:
> On Friday, July 16, 2021 at 2:53:08 AM UTC-5, Andrew Poulos wrote:
> > Some content gets generated by CSS and I need to get the "live" value.
> >
> > The element in question has this CSS
> >
> > ::before {
> > counter-increment: num;
> > content: counter(num) ". ";
> > }
> >
> > I tried
> > getComputedStyle(elem, '::before').getPropertyValue('content');
> > and it returns
> > counter(num) ". "
> > and not the "live" value I was expecting (hoping).
> >
> > How can I get the actual text that is displayed?
>
> This is not possible currently. There are hacks that might work
> but with the complexity involved it's probably better to do this with JavaScript.
There are no hacks, there is just no access from JS to the runtime value of those properties.
> There is a new CSS standard in the works `target-counter()` to make this possible in the future:
>
> <https://github.com/w3c/csswg-drafts/issues/5879>
"The target-counter() function does exactly this in CSS, not JS", i.e. same as above.
Julio
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Get ::before value Andrew Poulos <ap_prog@hotmail.com> - 2021-07-16 17:52 +1000
Re: Get ::before value Julio Di Egidio <julio@diegidio.name> - 2021-07-16 07:43 -0700
Re: Get ::before value Andrew Poulos <ap_prog@hotmail.com> - 2021-07-17 09:15 +1000
Re: Get ::before value Andrew Poulos <ap_prog@hotmail.com> - 2021-07-17 11:36 +1000
Re: Get ::before value Julio Di Egidio <julio@diegidio.name> - 2021-07-17 05:29 -0700
Re: Get ::before value Julio Di Egidio <julio@diegidio.name> - 2021-07-21 07:14 -0700
Re: Get ::before value "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-07-18 08:27 -0700
Re: Get ::before value Julio Di Egidio <julio@diegidio.name> - 2021-07-20 04:06 -0700
Re: Get ::before value "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-07-20 08:11 -0700
Re: Get ::before value Julio Di Egidio <julio@diegidio.name> - 2021-07-21 07:29 -0700
csiph-web