Open Bug 1842180 Opened 11 months ago Updated 11 months ago

Display ::first-line and ::first-letter in DOM tree

Categories

(DevTools :: Inspector, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: sebo, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

The ::first-line and ::first-letter pseudo-elements allow to style the first line or the first letter of an inline element.

As they somewhat interact with the DOM tree, they should be shown within the Inspector view like other pseudo-elements or the shadow DOM.

There are two main differences to other pseudo-elements, though:

  1. Their contents change dynamically based on the size of their originating element.
  2. They may span over parts of elements within their originating element.

Sebastian

Blocks: 1842181

Thanks Sebo for reporting.

Do you have a specific scenario where this would be useful?

We currently have in the rule view displayed under "Pseudo-elements", though this is collapsed by default. Would expanding this help in this situation?

Is there any major reasons for showing this in the markup view.

Thanks

Flags: needinfo?(sebastianzartner)

I know they are displayed within the Pseudo-elements pane. And as far as I know, the expansion state of that pane is preserved across switching elements and even browser sessions. So that's ok, though it still somewhat hides them away.

The main use case for this is similar to the one other pseudo-elements like ::before, ::after or ::marker are displayed within markup view. It makes it more obvious that those are applied to an element, it allows to inspect and edit them separately from their originating element and it provides a way to see where they are placed in the markup view.

Btw. ::highlight could also benefit from that for the same reasons, and I am sure there are others, as well.

Sebastian

Flags: needinfo?(sebastianzartner)

For what it's worth, here's a mockup for how I imagine this feature to be displayed in the markup view.

Like for real elements, clicking the item marked as "(end)" would select the start item instead.
With that item selected, the Rules and Computed view (and maybe other side panels) would only show info related to the pseudo-element, like it's done for tree-abiding pseudo-elements.

Sebastian

Thanks for the mockup Sebo. I can see how first-::line case would be useful.
Instinctively, I'm afraid this would clutter the markup view (if we want to support all pseudo element), especially with the elements that will come from view transition, but maybe it would help to see everything.

Yep, at some point the pseudo-elements clutter the markup view. So maybe the ones like ::first-line, ::highlight, etc. that are highly dynamic should be hidden behind an option.

Sebastian

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: