- Issue created by @SirClickALot
- Assigned to mably
- Merge request !13Issue #3468538 by mably, SirClickalot: Flexibility in targeting heading tags β (Merged) created by mably
- π«π·France mably
@SirClickalot could you give a try to this issue's MR and check that it fixes this headings selector regression?
- π¬π§United Kingdom SirClickALot Somerset
@mably, Nice, it fixes it for the first selector I tried (the with the > in it).
However, it does not exempt the heading when using the second version - i.e without the > and I as far as my understanding of selectors goes, the second case should also cover the first?
- π«π·France flocondetoile Lyon
@mably ok with the decodeHtml.
@SirClickalot
However, it does not exempt the heading when using the second version - i.e without the > and I as far as my understanding of selectors goes, the second case should also cover the first?
Yes it should do. Could you check in your console, in debug mode, if the whitespace in the selector not(.is-a-group-title-Yes) h2 is not escaped too ?
- π«π·France mably
@SirClickalot seems to be working as it should on my side...
- π¬π§United Kingdom SirClickALot Somerset
Nope, case two definitely not working, case 1 good as gold.
Nothing reported in JavScript Console. - π«π·France mably
Here is the code that gets the headings:
function initTocObject(element, opts) { const $container = $(opts.container); return { opts, element, $element: $(element), $container, $headings: $(opts.selectors, $container), highlightTimeout: null, scrollToTimeout: null, bodyPaddingTop: 0, highlightOnScroll, scrollTo, scrollListener: undefined, updating: false, }; }
We can see that it's pretty simple, a first line of code gets the container:
const $container = $(opts.container);
opts.container
is the container selector specified in the configuration.And a second line gets the headings using the container as context:
$headings: $(opts.selectors, $container),
It's some pretty basic jQuery here.
- π«π·France flocondetoile Lyon
In fact, the selector :not(.is-a-group-title-Yes) h2 match all h2 inside the container. Because even if the direct parent of the h2 has the class "is-a-group-title-Yes", then the parant of this parent don't have this class, and so the h2 inside this parent is also targeted by the css selector :not(.is-a-group-title-Yes) h2 because there is always a parent (ancestor) of the h2 which dont have this class.
It's a css selector issue here
- π«π·France flocondetoile Lyon
However, it does not exempt the heading when using the second version - i.e without the > and I as far as my understanding of selectors goes, the second case should also cover the first?
In fact no.
- Status changed to Fixed
4 months ago 4:11pm 16 August 2024 Automatically closed - issue fixed for 2 weeks with no activity.
- Issue was unassigned.