Open kael opened 1 year ago
That would be nice, but I don't think it is possible with the way streaming parsing works. In order to know if an element has some child element, it has to keep track of the parent element while continuing to parse until the child element. However, by that time, the parent element can no longer be changed, making it rather less useful.
It'd be nice if HTMLRewriter supported the CSS
:has()
pseudo-class selector.In my case I'd like to use it for selecting elements which have a child element with specific attributes. For now I need to parse the whole XML tree and then filter upon the array result to check if attributes are there.