possibleAttributes property

Map<String, String> get possibleAttributes

Map of possible attributes for this element.

Implementation

Map<String, String> get possibleAttributes {
  var attributes = attributesAsString;

  for (var attr in possibleGlobalAttributes) {
    attributes.putIfAbsent(attr, () => '');
  }

  if (tag == 'img' ||
      tag == 'audio' ||
      tag == 'video' ||
      tag == 'embed' ||
      tag == 'track' ||
      tag == 'source' ||
      tag == 'iframe' ||
      tag == 'script' ||
      tag == 'input') {
    attributes.putIfAbsent('src', () => '');
  } else if (tag == 'a' || tag == 'area' || tag == 'base' || tag == 'link') {
    attributes.putIfAbsent('href', () => '');
  }

  if (tag == 'img' ||
      tag == 'video' ||
      tag == 'embed' ||
      tag == 'canvas' ||
      tag == 'iframe') {
    attributes.putIfAbsent('width', () => '');
    attributes.putIfAbsent('height', () => '');
  }

  if (tag == 'video') {
    attributes.putIfAbsent('autoplay', () => '');
    attributes.putIfAbsent('controls', () => '');
    attributes.putIfAbsent('muted', () => '');
  }

  return attributes;
}