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

Unified Diff: LayoutTests/fast/dom/custom/created-callback.html

Issue 18258003: Pow __proto__, sock :unresolved, and clunk the created callback at once. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Try to be nicer to MSVC. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/custom/created-callback-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/custom/created-callback.html
diff --git a/LayoutTests/fast/dom/custom/created-callback.html b/LayoutTests/fast/dom/custom/created-callback.html
index 0bd3a328404a5dc1d55462c850b6ec8d9bcea0d7..9cd7f5f3e01cb10d66d5438763bc16031f54f758 100644
--- a/LayoutTests/fast/dom/custom/created-callback.html
+++ b/LayoutTests/fast/dom/custom/created-callback.html
@@ -31,4 +31,43 @@ test(function () {
var element = new ctor();
assert_equals(createdInvocations, 1, 'the created callback retrieved at registration must be invoked');
}, 'transfer created callback');
+
+t = async_test('__proto__, :unresolved and created callback timing');
+t.step(function () {
+ var createdInvocations = 0;
+ function created() {
+ createdInvocations++;
+
+ if (this.id != 'v')
+ return;
+
+ t.step(function () {
+ var t = div.querySelector('#t');
+ var u = div.querySelector('#u');
+ var w = div.querySelector('#w');
+
+ assert_equals(div.querySelector('x-c:not(:unresolved)'), this, 'the :unresolved pseudoclass should cease to apply when the created callback is invoked');
+ assert_array_equals(div.querySelectorAll(':unresolved'), [t, u], 'the :unresolved pseudoclass should be processed in order');
+
+ assert_false(t instanceof C, 'prototype upgrade should happen in order (#t)');
+ assert_false(u instanceof B, 'prototype upgrade should happen in order (#u)');
+ }, this);
+ }
+
+ var protoB = Object.create(HTMLElement.prototype);
+ var B = document.register('x-b', {prototype: protoB});
+
+ var protoC = Object.create(HTMLElement.prototype);
+ protoC.createdCallback = created;
+ var C = document.register('x-c', {prototype: protoC});
+
+ var div = document.createElement('div');
+ div.innerHTML = '<x-c id="t"></x-c>' +
+ '<x-b id="u"></x-b>' +
+ '<x-c id="v"></x-c>' +
+ '<x-b id="w"></x-b>';
+ assert_equals(createdInvocations, 2, 'the created callback should have been invoked once for each x-c element');
+ assert_true(div.querySelector('#t') instanceof C, '#t\'s prototype should have ultimately been upgraded');
+ t.done();
+});
</script>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/custom/created-callback-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698