* SUMMARY Adopt ES6 Class Syntax for all View Objects. Some view constructors (I'm looking at you, ContentView) follow an implicit factory pattern whereby the base class constructor returns a concrete type based on the represented object. We should make the factory pattern explicit using a static class method: class ContentView { static create(representedObject) { if (typeof representedObject === "string" || representedObject instanceof String) return new WebInspector.TextContentView(representedObject); // And so on... console.assert(!WebInspector.ContentView.isViewable(representedObject)); throw "Can't make a ContentView for an unknown representedObject."; } } * NOTES The const keyword isn't allowed in strict mode, and ES6 class method scope uses strict mode implicitly. Instances of const will need to be replaced with var.
<rdar://problem/20233935>
Created attachment 249448 [details] WIP
Created attachment 249449 [details] WIP (Ignore Space)
Created attachment 249557 [details] WIP Latest WIP after landing some of the working classes.