by bryanlarsen · 12y ago · 0 comments
the money quote: "We feel the standard is sufficiently advanced, the remaining issues sufficiently small, and the benefit to authors sufficiently great to justify shipping sooner rather than later."
the Shadow DOM is pretty awesome, so I'll agree with the "benefit to authors sufficiently great" part. No comment on the rest.
Given his words were "Whatever API gets shipped will be frozen almost immediately. If you want to suggest name changes, as we brainstormed a bit at the f2f, do so RIGHT NOW or forever hold your peace." ... I'm a proponent of the principle of charity, but I don't know how to read that as anything other than an ultimatum.
Here's how the email fits your definition of an ultimatum:
Demand: that the working group suggest changes to the proposal "RIGHT NOW."
Injury if they don't comply: Google will ship the API anyways and freeze it so the working group can't later change it without breaking compatibility with a major web browser.
There are references in the thread to a f2f that happened a week ago, but this implementation has been evolving for a Long time now. The most vocal respondents only seem to be concerned about the phrasing, and haven't indicated publicly that they have anything technically substantive to add to the discussion anyway.
The message was of the form of an advisement rather than an ultimatum. It is similar to "Hey, everybody, I'm putting these cupcakes out. Get them fast because when they're gone, they're gone." I don't think anybody would hear that and say, "Hey, stop throwing around ultimatums." The "threat" is not a threat — it's a heads-up about something that is going to happen, so that people have a chance to respond adequately.
You can still say that Google was not considerate enough in what they did, but there is definitely a reading of the message that is not an ultimatum.
If the feature is hidden behind a flag, then only developers experimenting with the feature will turn it on an use it, but they will never venture to make a production app since they can't expect their users to also have that flag turned on.
If the flag is shipped in the on position, developers will take that as a sign to start shipping features using it to production.
Tab clarified what he meant in a response:
By the way, I deeply apologize for the confusion revolving around my
use of the term "freeze". That term is used internally (within the
Blink team) to indicate something that's no longer changeable (or at
least is probably too difficult to change) *due to compat pain*. I'm
aware that there are other uses of the term, like "feature freeze",
that imply a much more deliberate *decision* by somebody to stop
making changes.
I forgot about those additional meanings and was intending just the
more popular internal meaning. While I've certainly used that meaning
in public, and have heard other people use it or other relatively
close phrasings, I should have given more thought to the term and used
something less likely to be confusing.And that's only a problem because Google decided to ship it now, RIGHT NOW instead of caring about the standards process and maybe holding off for a little bit.
Nobody dies if Google ships a little bit later.
Markup has a very weak type system (strings and children) which makes building complex UIs more painful than it has to be (this also stands for markup driven toolkits like angular and knockout -- where the equivalent of main() is HTML markup and mostly declarative). Markup isn't a real programming language, and it's very weak compared to a true declarative programming language.
JavaScript however is a real programming language with all of the constructs you need for building extensible systems. For building anything complex (which is where Shadow DOM should shine) you will need to use extensive JS, you will need your Shadow DOM components to expose rich interfaces to JS... At which point, why are you still trying to do mark-up first -- it's something that's more "in your way" than helpful.
I agree that some kind of style scoping construct would be a good addition, and far simpler than ShadowDOM. Simple namespacing would be a good start. It would be a more elegant solution to the kludgy class prefixing that has become common (".my-component-foo", ".my-component-bar", etc.)
- How does ShadowDOM (or Web Components more generally) make your DOM shallower? It's still the same box model. Deeply nested DOM structures are usually the result of engineers who don't understand the box model and so over-decorate their DOMs with more markup than is semantically or functionally necessary. Nothing in ShadowDOM (or, again, Web Components) changes this.
- Are custom elements really more transparent than divs? If "View Source" shows <div><div><div>...</div></div></div>, do you really gain much if it shows <custom-element-you've-never-heard-of-with-unknown-semantics><another-custom-element><and-another>...</etc></etc></etc>? Proponents of Web Components seem to imagine that once you can define your own elements, you'll magically become a better engineer, giving your elements nice, clear semantics and cleanly orthogonal functionality. If people didn't do that with the existing HTML, why will custom elements change them? At least with divs, I can be reasonably sure that I'm looking at a block element. Custom elements, I got nuthin'. They're not transparent. They're a black box.
- Finally (and more importantly), we already solved the "div-soup" problem. It was called XHTML. Custom elements in encapsulated namespaces! Composable libraries of semantically-meaningful markup! How's that working out today? It's not.
TL;DR: a common presentation DTD is the strength of the web, not its weakness. Attempts to endow web applications with stronger composition/encapsulation should not be directed at the DOM layer but at the CSS and JS layers above and below it.
[1]: http://w3c.github.io/webcomponents/spec/custom/ [2]: http://w3c.github.io/webcomponents/spec/shadow/
"Collections of div-soup activated by jQuery plugins are the way to write maintainable web applications that make sense"
It's not as though Javascript has no role whatsoever in custom elements, but really, there's a lot to be said about how this way of working will be a huge improvement over the current jQuery + div-soup status quo.
I'm saying that DOM through its relationship to HTML has weaknesses that make it unsuitable for building application components out of. "jQuery-enabled div-soup" is an example of how mixing presentation with model and logic yields unmaintainable results.
I have been interested in React.js recently, since it provides an interface to create reusable components and to use them inside a rich programming language with full types. I think that's a better example of a competing idea.
My experience is with building single page apps from scratch, so maybe there's a common use-case (embedding a twitter widget, or a 3rd party comment system in a blog) that Shadow DOM and Custom Components will address that I'm not familiar with.
One is better encapsulation, another is a well defined styling system (although obviously this article shows that this is not a super simple problem to solve, I'm certain that a good way of doing this will be around before too long) --- finally, and the most important thing, is that it's just baked into the platform itself, so interop between different frameworks is less of a pain.
For instance, suppose you want to use a particular Ember component in your Angular app. You probably don't want to include the entire Ember environment, and you want it to play nicely with Angular's idea of data binding and local scopes. Can you even do this? If you can, how much effort does it take, and how much does it degrade the application?
So, we've got: interoperable components/widgets. Easily style-able widgets. Elements with some semantic purpose. Simplified documents. Reusable templates (which, once HTML imports are pref'd on by default, should be easily host-able on CDN hosts).
There are a lot of benefits to baking this into the platform, despite making the platform an even bigger, crazier mess than it already is. It should hopefully give us better (and better designed) tools to work with.
Granted, I'm not saying it's going to solve every (web) problem ever, nothing ever does.
The biggest problem with this weak type system is obvious with CSS3 Matrix Transforms. CSS3 matrix transforms are the biggest bottleneck preventing fast updates to many DOM elements. Without fast updates of many elements across an entire page (window), pulling off the awesome smoothly animated effects found in modern desktop and mobile operating systems is pretty much impossible, especially in a system that implements immediate mode graphics over retain mode (DOM).
Marshalling matrix3d updates from numbers in an array of length 16 to a stringified array to apply it to an element, only to have the browser have to convert that stringified array back into an array of 16 numbers is insanity.
If you want performance, you need a more robust type system than just strings and children. I'm an engineer at Famo.us and we would absolutely love it if we could do something in javascript like element.set3DTransform(someLength16Array); We could simultaneously update thousands of DOM elements if arrays and typed arrays were supported instead of stringified.
In your example, I think it'd only be a small patch (for WebKit, where my experience is) to optimize "elem.style.transform = new WebKitCSSMatrix(a,b,c,d)" without intermediate stringification. Mozilla doesn't expose a CSSMatrix type unfortunately. I've done some similar things for other CSS properties in WebKit -- have you considered submitting a patch? I've found the WK guys super receptive to small optimizations which don't change observable behavior (i.e.: you can't tell if the WebKitCSSMatrix was stringified or not currently) like that.
Do you contribute to this area of Webkit? I'd love to chat more about this with you. Email is in my profile. Use the famo.us one.
Sorry, this is my fault. These things were defined in the spec before, but we sliced them out for a separate spec, which I was supposed to write and haven't gotten finished yet.
http://lists.w3.org/Archives/Public/www-style/2014Feb/0113.h...