Bug 143433
| Summary: | Web Inspector: wrap style class names in WebInspector.StyleClass helper | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Brian Burg <burg> |
| Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | graouts, inspector-bugzilla-changes, jonowells, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
Brian Burg
Since we are moving away from long-winded style properties on view constructors, here's an idea. Given the two following approaches:
this.element.classList.add("inline-object-foo")
this.element.classList.add(WebInspector.StyleClass("inline-object-foo"))
The latter supports tooling to check for bogus style names.
* This could be done mostly at compile-time by cross-checking against identifiers in CSS files.
* Alternatively, in engineering builds we could collate a "style class whitelist" similar to localizedStrings.js. At runtime we do a lookup into the whitelist and log an error if a bogus style class is used. In production builds, use sed to remove the unnecessary lookup.
Thoughts?
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/20429964>
Timothy Hatcher
I wonder if we could just runtime replace this.element.classList.add, remove, etc. to do the check?
Brian Burg
(In reply to comment #2)
> I wonder if we could just runtime replace this.element.classList.add,
> remove, etc. to do the check?
Maybe. A benefit of the proposed style which I didn't list: it makes it possible to trivially grep for all style strings in your favorite text editor.
It is definitely kind of wordy. I think once ES6 modules land, we can debate whether and how to shorten WebInspector.Everything.