Skip to content

Commit

Permalink
Form-associated custom elements: Update attachInternals() implementation
Browse files Browse the repository at this point in the history
so that it matches to a specification PR;

whatwg/html#4324
- Check 'is value' for customized built-in elements
- Throws NotSupportedError instead of InvalidStateError in some cases
- Remove the upstreamed test

Bug: 905922
Change-Id: Ibe8db0ecde129f09a70c273cdc526f578ace1c33
Reviewed-on: https://chromium-review.googlesource.com/c/1482272
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Hayato Ito <hayato@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635024}
  • Loading branch information
tkent-google authored and Commit Bot committed Feb 25, 2019
1 parent 421a051 commit 22f90ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 91 deletions.
14 changes: 7 additions & 7 deletions third_party/blink/renderer/core/html/html_element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,12 @@ void HTMLElement::OnXMLLangAttrChanged(

ElementInternals* HTMLElement::attachInternals(
ExceptionState& exception_state) {
if (IsValue()) {
exception_state.ThrowDOMException(
DOMExceptionCode::kNotSupportedError,
"Unable to attach ElementInternals to a customized built-in element.");
return nullptr;
}
CustomElementRegistry* registry = CustomElement::Registry(*this);
auto* definition =
registry ? registry->DefinitionForName(localName()) : nullptr;
Expand All @@ -1469,15 +1475,9 @@ ElementInternals* HTMLElement::attachInternals(
"Unable to attach ElementInternals to non-custom elements.");
return nullptr;
}
if (!definition->Descriptor().IsAutonomous()) {
exception_state.ThrowDOMException(
DOMExceptionCode::kInvalidStateError,
"Unable to attach ElementInternals to a customized built-in element.");
return nullptr;
}
if (definition->DisableInternals()) {
exception_state.ThrowDOMException(
DOMExceptionCode::kInvalidStateError,
DOMExceptionCode::kNotSupportedError,
"ElementInternals is disabled by disabledFeature static field.");
return nullptr;
}
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 22f90ec

Please sign in to comment.