u"""'tainted' keeps a set of attributes defined in parent nodes.

    For such attributes, we don't delete attributes with default values.
551442
def removeDefaultAttributeValues(node, options, tainted=set()):
    """
    num = 0
    if node.nodeType != Node.ELEMENT_NODE:
        return 0

    # Conditionally remove all default attributes defined in 'default_attributes' (a list of 'DefaultAttribute's)
    #
    # For increased performance do not iterate the whole list for each element but run only on valid subsets
    # - 'default_attributes_universal' (attributes valid for all elements)
    # - 'default_attributes_per_element' (attributes specific to one specific element type)
    for attribute in default_attributes_universal:
        num += removeDefaultAttributeValue(node, attribute)
    if node.nodeName in default_attributes_per_element:
        for attribute in default_attributes_per_element[node.nodeName]:
            num += removeDefaultAttributeValue(node, attribute)

    # Summarily get rid of default properties
    attributes = [node.attributes.item(i).nodeName for i in range(node.attributes.length)]
    for attribute in attributes:
        if attribute not in tainted:
            if attribute in default_properties:
                if node.getAttribute(attribute) == default_properties[attribute]:
                    node.removeAttribute(attribute)
                    num += 1
                else:
                    tainted = taint(tainted, attribute)
    # Properties might also occur as styles, remove them too
    styles = _getStyle(node)
    for attribute in list(styles):
        if attribute not in tainted:
            if attribute in default_properties:
                if styles[attribute] == default_properties[attribute]:
                    del styles[attribute]
                    num += 1
                else:
                    tainted = taint(tainted, attribute)
    _setStyle(node, styles)

    # recurse for our child elements
    for child in node.childNodes:
        num += removeDefaultAttributeValues(child, options, tainted.copy())

    return num
1166016
@Override
    public void removeAttributes() {
        // TODO: there must be a direct way to clear the SO on the client side
        Set<String> names = getAttributeNames();
        for (String key : names) {
            SharedObjectEvent event = new SharedObjectEvent(Type.CLIENT_DELETE_DATA, key, null);
            ownerMessage.addEvent(event);
            syncEvents.add(event);
        }
        deleteStats.addAndGet(names.size());
        // clear data
        super.removeAttributes();
        // mark as modified
        modified.set(true);
        // broadcast 'modified' event
        notifyModified();
    }
1237283
function(node, val) {
                var attr = node.attributes.value;
                if (!attr) {
                    attr = node[OWNER_DOCUMENT].createAttribute('value');
                    node.setAttributeNode(attr);
                }

                attr.value = val;
            }
538042
public void setAttributesToDelete(java.util.Collection<String> attributesToDelete) {
        if (attributesToDelete == null) {
            this.attributesToDelete = null;
            return;
        }

        this.attributesToDelete = new java.util.ArrayList<String>(attributesToDelete);
    }
292868
def reset_attribute!(name)
      value = attribute_was(name)
      if value
        @attributes[name] = value
        modifications.delete(name)
      end
    end
88857
def hasAttr(self, node, name, nsuri=None):
        """"""
        if nsuri is None:
            if node.hasAttribute(name):
                return True
            return False
        return node.hasAttributeNS(nsuri, name)
742160
def delete_children(attribute)
      self.send(attribute).each { |c| c.parent = nil }
      self.send(attribute).clear
    end
858450
private void checkNoDuplicateKeyAttribute(KeyNode node) {
    SoyNode parentNode = node.getParent();
    if (!(parentNode instanceof HtmlOpenTagNode)) {
      // Error thrown before this.
      return;
    }

    HtmlAttributeNode keyAttrNode = ((HtmlOpenTagNode) parentNode).getDirectAttributeNamed("key");
    if (keyAttrNode != null) {
      errorReporter.report(keyAttrNode.getSourceLocation(), DUPLICATE_KEY_ATTR);
    }
  }
1251563
function setAttribute(context, attr, value) {
    let currentAttrValue = context.getAttribute(attr);
    if (currentAttrValue !== value) {
        if (!isFalsy(value)) {
            if (typeof value === 'boolean') {
                value = '';
            }
            context.setAttribute(attr, value);
        } else if (currentAttrValue !== null) {
            context.removeAttribute(attr);
        }
    }
}
825321
private void preserveAttributes(AlluxioURI srcPath, AlluxioURI dstPath)
      throws IOException, AlluxioException {
    if (mPreservePermissions) {
      URIStatus srcStatus = mFileSystem.getStatus(srcPath);
      mFileSystem.setAttribute(dstPath, SetAttributePOptions.newBuilder()
          .setOwner(srcStatus.getOwner())
          .setGroup(srcStatus.getGroup())
          .setMode(new Mode((short) srcStatus.getMode()).toProto())
          .build());
      mFileSystem.setAcl(dstPath, SetAclAction.REPLACE, srcStatus.getAcl().getEntries());
    }
  }
1055732
function node(name, attributes) {
    "use strict";
    var _node   = document.createElementNS('', name);
    for (var attrName in attributes) {
        var value = attributes[attrName];
        if (attributes.hasOwnProperty(attrName) && isString(attrName)) {
            _node.setAttribute(attrName, value);
        }
    }
    return _node;
}
970700
function(d) {
        var a = d.attributes, i;
        if (a) {
          for (i = 0; i < a.length; i += 1) {
            if (typeof d[a[i].name] === 'function') d[a[i].name] = null;
          }
        }
        a = d.childNodes;
        if (a) {
          for (i = 0; i < a.length; i += 1) purge(d.childNodes[i]);
        }
      }
109156
private XML checksAttributesExistence(Class<?> aClass,String[] attributes){
		if(!classExists(aClass)) Error.xmlClassInexistent(this.xmlPath,aClass);
		for (String attributeName : attributes) 
			try{ 				 aClass.getDeclaredField(attributeName);		  }
			catch (Exception e){ Error.attributeInexistent(attributeName, aClass);}
		return this;
	}
615582
function(inName, inValue) {
		if (inValue === null || inValue === false || inValue === "") {
			this.node.removeAttribute(inName);
		} else {
			this.node.setAttribute(inName, inValue);
		}
	}
234676
def clean(self):
        
        super(CTENode, self).clean()
        if self.parent and self.pk in getattr(self.parent, self._cte_node_path):
            raise ValidationError(_("A node cannot be made a descendant of itself."))
399314
def _strip_dirty(xmltree):
    '''
    
    '''
    dirty = xmltree.attrib.pop('dirtyId', None)
    if dirty:
        xmltree.attrib.pop('admin', None)
        xmltree.attrib.pop('time', None)

    for child in xmltree:
        child = _strip_dirty(child)

    return xmltree
1066453
def dirty_attributes
      dirty_attributes = {}

      original_attributes.each_key do |property|
        next unless property.respond_to?(:dump)
        dirty_attributes[property] = property.dump(property.get!(self))
      end

      dirty_attributes
    end