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?
<rdar://problem/20429964>
I wonder if we could just runtime replace this.element.classList.add, remove, etc. to do the check?
(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.