public static function serializeAttr(array $data, array $order=[]){
		$attr = [];

		/* convert data to sorted array */
		$sorted = static::sortedAttr($data, $order);

		foreach ( $sorted as list($key, $value) ){
			if ( is_array($value) ){
				/* ignore empty arrays */
				if ( count($value) === 0 ){
					continue;
				}
				foreach ( static::_serializeAttrArray($key, $value) as $sub ){
					$value = htmlspecialchars($sub[1], ENT_QUOTES | ENT_HTML5);
					$attr[] = "{$sub[0]}=\"{$value}\"";
				}
			} else {
				if ( $value === true ){
					$attr[] = "$key";
				} else if ( $value === false ){
					/* ignore */
				} else {
					$value = htmlspecialchars($value, ENT_QUOTES | ENT_HTML5);
					$attr[] = "$key=\"$value\"";
				}
			}
		}
		return implode(' ', $attr);
	}