Primary eng (and PM) emails
har...@chromium.org, yukis...@chromium.org, joc...@chromium.org, dca...@chromium.org
Spec
Web IDL: https://heycam.github.io/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 the design document (*1) for more details.
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 programming. For example, it will enable developers to implement Polyfill and JavaScript libraries that override default DOM attribute behaviors. Another important use case would be custom elements, because with custom elements, developers want to customize DOM attribute behavior of existing elements by hooking their JavaScript getters/setters.
Compatibility Risk
Low. IE and Firefox already implemented the new behavior more than two years ago. Safari has not yet implemented the new behavior.
To reduce the compatibility risk as much as possible, we're planning to make the change in the following steps:
Step 1: Move popular DOM attributes used in Dromaeo (CL: *2)
Step 2: Move most DOM attributes (CL: *3)
Step 3: Move all the remaining DOM attributes
I have landed the CL for Step 1 multiple times and kept it on trunk for a couple of days, but I didn't receive any behavioral bugs.
Ongoing technical constraints
- Performance regression in micro-benchmarks. The V8 team has landed a bunch of optimizations and the performance is now getting to a good shape. This sheet (*4) describes the performance impacts of moving DOM attributes to prototype chains. The summary is as follows:
- Page cycler and Speedometer: No improvement or regression.
- blink_perf benchmarks other than the below: No significant improvement or regression.
- dom-attribute-on-prototype-chain.html (a crazy benchmark that will be affected by this change the most): -17%.
- Dromaeo/domtraverse: -12%.
- Dromaeo/jslibstyleprototype: -4%.
- Dromaeo/jslibtraversejquery: -3%. Note that this benchmark was made 12% faster recently (*5).
- Dromaeo/jslibtraverseprototype: -3%. Note that this benchmark was made 60% faster recently (*6).
- Overall, only a couple of micro-benchmarks will regress by this change. Also the V8 team is actively working on more optimizations, just like they recently made a significant improvement on Dromaeo/jslibtraversejquery and Dromaeo/jslibtraverseprototype as described above. Therefore, I think that now is a timing to consider shipping the change. I think that the advantage of shipping the change now would be larger than the advantage of sticking to the no regression policy for micro benchmarks, to move the Web forward.
Will this feature be supported on all five Blink platforms (Windows, Mac, Linux, Chrome OS and Android)?
Yes. This change is platform-independent.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
It seems that this change caused JSON.stringify to change its behavior when stringifying DOM objects.
Was this an intended consequence?
See, for instance:
https://code.google.com/p/chromium/issues/detail?id=467471
The page load times themselves got ~3-5% slower on average but that's in a replay case where network isn't constrained at all. It probably won't translate to an equivalent slowdown in the field but on fast connections for specific sites or with cached/offline content it should.
The impacts to some of the layout tests concern me more than the overall page load time hit (I assume the PLT hit is caused by the layout and DOM traversal regressions).Specifically these:15% regression on the Shapes_MultipleShapes layout test
The bisects quite reliably keep going back to the cl that changed the bindings. One more just came through that I didn't think could be related but there was a 25% regression on inserting iFrames.
I think that's what haraken said earlier: "yukishiino@ is trying to reproduce the regression locally."
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
I also have a blog post (but on html5rocks) coming out soon.
--
https://annevankesteren.nl/
All, I have staged a version of our web developer guidance here: http://development.updaterocker.appspot.com/2015/04/DOM-attributes-now-on-the-prototype (some changes are still waiting to be deployed)
I am certainly open to feedback. I haven't addressed performance issues in this post yet, but I am curious to work out how we message that we are slowing down Chrome for a version or two... (if that is the case).
I am certainly open to feedback. I haven't addressed performance issues in this post yet, but I am curious to work out how we message that we are slowing down Chrome for a version or two... (if that is the case).I'm really anxious to see this fixed ASAP. But if we haven't convinced ourselves the performance impact is OK by this point (beta release) perhaps we should defer another milestone?
I am certainly open to feedback. I haven't addressed performance issues in this post yet, but I am curious to work out how we message that we are slowing down Chrome for a version or two... (if that is the case).I'm really anxious to see this fixed ASAP. But if we haven't convinced ourselves the performance impact is OK by this point (beta release) perhaps we should defer another milestone?I think we're pretty convinced that this is the right thing to do. The needs of the many out weigh the needs of the few prototype checks.
On Tue, Apr 14, 2015 at 7:35 PM Elliott Sprehn <esp...@chromium.org> wrote:I am certainly open to feedback. I haven't addressed performance issues in this post yet, but I am curious to work out how we message that we are slowing down Chrome for a version or two... (if that is the case).I'm really anxious to see this fixed ASAP. But if we haven't convinced ourselves the performance impact is OK by this point (beta release) perhaps we should defer another milestone?I think we're pretty convinced that this is the right thing to do. The needs of the many out weigh the needs of the few prototype checks.
This is awesome work! Glad to see this -- you'll make polyfill authors really happy :-) Any chance we'll see something similar for methods like addEventListener/removeEventListener? I believe these are still defined on the instance in Blink.
All, I have staged a version of our web developer guidance here: http://development.updaterocker.appspot.com/2015/04/DOM-attributes-now-on-the-prototype (some changes are still waiting to be deployed)I am certainly open to feedback. I haven't addressed performance issues in this post yet, but I am curious to work out how we message that we are slowing down Chrome for a version or two... (if that is the case).
I would suggest using “properties” (or perhaps “getters and setters”) since that is the JavaScript term. The idea of “attributes” meaning JavaScript properties seems to be something inherited from IDL’s CORBA days?
In terms of the Web IDL spec, they are "attributes".It is important to use the correct term in the spec, but it is also important to use a term web developers can easily understand. So I'm fine with "properties" as well.