-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It only supports the shadowRoot property for now. This extracts the basic infrastructure from #3561, leaving the ARIAMixin work for later (to be reconciled with #3586). Co-authored-by: Jufeng Zhang <zjffun@gmail.com>
- Loading branch information
Showing
10 changed files
with
126 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use strict"; | ||
|
||
class ElementInternalsImpl { | ||
constructor(globalObject, args, { targetElement }) { | ||
this._targetElement = targetElement; | ||
} | ||
|
||
get shadowRoot() { | ||
const shadow = this._targetElement._shadowRoot; | ||
|
||
if (!shadow || !shadow._availableToElementInternals) { | ||
return null; | ||
} | ||
|
||
return shadow; | ||
} | ||
} | ||
|
||
module.exports = { | ||
implementation: ElementInternalsImpl | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// https://html.spec.whatwg.org/#the-elementinternals-interface | ||
|
||
[Exposed=Window] | ||
interface ElementInternals { | ||
// Shadow root access | ||
readonly attribute ShadowRoot? shadowRoot; | ||
|
||
// Form-associated custom elements | ||
// undefined setFormValue((File or USVString or FormData)? value, | ||
// optional (File or USVString or FormData)? state); | ||
|
||
// readonly attribute HTMLFormElement? form; | ||
|
||
// undefined setValidity(optional ValidityStateFlags flags = {}, | ||
// optional DOMString message, | ||
// optional HTMLElement anchor); | ||
// readonly attribute boolean willValidate; | ||
// readonly attribute ValidityState validity; | ||
// readonly attribute DOMString validationMessage; | ||
// boolean checkValidity(); | ||
// boolean reportValidity(); | ||
|
||
// readonly attribute NodeList labels; | ||
|
||
// Custom state pseudo-class | ||
// [SameObject] readonly attribute CustomStateSet states; | ||
}; | ||
|
||
// Accessibility semantics | ||
// ElementInternals includes ARIAMixin; | ||
|
||
// dictionary ValidityStateFlags { | ||
// boolean valueMissing = false; | ||
// boolean typeMismatch = false; | ||
// boolean patternMismatch = false; | ||
// boolean tooLong = false; | ||
// boolean tooShort = false; | ||
// boolean rangeUnderflow = false; | ||
// boolean rangeOverflow = false; | ||
// boolean stepMismatch = false; | ||
// boolean badInput = false; | ||
// boolean customError = false; | ||
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters