Skip to content

Commit

Permalink
Serialize delegatesFocus in getInnerHTML()
Browse files Browse the repository at this point in the history
Prior to this CL, the getInnerHTML() call with includeShadowRoots=true
would not return markup with the shadowrootdelegatesfocus attribute.
Now, it does, and testing has been added to verify this behavior.

Bug: 1042130
Change-Id: Ibd859af110328b965e4c9a0074095a5a1e5251b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285288
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786393}
  • Loading branch information
mfreed7 authored and chromium-wpt-export-bot committed Jul 8, 2020
1 parent 1ebdb4d commit e4a45e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
// TODO(masonfreed): Add a check for ElementInternals.shadowRoot once that exists.
assert_true(!!element.shadowRoot, 'Shadow root should be present');
assert_equals(element.shadowRoot.innerHTML, shadowContent, 'Correct shadow content');
assert_equals(element.shadowRoot.delegatesFocus,delegatesFocus,'Correct delegatesFocus')
originalShadowRoot = element.shadowRoot;
}

Expand Down
3 changes: 2 additions & 1 deletion shadow-dom/declarative/getinnerhtml.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

const isOpen = mode === 'open';
if (allowsShadowDom) {
const correctShadowHtml = `<template shadowroot="${mode}"><slot></slot></template>`;
const delegatesAttr = delegatesFocus ? ' shadowrootdelegatesfocus=""' : '';
const correctShadowHtml = `<template shadowroot="${mode}"${delegatesAttr}><slot></slot></template>`;
const correctHtml = `<${elementType}>${correctShadowHtml}</${elementType}>`;
const shadowRoot = element.attachShadow({mode: mode, delegatesFocus: delegatesFocus});
shadowRoot.appendChild(document.createElement('slot'));
Expand Down

0 comments on commit e4a45e8

Please sign in to comment.