Primary eng (and PM) emails
Spec
Web IDL: http://dev.w3.org/2006/webapi/WebIDL/#es-attributes
Summary
Currently DOM attributes are defined on DOM objects. JavaScript getters/setters are not exposed on DOM attributes, like this:
div = document.createElement(“div”);
See this design document for more details: https://docs.google.com/a/google.com/document/d/1yeHTCHhulVIlrKyx9_gCguAhLfcefVOa9uxxfW2LVG0/edit#
Motivation
The change is necessary for correctness, cross-browser compatibility, and moving the Web forward:
- The new behavior is conformant with the Web IDL spec.
- The new behavior is already implemented in IE and Firefox.
- The new behavior enables developers to hook DOM attribute getters/setters. This will improve hackability of DOM operations. It will enable developers to implement Polyfill and JavaScript libraries that override default DOM attribute behaviors. In particular, Polyfill implementation will become much easier and faster.
- The new behavior makes it easy to port Blink’s C++ implementation into JavaScript and reduce complexity of Blink. For example, we are planning to move editing implementation (e.g., execCommand) from C++ to JavaScript. With the new behavior, we just need to hook DOM attribute getters/setters and implement the logic all in JavaScript.
- The new behavior is necessary for custom elements in the Web Components, which we are planning to ship in M33. In custom elements, developers can define customized DOM elements that inherit from existing DOM elements. Here developers want to override DOM attribute behavior of existing DOM elements by hooking their JavaScript getters/setters.
Compatibility Risk
Low. IE and Firefox already implemented the new behavior more than one year ago. On the other hand, Safari has not yet implemented the new behavior.
Ongoing technical constraints
- Performance regression. This change will regress several micro benchmarks by 10% or so. We have been working on this project for two years and are concluding that it would be hard to decrease the regression any more without crankshafting binding callbacks to V8 (See https://docs.google.com/a/google.com/document/d/1yeHTCHhulVIlrKyx9_gCguAhLfcefVOa9uxxfW2LVG0/edit# for more details). However, implementing the crankshafting will take three more quarters. Thus, the question here is whether we should wait for the optimization and then make the change, or we should make the change and then do the optimization. If we should stick to the no regression policy, we should wait for the optimization. However, in this specific case, I'm thinking that the advantage of making this change now would be larger than the advantage of sticking to the no regression policy for micro benchmarks. Thus I propose to make the change even though it will regress performance of micro benchmarks. We will fix the regression in upcoming quarters. I'd like to hear thoughts of other Blink people about the performance trade-off.
Will this feature be supported on all five Blink platforms (Windows, Mac, Linux, Chrome OS and Android)?
Yes. This change is platform-independent.
LGTM
LGTM2.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
> This change will regress several micro benchmarks by 10% or so.
Is it only for micro benchmarks, or is it possible to affect practical web
applications?
I'm supportive of this change. It would be interesting to know which
microbenchmarks we're talking about (at a high-level).