Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1000)

Issue 2132343002: Make Custom Elements V1 work in HTML imports documents (Closed)

Created:
4 years, 5 months ago by kojii
Modified:
4 years, 3 months ago
CC:
blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, dominicc+watchlist_chromium.org, eae+blinkwatch, rwlbuis, sof, webcomponents-bugzilla_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make Custom Elements V1 work in HTML imports documents This patch extends Custom Elements V1 to support documents loaded by HTML Imports. BUG=594918

Patch Set 1 #

Patch Set 2 : imports #

Total comments: 3

Patch Set 3 : Fix tests #

Total comments: 11

Patch Set 4 : update #

Patch Set 5 : imports-create tests checks the order of constructors #

Total comments: 5

Messages

Total messages: 7 (2 generated)
kojii
PTAL.
4 years, 5 months ago (2016-07-12 07:22:41 UTC) #3
dominicc (has gone to gerrit)
Some comments inline. This doesn't really explain the semantics you're going for here. I think ...
4 years, 5 months ago (2016-07-13 06:12:30 UTC) #4
kojii
https://codereview.chromium.org/2132343002/diff/40001/third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html File third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html (right): https://codereview.chromium.org/2132343002/diff/40001/third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html#newcode34 third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html:34: assert_equals(reactions.length, 2); On 2016/07/13 at 06:12:30, dominicc wrote: > ...
4 years, 5 months ago (2016-07-13 06:47:17 UTC) #5
kojii
https://codereview.chromium.org/2132343002/diff/40001/third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html File third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html (right): https://codereview.chromium.org/2132343002/diff/40001/third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html#newcode34 third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html:34: assert_equals(reactions.length, 2); On 2016/07/13 at 06:47:16, kojii wrote: > ...
4 years, 5 months ago (2016-07-13 07:00:14 UTC) #6
dominicc (has gone to gerrit)
4 years, 5 months ago (2016-07-19 01:57:40 UTC) #7
More comments inline.

I think these semantics are pretty different to v1. It would be interesting to
change v0 to have semantics this loose and see whether Polymer apps break. I
suspect they will be surprisingly resilient. Another thing that could be
interesting is to port the v0 tests and change them to pass; the diff will tell
us more what the different semantic means in practice, gut check the same issues
morrita-san wrote tests for v0 for, etc.

By "grabble" I mean basically "access"/"walk"

https://codereview.chromium.org/2132343002/diff/80001/third_party/WebKit/Layo...
File third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html
(right):

https://codereview.chromium.org/2132343002/diff/80001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html:1:
<!DOCTYPE html>
I don't see any tests for:

- deep import trees
- trees with duplicate imports
- asynchronous imports
- dynamic import trees

Could you add some?

https://codereview.chromium.org/2132343002/diff/80001/third_party/WebKit/Layo...
File third_party/WebKit/LayoutTests/custom-elements/imports/imports-upgrade.html
(right):

https://codereview.chromium.org/2132343002/diff/80001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/custom-elements/imports/imports-upgrade.html:25:
assert_equals(reactions[0].element, elementsInImport[0]);
This test would be more descriptive if it had

<x-x id="a">
<link rel="import" href="..."> <-- contains ID c
<x-x id="b">
<script>... define
assert_array_equals(reactions, ...

Note how I've put elements before and after the import. Then someone reading the
test cant tell if upgrades happen import-first (which I think is what you have
implemented here) or "flatten imports into tree order" order.

The test as written isn't descriptive because both of those orders produce the
same result.

The same thing goes for the test above, where the call to 'define' is in the
imported document.

https://codereview.chromium.org/2132343002/diff/80001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp
(right):

https://codereview.chromium.org/2132343002/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp:260: using
ElementsDocumentMap = HeapHashMap<Document*, ElementsInDocument>;
Maybe DocumentElementsMap, since it's a map *from* document *to* element?

https://codereview.chromium.org/2132343002/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp:278: for
(const auto& it : imports) {
I don't think hashtable iteration order is a good idea; generally web platform
APIs do things in some stable order.

https://codereview.chromium.org/2132343002/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp:311:
collectFromImports(imports, elements);
TL;DR I think you should handle sorting in the custom elements upgrade sorter
and not split that logic into two places unless there's a good reason to do so.

Powered by Google App Engine
This is Rietveld 408576698