Bug 162165 - Web Inspector: Make it easier to create a view from an existing DOM element
Summary: Web Inspector: Make it easier to create a view from an existing DOM element
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-09-19 10:08 PDT by Matt Baker
Modified: 2016-09-19 11:49 PDT (History)
7 users (show)

See Also:


Attachments
Patch (6.50 KB, patch)
2016-09-19 10:24 PDT, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2016-09-19 10:08:46 PDT
Instead of the optional `element` parameter, the View constructor should take an `elementOrIdentifier` which can be an HTMLElement or id attribute value.
Comment 1 Radar WebKit Bug Importer 2016-09-19 10:09:09 PDT
<rdar://problem/28365848>
Comment 2 Matt Baker 2016-09-19 10:24:00 PDT
Created attachment 289236 [details]
Patch
Comment 3 WebKit Commit Bot 2016-09-19 10:55:49 PDT
Comment on attachment 289236 [details]
Patch

Clearing flags on attachment: 289236

Committed r206101: <http://trac.webkit.org/changeset/206101>
Comment 4 WebKit Commit Bot 2016-09-19 10:55:52 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Joseph Pecoraro 2016-09-19 11:35:55 PDT
Comment on attachment 289236 [details]
Patch

This doesn't feel like an improvement to me. Previously we were guaranteed a single type element || null. Now it can be two different types with even less clarity at the call site. Was there a particular driver for this change?
Comment 6 Matt Baker 2016-09-19 11:42:13 PDT
(In reply to comment #5)
> Comment on attachment 289236 [details]
> Patch
> 
> This doesn't feel like an improvement to me. Previously we were guaranteed a
> single type element || null. Now it can be two different types with even
> less clarity at the call site. Was there a particular driver for this change?

It was done as a drive-by simplification why working on another patch. The parameter overloading idiom is used elsewhere, but I'm fine with rolling back if you think its less clear.
Comment 7 Joseph Pecoraro 2016-09-19 11:49:52 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > Comment on attachment 289236 [details]
> > Patch
> > 
> > This doesn't feel like an improvement to me. Previously we were guaranteed a
> > single type element || null. Now it can be two different types with even
> > less clarity at the call site. Was there a particular driver for this change?
> 
> It was done as a drive-by simplification why working on another patch. The
> parameter overloading idiom is used elsewhere, but I'm fine with rolling
> back if you think its less clear.

Yeah, I don't see this as a simplification. We should optimize for making the call site as clear as possible. And this makes it more difficult to read. Specifically, I see this and go "is that an identifier, or a class name?".