From 3a271c047bff56bc4a53b52074155edf09c360d6 Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Tue, 7 Jan 2020 16:22:54 +0900 Subject: [PATCH 1/2] custom-elements: Add a test for 'focusBehavior' https://github.com/whatwg/html/pull/5120 --- .../ElementInternals-focusBehavior.html | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 custom-elements/ElementInternals-focusBehavior.html diff --git a/custom-elements/ElementInternals-focusBehavior.html b/custom-elements/ElementInternals-focusBehavior.html new file mode 100644 index 00000000000000..27695b9d7c6896 --- /dev/null +++ b/custom-elements/ElementInternals-focusBehavior.html @@ -0,0 +1,70 @@ + + + + + + + + From 77061f6da41d52614a15a50abf666b3efa94e3ee Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Tue, 7 Jan 2020 16:35:55 +0900 Subject: [PATCH 2/2] internals -> i to avoid lint errors --- .../ElementInternals-focusBehavior.html | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/custom-elements/ElementInternals-focusBehavior.html b/custom-elements/ElementInternals-focusBehavior.html index 27695b9d7c6896..025ab57e1b5d48 100644 --- a/custom-elements/ElementInternals-focusBehavior.html +++ b/custom-elements/ElementInternals-focusBehavior.html @@ -7,14 +7,14 @@ class MyElement extends HTMLElement { constructor() { super(); - this.internals = this.attachInternals(); + this.i = this.attachInternals(); } } customElements.define('my-element', MyElement); test(() => { const element = document.createElement('my-element'); - assert_equals(element.internals.focusBehavior, 'default'); + assert_equals(element.i.focusBehavior, 'default'); document.body.appendChild(element); element.focus(); assert_not_equals(document.activeElement, element); @@ -22,8 +22,8 @@ test(() => { const element = document.createElement('my-element'); - element.internals.focusBehavior = 'default'; - assert_equals(element.internals.focusBehavior, 'default'); + element.i.focusBehavior = 'default'; + assert_equals(element.i.focusBehavior, 'default'); document.body.appendChild(element); element.focus(); assert_not_equals(document.activeElement, element); @@ -31,8 +31,8 @@ test(() => { const element = document.createElement('my-element'); - element.internals.focusBehavior = 'default'; - assert_equals(element.internals.focusBehavior, 'default'); + element.i.focusBehavior = 'default'; + assert_equals(element.i.focusBehavior, 'default'); element.tabIndex = 0; document.body.appendChild(element); element.focus(); @@ -41,8 +41,8 @@ test(() => { const element = document.createElement('my-element'); - element.internals.focusBehavior = 'focusable'; - assert_equals(element.internals.focusBehavior, 'focusable'); + element.i.focusBehavior = 'focusable'; + assert_equals(element.i.focusBehavior, 'focusable'); document.body.appendChild(element); element.focus(); assert_equals(document.activeElement, element); @@ -50,8 +50,8 @@ test(() => { const element = document.createElement('my-element'); - element.internals.focusBehavior = 'simple-control'; - assert_equals(element.internals.focusBehavior, 'simple-control'); + element.i.focusBehavior = 'simple-control'; + assert_equals(element.i.focusBehavior, 'simple-control'); document.body.appendChild(element); element.focus(); assert_equals(document.activeElement, element); @@ -59,8 +59,8 @@ test(() => { const element = document.createElement('my-element'); - element.internals.focusBehavior = 'anchor'; - assert_equals(element.internals.focusBehavior, 'focusable'); + element.i.focusBehavior = 'anchor'; + assert_equals(element.i.focusBehavior, 'focusable'); document.body.appendChild(element); element.focus(); assert_equals(document.activeElement, element);