ShadowRootMode.js 413 B

123456789101112
  1. "use strict";
  2. const enumerationValues = new Set(["open", "closed"]);
  3. exports.enumerationValues = enumerationValues;
  4. exports.convert = (globalObject, value, { context = "The provided value" } = {}) => {
  5. const string = `${value}`;
  6. if (!enumerationValues.has(string)) {
  7. throw new globalObject.TypeError(`${context} '${string}' is not a valid enumeration value for ShadowRootMode`);
  8. }
  9. return string;
  10. };