booleanAttributeKeyword static method
The keyword of the boolean attribute attrName in value
(hidden="until-found" -> 'until-found'), or null if value is a
boolean value.
booleanAttributeKeyword('hidden', 'until-found'); // 'until-found'
booleanAttributeKeyword('hidden', 'Until-Found'); // 'until-found'
booleanAttributeKeyword('hidden', 'true'); // null
booleanAttributeKeyword('checked', 'until-found'); // null
Implementation
static String? booleanAttributeKeyword(String? attrName, Object? value) {
if (attrName == null || value is! String) return null;
var keywords = _booleanAttributesKeywords[attrName];
if (keywords == null) return null;
var keyword = value.trim().toLowerCase();
return keywords.contains(keyword) ? keyword : null;
}