99 * Possible property values
1010 * @typedef {string|number|boolean } PrimitivePropertyValue
1111 * Possible primitive HTML attribute values
12- * @typedef {string|[string, ...Array<PrimitivePropertyValue>] } AttributeValue
13- * @typedef {Record<string, Array<PrimitivePropertyValue>> } AttributeMap
12+ * @typedef {string|[string, ...Array<PrimitivePropertyValue|RegExp >] } AttributeValue
13+ * @typedef {Record<string, Array<PrimitivePropertyValue|RegExp >> } AttributeMap
1414 *
1515 * @typedef Schema Sanitization configuration
1616 * @property {Record<string, Array<AttributeValue>> } [attributes]
@@ -236,7 +236,7 @@ function handleProperties(schema, properties, node, stack) {
236236 for ( key in props ) {
237237 if ( own . call ( props , key ) ) {
238238 let value = props [ key ]
239- /** @type {Array<PrimitivePropertyValue> } */
239+ /** @type {Array<PrimitivePropertyValue|RegExp > } */
240240 let definition
241241
242242 if ( own . call ( allowed , key ) ) {
@@ -281,9 +281,10 @@ function handleDoctypeName() {
281281/**
282282 * Sanitize `tagName`.
283283 *
284- * @type { Handler }
285- * @param {unknown } tagName
284+ * @param { Schema } schema
285+ * @param {string } tagName
286286 * @param {Node } _
287+ * @param {Array<string> } stack
287288 * @returns {string|false }
288289 */
289290function handleTagName ( schema , tagName , _ , stack ) {
@@ -354,7 +355,7 @@ function allow(_, value) {
354355 * @param {Schema } schema
355356 * @param {Array<unknown> } values
356357 * @param {string } prop
357- * @param {Array<PrimitivePropertyValue> } definition
358+ * @param {Array<PrimitivePropertyValue|RegExp > } definition
358359 * @returns {Array<string|number> }
359360 */
360361function handlePropertyValues ( schema , values , prop , definition ) {
@@ -380,7 +381,7 @@ function handlePropertyValues(schema, values, prop, definition) {
380381 * @param {Schema } schema
381382 * @param {unknown } value
382383 * @param {string } prop
383- * @param {Array<PropertyValue> } definition
384+ * @param {Array<PropertyValue|RegExp > } definition
384385 * @returns {PropertyValue }
385386 */
386387function handlePropertyValue ( schema , value , prop , definition ) {
@@ -389,7 +390,12 @@ function handlePropertyValue(schema, value, prop, definition) {
389390 typeof value === 'number' ||
390391 typeof value === 'string' ) &&
391392 safeProtocol ( schema , value , prop ) &&
392- ( definition . length === 0 || definition . includes ( value ) )
393+ ( definition . length === 0 ||
394+ definition . some ( ( allowed ) =>
395+ allowed && typeof allowed === 'object' && 'flags' in allowed
396+ ? allowed . test ( String ( value ) )
397+ : allowed === value
398+ ) )
393399 ) {
394400 return schema . clobberPrefix &&
395401 schema . clobber &&
0 commit comments