setAttribute method
Implementation
@override
void setAttribute(Node element, String attrName, String? attrVal) {
if (element is Element) {
switch (attrName) {
case 'selected':
{
if (element is OptionElement) {
element.selected = _parseAttributeBoolValue(attrVal);
} else {
element.setAttribute(attrName, attrVal!);
}
break;
}
case 'multiple':
{
if (element is SelectElement) {
element.multiple = _parseAttributeBoolValue(attrVal);
} else if (element is InputElement) {
element.multiple = _parseAttributeBoolValue(attrVal);
} else {
element.setAttribute(attrName, attrVal!);
}
break;
}
case 'hidden':
{
element.hidden = _parseAttributeBoolValue(attrVal);
break;
}
case 'inert':
{
element.inert = _parseAttributeBoolValue(attrVal);
break;
}
default:
{
if (attrVal == null) {
element.removeAttribute(attrName);
} else {
element.setAttribute(attrName, attrVal);
}
break;
}
}
}
}