From 7055bf3de9d420bc14b3e3824eb8709583ddb8af Mon Sep 17 00:00:00 2001 From: Closure Team Date: Tue, 22 Oct 2024 07:39:27 -0700 Subject: [PATCH] Adds externs for ElementInternals: states property. https://html.spec.whatwg.org/multipage/custom-elements.html#custom-state-pseudo-class PiperOrigin-RevId: 688544488 --- externs/browser/html5.js | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/externs/browser/html5.js b/externs/browser/html5.js index 114259ca7f9..baa70d61c69 100644 --- a/externs/browser/html5.js +++ b/externs/browser/html5.js @@ -6369,6 +6369,9 @@ ElementInternals.prototype.checkValidity = /** @type {!NodeList} */ ElementInternals.prototype.labels; +/** @type {!CustomStateSet} */ +ElementInternals.prototype.states; + /** * @see https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface * @record @@ -6405,6 +6408,73 @@ ValidityStateFlags.prototype.badInput; /** @type {boolean|undefined} */ ValidityStateFlags.prototype.customError; +/** + * @see https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface + * @constructor + */ +function CustomStateSet() {} + +/** + * @param {string} value + * @return {void} + */ +CustomStateSet.prototype.add = function(value) {}; + +/** + * @return {void} + */ +CustomStateSet.prototype.clear = function() {}; + +/** + * @param {string} value + * @return {boolean} + */ +CustomStateSet.prototype.delete = function(value) {}; + +/** + * @return {!IteratorIterable>} Where each array has two entries: + * [value, value] + * @nosideeffects + */ +CustomStateSet.prototype.entries = function() {}; + +/** + * @param {function(this: THIS, string, string, CustomStateSet)} callback + * @param {THIS=} opt_thisArg + * @this {THIS} + * @template THIS + */ +CustomStateSet.prototype.forEach = function(callback, opt_thisArg) {}; + +/** + * @param {string} value + * @return {boolean} + * @nosideeffects + */ +CustomStateSet.prototype.has = function(value) {}; + +/** + * @type {number} (readonly) + */ +CustomStateSet.prototype.size; + +/** + * @return {!IteratorIterable} + * @nosideeffects + */ +CustomStateSet.prototype.keys = function() {}; + +/** + * @return {!IteratorIterable} + * @nosideeffects + */ +CustomStateSet.prototype.values = function() {}; + +/** + * @return {!Iterator} + */ +CustomStateSet.prototype[Symbol.iterator] = function() {}; + /** * @see https://drafts.csswg.org/css-view-transitions/#dom-document-startviewtransition * @param {function(): (undefined|!Promise)} updateCallback