/* [attr~=value]
178574
function containsArray(query, node) {
  var value

  if (has(node, query.name)) {
    value = node[query.name]

    // If this is an array, and the query is contained in it, return true.
    if (
      typeof value === 'object' &&
      'length' in value &&
      value.indexOf(query.value) !== -1
    ) {
      return true
    }

    // For all other values, return whether this is an exact match.
    return String(value) === query.value
  }

  return false
}
1334738
function(attr) {
                    var value;
                    // Handles the case of a key having a `.` in its name
                    if (typeof attr === 'string' && !! ~attr.indexOf('.')) {
                        // Attempt to get the value
                        value = this.__get(attr);
                        // For keys with a `.` in them, value will be defined
                        if (value !== undefined) {
                            return value;
                        }
                    }

                    // Otherwise we have to dig deeper into the Map to get the value.
                    // First, break up the attr (`"foo.bar"`) into parts like `["foo","bar"]`.
                    var parts = can.Map.helpers.attrParts(attr),
                        // Then get the value of the first attr name (`"foo"`).
                        current = this.__get(parts.shift());
                    // If there are other attributes to read...
                    return parts.length ?
                    // and current has a value...
                    current ?
                    // then lookup the remaining attrs on current
                    current._get(parts) :
                    // or if there's no current, return undefined.
                    undefined :
                    // If there are no more parts, return current.
                    current;
                }
1131118
static function input_attr(&$attr)
	{
	    $str = " ";
        if(!empty($attr) && is_array($attr))
        {
            foreach($attr as $key=>$value)
            {
                $str .= "$key=\"$value\" ";
            }
        }
        return $str;
	}
1254
function getAttributeNameValue(node, at) {
	const name = at.name;
	let atnv;

	if (name.indexOf('href') !== -1 || name.indexOf('src') !== -1) {
		let friendly = axe.utils.getFriendlyUriEnd(node.getAttribute(name));
		if (friendly) {
			let value = encodeURI(friendly);
			if (value) {
				atnv = escapeSelector(at.name) + '$="' + escapeSelector(value) + '"';
			} else {
				return;
			}
		} else {
			atnv =
				escapeSelector(at.name) +
				'="' +
				escapeSelector(node.getAttribute(name)) +
				'"';
		}
	} else {
		atnv = escapeSelector(name) + '="' + escapeSelector(at.value) + '"';
	}
	return atnv;
}
495192
@Override
    public BaseJsonBo setAttribute(String attrName, Object value) {
        return setAttribute(attrName, value, true);
    }
427208
function _objectByAttribute(obj, attr, map, action) {
    var subAttrs = attr.split(".");
    var attrValue = obj;
    for (var i = 0; i < subAttrs.length; i++) {
      attrValue = attrValue[subAttrs[i]];
      if (attrValue === undefined) {
        return;
      }
    }

    if ($.isArray(attrValue)) {
      // TODO implement this when we actually need it
    }
    else if ($.isPlainObject(attrValue)) {
      for (var key in attrValue) {
        var val = attrValue[key];
        if (!map[key]) {
          map[key] = {};
        }
        if (action === "DELETED") {
          delete map[key][val];
        }
        else {
          map[key][val] = obj;
        }
      }
    }
    else {
      if (action === "DELETED") {
        delete map[attrValue];
      }
      else {
        map[attrValue] = obj;
      }
    }
  }
151479
function(attrs) {
        var ret = {};
        if (this._getAttrs) { // use Attribute imple
            this._getAttrs(attrs);
        } else { // use setters inline
            Y.Array.each(attrs, function(v, n) {
                ret[v] = this.get(v); 
            }, this);
        }

        return ret;
    }
1020913
def handle_attribute_value(self, value):
        """"""
        if self.re_js.match(value) or self.re_vb.match(value):
            return ''
        return value
630156
def _do_attr(self, n, value):
        '''''''

        W = self.write
        W(' ')
        W(n)
        W('="')
        s = string.replace(value, "&", "&amp;")
        s = string.replace(s, "<", "&lt;")
        s = string.replace(s, '"', '&quot;')
        s = string.replace(s, '\011', '&#x9')
        s = string.replace(s, '\012', '&#xA')
        s = string.replace(s, '\015', '&#xD')
        W(s)
        W('"')
7626
public T attr(String name, String value) throws IOException {
		if (value != null) {
			writer.write(' ');
			writer.write(name);
			writer.write("=\"");
			writer.write(value);
			writer.write('\"');
		}
		return (T) this;
	}
1016543
function(attr, value) {
          var self = this,
              result = {},
              error;

          if(_.isObject(attr)){
            _.each(attr, function(value, key) {
              error = self.preValidate(key, value);
              if(error){
                result[key] = error;
              }
            });

            return _.isEmpty(result) ? undefined : result;
          }
          else {
            return validateAttr(this, attr, value, _.extend({}, this.attributes));
          }
        }
444391
function stringify(value, code, attr, tag) {
  var s = open(code, attr);
  s +=  close(value, tag);
  return s;
}
423093
def on_html_attr(name, value)
      if value[0] == :slim && value[1] == :attrvalue && !options[:merge_attrs][name]
        # We handle the attribute as a boolean attribute
        escape, code = value[2], value[3]
        case code
        when 'true'
          [:html, :attr, name, [:multi]]
        when 'false', 'nil'
          [:multi]
        else
          tmp = unique_name
          [:multi,
           [:code, "#{tmp} = #{code}"],
           [:if, tmp,
            [:if, "#{tmp} == true",
             [:html, :attr, name, [:multi]],
             [:html, :attr, name, [:escape, escape, [:dynamic, tmp]]]]]]
        end
      else
        # Attribute with merging
        @attr = name
        super
      end
    end
588304
public B attr(String name, String value) {
        get().setAttribute(name, value);
        return that();
    }
623179
function(attrs, callback) {
      var t = this;

      // Value is the only thing to set
      if (typeof attrs.value === 'undefined') {
        return callback({code:'NO_VALUE'});
      }

      // Set the model elements.  These cause change events to fire
      if (t.isModel) {
        t.value.set(attrs.value);
      }
      else {
        // Set the variable directly
        var jsonValue = JSON.stringify(attrs.value);
        t._evaluate(t.key + ' = ' + jsonValue);
        t.set('value', attrs.value);
      }
      return callback();
    }
104188
public void attribute(final QName attr, final String attrVal) throws IOException {
    out(" ");

    emitQName(attr);

    out("=");
    quote(attrVal);

    emitNs();
  }
806451
@CheckReturnValue
  Context transitionToAttrName(String attrName) {
    // according to spec ascii case is not meaningful for attributes.
    attrName = Ascii.toLowerCase(attrName);
    // Get the local name so we can treat xlink:href and svg:style as per HTML.
    int colon = attrName.lastIndexOf(':');
    String localName = attrName.substring(colon + 1);

    Context.AttributeType attr;
    UriType uriType = UriType.NONE;
    if (localName.startsWith("on")) {
      attr = Context.AttributeType.SCRIPT;
    } else if ("ng-init".equals(attrName)) {
      // ng-init is an attribute used in the AngularJS framework. According to its documentation,
      // "There are only a few appropriate uses of ngInit, such as [...] injecting data via server
      // side scripting" (https://docs.angularjs.org/api/ng/directive/ngInit). Soy supports this by
      // ensuring that interpolating server side data inside the ng-init attribute will not lead to
      // Angular expression injection vulnerabilities (https://docs.angularjs.org/guide/security).
      //
      // The content of the attribute follows an expression syntax very similar to JavaScript. In
      // fact, the syntax is a subset of JS, though the bitwise OR operator has different semantics
      // (piping into a filter function). Because of this, treating the attribute as JS in Soy will
      // ensure that the injected data will always be interpreted as a primitive data type by
      // Angular and won't be parsed as an expression (similarly to how Soy prevents JS injection
      // in on* attributes). See the documentation for details on the syntax:
      // https://docs.angularjs.org/guide/expression#angularjs-expressions-vs-javascript-expressions
      //
      // The set of places where Angular tries to find and interpret expressions in the DOM depends
      // on its interpolation rules (https://docs.angularjs.org/guide/interpolation) and directives
      // (https://docs.angularjs.org/guide/directive). Since
      // - each application can define additional directives
      // - directives can be triggered by HTML comments, element names, attributes (not just ng-
      //   attributes) and a special CSS class syntax
      // - the interpolation start and end symbols can be changed
      // it is not feasible to cover all cases in Soy. Instead, we rely on the fact that all
      // templates can be refactored to use ng-init for passing the server side data. In other
      // words, Soy enables safely passing data, but it doesn't (and can't) force it.
      attr = Context.AttributeType.SCRIPT;
    } else if ("style".equals(localName)) {
      attr = Context.AttributeType.STYLE;
    } else if (elType == Context.ElementType.MEDIA
        && ("src".equals(attrName) || "xlink:href".equals(attrName))) {
      attr = Context.AttributeType.URI;
      uriType = UriType.MEDIA;
    } else if ((elType == ElementType.SCRIPT && "src".equals(attrName))
        || (elType == ElementType.IFRAME && "src".equals(attrName))
        || (elType == ElementType.LINK_EXECUTABLE && "href".equals(attrName))
        || (elType == ElementType.BASE && "href".equals(attrName))) {
      attr = Context.AttributeType.URI;
      uriType = UriType.TRUSTED_RESOURCE;
    } else if (URI_ATTR_NAMES.contains(localName)
        || CUSTOM_URI_ATTR_NAMING_CONVENTION.matcher(localName).find()
        || "xmlns".equals(attrName)
        || attrName.startsWith("xmlns:")) {
      attr = Context.AttributeType.URI;
      uriType = UriType.NORMAL;
    } else if (elType == ElementType.META_REFRESH && "content".equals(attrName)) {
      attr = AttributeType.META_REFRESH_CONTENT;
    } else if (elType == ElementType.IFRAME && "srcdoc".equals(attrName)) {
      attr = Context.AttributeType.HTML;
    } else {
      attr = Context.AttributeType.PLAIN_TEXT;
    }
    return toBuilder()
        .withState(HtmlContext.HTML_ATTRIBUTE_NAME)
        .withoutAttrContext()
        .withAttrType(attr)
        .withUriType(uriType)
        .build();
  }