removeAttr

  • function
can.Map.prototype.removeAttr  

Remove a property from an Map.

map.removeAttr(attrName)

Parameters

  1. attrName {String}

    the name of the property to remove

Returns

{*}

the value of the property that was removed

removeAttr removes a property by name from an Map.

var people = new can.Map({a: 'Alice', b: 'Bob', e: 'Eve'});

people.removeAttr('b'); // 'Bob'
people.attr();          // {a: 'Alice', e: 'Eve'}

Removing an attribute will cause a change event to fire with 'remove' passed as the how parameter and undefined passed as the newVal to handlers. It will also cause a property name event to fire with undefined passed as newVal. An in-depth description at these events can be found under attr.