Adds one Element.
@param		string		$tag		Tag name
@param		string|integer|float|UI_Template
@param		boolean		if set to TRUE, it will overwrite an existing element with the same label
@return		void
518977
public function addElement( $tag, $element, $overwrite = FALSE )
	{
		$this->add( array( $tag => $element ), $overwrite );
	}
488227
public function taggedAs($tag)
    {
        if (empty($this->current_node)) {
            return;
        }

        $this->current_node->tags = $tag;
        $this->current_node->save();
    }
171702
public function addSelfClosingTag($tag): Dom
    {
        if ( ! is_array($tag)) {
            $tag = [$tag];
        }
        foreach ($tag as $value) {
            $this->selfClosing[] = $value;
        }

        return $this;
    }
985278
public static function addDefaultAttributes(Tag &$Tag)
    {
        if (isset(TagInfo::$defaultAttributes[$Tag->name])) {
            $Tag->attributes = array_merge(
                TagInfo::$defaultAttributes[$Tag->name],
                $Tag->attributes
            );
        }
    }
523460
public function removeTag($tag)
    {
        if (is_array($tag))
        {
            foreach ($tag as $t)
            {
                if (isset($this->allowed_tags[$t]))
                    unset($this->allowed_tags[$t]);
                $this->remove_tags[$t] = true;
            }
        }
        else
        {
            if (isset($this->allowed_tags[$tag]))
                unset($this->allowed_tags[$tag]);
            $this->remove_tags[$tag] = true;
        }
        return $this;
    }
517270
public static function add($tag, $behavior, $first = false)
    {
        if (!isset(self::$tags[$tag])) {
            self::$tags[$tag] = [];
        }

        if ($first) {
            array_unshift(self::$tags[$tag], $behavior);
        } else {
            self::$tags[$tag][] = $behavior;
        }
    }
601831
protected void appendTag(CharSequence tag) {
        final TagView newTag = new TagView(getContext(), TagView.STATE_NORMAL, tag);
        newTag.setOnClickListener(mInternalTagClickListener);
        addView(newTag);
    }
503684
public function hasTag($tag)
    {
        if ($this->isTopTag($tag)) {
            return true;
        }

        return isset($this->tags[$tag]) && is_array($this->tags[$tag]);
    }
786449
public function addTemplate( $tag, $fileName, $element = NULL, $overwrite = FALSE )
	{
		$this->addElement( $tag, new self( $fileName, $element ), $overwrite );
	}
870763
public final void removeElementsWithTag(@Nonnull String tag) {
        getElements().stream()
                .map(ElementView::getElement)
                .filter(e -> e.hasTag(tag))
                .forEach(this::removeElement);
    }
565289
public void setTag(TagLibTag tag) {
	tag.setTagLib(this);
	tags.put(tag.getName(), tag);

	if (tag.hasAppendix()) appendixTags.put(tag.getName(), tag);
	else if (appendixTags.containsKey(tag.getName())) appendixTags.remove(tag.getName());
    }
1362667
public static function appendLabel(&$Label, &$Tag, $labelArgs)
    {
        if ($labelArgs['glue'] != false) {
            /*
             * Use glue (no tabs and line breaks between label, seperator and tag)
             */
            if ($labelArgs['pos'] == 'after') {
                self::call('blank', array(trim($Tag).$labelArgs['sep'].trim($Label)));
            } else {
                self::call('blank', array(trim($Label).$labelArgs['sep'].trim($Tag)));
            }
        } else {
            /*
             * Don't use glue.
             */
            if ($labelArgs['pos'] == 'after') {
                echo $Tag;
                if (!empty($labelArgs['sep'])) {
                    self::call('blank', array($labelArgs['sep']));
                }
                echo $Label;
            } else {
                echo $Label;
                if (!empty($labelArgs['sep'])) {
                    self::call('blank', array($labelArgs['sep']));
                }
                echo $Tag;
            }
        }
    }
852117
public function add($tag)
    {
        if (!$tag instanceof TagInterface) {
            throw new \InvalidArgumentException('This tag is not allowed');
        }
        if ($this->isUniqueTag($tag->getName())) {
            $this->removeByName($tag->getName());
        }

        return parent::add($tag);
    }
536866
private static void appendTag(String tag, StringBuilder buffer) {
        if (buffer.length() != 0) {
            buffer.append(UNDERSCORE);
        }

        buffer.append(tag);
    }
872408
@SuppressWarnings("unchecked")
    public T addTag(String tag) {
        if (this.tags_ == null) {
            tags_ = new ArrayList<>();
        }
        this.tags_.add(tag);
        return (T) this;
    }
501571
static public function add($tag,$name) {
        if(!isset(self::$tags[$tag])){
            self::$tags[$tag]   =   array();
        }
        if(is_array($name)){
            self::$tags[$tag]   =   array_merge(self::$tags[$tag],$name);
        }else{
            self::$tags[$tag][] =   $name;
        }
    }
70866
public function pairWith(Tag $tag)
	{
		if ($this->name === $tag->name)
		{
			if ($this->type === self::START_TAG
			 && $tag->type  === self::END_TAG
			 && $tag->pos   >=  $this->pos)
			{
				$this->endTag  = $tag;
				$tag->startTag = $this;

				$this->cascadeInvalidationTo($tag);
			}
			elseif ($this->type === self::END_TAG
			     && $tag->type  === self::START_TAG
			     && $tag->pos   <=  $this->pos)
			{
				$this->startTag = $tag;
				$tag->endTag    = $this;
			}
		}
	}