removeAttribute method

void removeAttribute(
  1. String name, {
  2. String? namespaceUri,
  3. @Deprecated('Use `namespaceUri` instead') String? namespace,
})
inherited

Removes the attribute value with the given fully qualified name.

Both name and namespaceUri can be a specific String; or '*' to match anything. If no namespaceUri is provided, the fully qualified name is compared; otherwise only the local name is considered.

For example:

  • element.removeAttribute('xsd:name') removes the attribute with the fully qualified attribute name xsd:name.
  • element.removeAttribute('name', namespaceUri: '*') removes the attribute with the local attribute name name no matter the namespace.
  • element.removeAttribute('*', namespaceUri: 'http://www.w3.org/2001/XMLSchema') removes the attribute within the provided namespace URI.

Implementation

void removeAttribute(
  String name, {
  String? namespaceUri,
  @Deprecated('Use `namespaceUri` instead') String? namespace,
}) => setAttribute(name, null, namespaceUri: namespaceUri ?? namespace);