if (!
is_array($tag_config) || !
(isset($other->elements
[$tag]) &&
is_array($other->elements
[$tag]))) { continue;
} // Special case: wildcard attributes, and the ability to define
// restrictions for all concrete attributes matching them using:
// - prefix wildcard, f.e. `*-foo`
// - infix wildcard, f.e. `*-entity-*`
// - suffix wildcard, f.e. `data-*`, to match `data-foo`, `data-bar`, etc.
$wildcard_attributes =
array_filter(array_keys($other->elements
[$tag]),
[__CLASS__, 'isWildcardAttributeName'
]);
foreach ($wildcard_attributes as $wildcard_attribute_name) { $regex = self::
getRegExForWildCardAttributeName($wildcard_attribute_name);
foreach ($tag_config as $html_tag_attribute_name =>
$html_tag_attribute_restrictions) { // If a wildcard attribute name (f.e. `data-*`) is allowed in $other
// with the same attribute value restrictions (e.g. TRUE to allow all
// attribute values or an array of specific allowed attribute values),
// then all concrete matches (f.e. `data-foo`, `data-bar`, etc.) are
// allowed and should be explicitly omitted from the difference.
if ($html_tag_attribute_restrictions ===
$other->elements
[$tag][$wildcard_attribute_name] &&
preg_match($regex,
$html_tag_attribute_name) === 1
) { unset($tag_config[$html_tag_attribute_name]);
} } }