Bug 104877 - Web Inspector: need to visually distinguish UA shadow roots
Summary: Web Inspector: need to visually distinguish UA shadow roots
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Web Components Team
URL:
Keywords:
Depends on: 105311
Blocks: 62220
  Show dependency treegraph
 
Reported: 2012-12-12 21:20 PST by Sergey G. Grekhov
Modified: 2014-12-12 13:43 PST (History)
13 users (show)

See Also:


Attachments
Patch (5.05 KB, patch)
2012-12-17 18:43 PST, Shinya Kawanaka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey G. Grekhov 2012-12-12 21:20:09 PST
If Show Shadow DOM option is enabled in the inspector settings it shows ShadowRoots created by UA. For example tags like <video controls>, <datails>, <summary>, <input type="text"> contains build in ShadowRoot objects. Inspector shows them as #shadow-root. Problem is that when user creates Shadow roots they looks in the inspector exactly in the same way (as #shadow-root). It surprise users because they can see in the inspector additional ShadowRoots and treat them like a bug. Request is to show UA-created ShadowRoots in the different way, for example like #webkit-shadow-root
Comment 1 Shinya Kawanaka 2012-12-17 18:43:23 PST
Created attachment 179854 [details]
Patch
Comment 2 WebKit Review Bot 2012-12-17 20:34:46 PST
Comment on attachment 179854 [details]
Patch

Clearing flags on attachment: 179854

Committed r137979: <http://trac.webkit.org/changeset/137979>
Comment 3 WebKit Review Bot 2012-12-17 20:34:49 PST
All reviewed patches have been landed.  Closing bug.
Comment 4 Pavel Feldman 2012-12-17 22:06:49 PST
Comment on attachment 179854 [details]
Patch

I am not a fan of this change since $0.nodeName will not match the value in the elements panel now. We could do #shadow-root (internal) or #shadow-root (user agent) #shadow-root (webkit) instead.
Comment 5 Yury Semikhatsky 2012-12-17 22:13:57 PST
(In reply to comment #4)
> (From update of attachment 179854 [details])
> I am not a fan of this change since $0.nodeName will not match the value in the elements panel now. We could do #shadow-root (internal) or #shadow-root (user agent) #shadow-root (webkit) instead.

Good point, we should pass shadow root origin as a separate property. This way nodeName will match the value in the console and can still show the origin in the Elements panel. Sergey, can you take care of this?
Comment 6 Shinya Kawanaka 2012-12-17 22:45:18 PST
Thanks for taking care of this.
Actually ShadowRoot.nodeName should return '#document-fragment' instead of '#shadow-root' (See Bug 104995).

So if we would like to match nodeName and displayed name, we should show #document-fragment (shadow root) or something, I think. But showing '#shadow-root' might be user friendly...

Can someone choose a good name for displaying #shadow-root and #webkit-shadow-root?
Comment 7 Pavel Feldman 2012-12-17 22:48:12 PST
> Can someone choose a good name for displaying #shadow-root and #webkit-shadow-root?

The point is that we should always display what is in $0.nodeName. So I'd rather have this patch rolled out and fixed on the DOM level.
Comment 8 Shinya Kawanaka 2012-12-17 22:51:45 PST
(In reply to comment #7)
> > Can someone choose a good name for displaying #shadow-root and #webkit-shadow-root?
> 
> The point is that we should always display what is in $0.nodeName. So I'd rather have this patch rolled out and fixed on the DOM level.

Hmm... OK.

I would like to hear Dimitri's thought about how we show ShadowRoot in the elements tab.
Comment 9 Pavel Feldman 2012-12-17 23:01:55 PST
(In reply to comment #8)
> (In reply to comment #7)
> > > Can someone choose a good name for displaying #shadow-root and #webkit-shadow-root?
> > 
> > The point is that we should always display what is in $0.nodeName. So I'd rather have this patch rolled out and fixed on the DOM level.
> 
> Hmm... OK.
> 
> I would like to hear Dimitri's thought about how we show ShadowRoot in the elements tab.

Context for Dimitri: I think inspector should render shadow root titles as:

node.nodeName + " " + (shadowRootType == UserAgentShadowRoot ? "(user agent)" : "")

Today that would be:

#shadow-root (user agent) or
#shadow-root

If you change the nodeName for roots in the future, inspector will update its display name accordingly.
Comment 10 Pavel Feldman 2012-12-17 23:03:15 PST
> Hmm... OK.

Sorry? If you think it is confusing / have an opinion on this one, please speak up.
Comment 11 Shinya Kawanaka 2012-12-18 00:35:07 PST
(In reply to comment #10)
> > Hmm... OK.
> 
> Sorry? If you think it is confusing / have an opinion on this one, please speak up.

As a web developer, I would like to see string 'shadow-root' somewhere. just showing 'document fragment' seems confusing.

So, I would like to see something like this: 
node.nodeName + " " + (shadowRootType == UserAgentShadowRoot ? "(useragent shadow root)" : "(shadow root)")

# Note that ShadowRoot.nodeName should be '#document-fragment'.
Comment 12 Dimitri Glazkov (Google) 2012-12-18 07:47:48 PST
(In reply to comment #11)
> (In reply to comment #10)
> > > Hmm... OK.
> > 
> > Sorry? If you think it is confusing / have an opinion on this one, please speak up.
> 
> As a web developer, I would like to see string 'shadow-root' somewhere. just showing 'document fragment' seems confusing.
> 
> So, I would like to see something like this: 
> node.nodeName + " " + (shadowRootType == UserAgentShadowRoot ? "(useragent shadow root)" : "(shadow root)")
> 
> # Note that ShadowRoot.nodeName should be '#document-fragment'.

I defer to Inspector folks to find the right way to do visualize this.

We do have a bug 104995, where we're showing "#shadow-root" as nodeName today, and that should be fixed soon, switching over to "#document-fragment".

This will make displaying shadow root a bit more challenging, but perhaps it just need to be addressed with proper visualization. For instance, instead of showing nodeName, put some sort of a clickable badge/menu/etc.

This particular change seems ill-fitting either way -- neither showing the current nodeName nor clearly explaining the distinction between UA/author shadow roots very well.
Comment 13 WebKit Review Bot 2012-12-18 08:34:22 PST
Re-opened since this is blocked by bug 105311
Comment 14 Brian Burg 2014-12-12 13:40:58 PST
Closing as invalid, as this bug pertains to the old inspector UI and/or its tests.
Please file a new bug (https://www.webkit.org/new-inspector-bug) if the bug/feature/issue is still relevant to WebKit trunk.