Positions the tooltip.<p>


@param elem the tooltip element
@param referenceElement the tooltip icon element
505135
public static void position(Element elem, Element referenceElement) {

        int dy = 25;
        Style style = elem.getStyle();
        style.setLeft(0, Unit.PX);
        style.setTop(0, Unit.PX);
        int myX = elem.getAbsoluteLeft();
        int myY = elem.getAbsoluteTop();
        int refX = referenceElement.getAbsoluteLeft();
        int refY = referenceElement.getAbsoluteTop();
        int refWidth = referenceElement.getOffsetWidth();
        int newX = (refX - myX - ((2 * elem.getOffsetWidth()) / 3)) + (refWidth / 2);
        int newY = (refY - myY) + dy;
        style.setLeft(newX, Unit.PX);
        style.setTop(newY, Unit.PX);
    }
848673
function( elem ) {

		// No argument, return index in parent
		if ( !elem ) {
			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
		}

		// index in selector
		if ( typeof elem === "string" ) {
			return indexOf.call( jQuery( elem ), this[ 0 ] );
		}

		// Locate the position of the desired element
		return indexOf.call( this,

			// If it receives a jQuery object, the first element is used
			elem.jquery ? elem[ 0 ] : elem
		);
	}
242131
public static void removeFromParent(Element elem) {
    if(elem != null && elem.getParentNode() != null) {
      elem.getParentNode().removeChild(elem);
    }
  }
354961
public void highlightElement() {

        CmsPositionBean position = CmsPositionBean.getBoundingClientRect(getElement());
        if (m_highlighting == null) {
            m_highlighting = new CmsHighlightingBorder(
                position,
                isNew() || (CmsContainerpageController.get().getData().isModelPage() && isCreateNew())
                ? CmsHighlightingBorder.BorderColor.blue
                : CmsHighlightingBorder.BorderColor.red);
            RootPanel.get().add(m_highlighting);
        } else {
            m_highlighting.setPosition(position);
        }
    }
311490
private void putElement(final String elemName, final Attributes atts, final boolean removeConref) throws SAXException {
        //parameter boolean removeConref specifies whether to remove
        //conref information like @conref @conaction in current element
        //when copying it to pushcontent. True means remove and false means
        //not remove.
        final Set<String> namespaces = new HashSet<>();
        try {
            pushcontentWriter.writeStartElement(elemName);
            for (int index = 0; index < atts.getLength(); index++) {
                final String name = atts.getQName(index);
                if (!removeConref ||
                        !ATTRIBUTE_NAME_CONREF.equals(name) && !ATTRIBUTE_NAME_CONACTION.equals(name)) {
                    String value = atts.getValue(index);
                    if (ATTRIBUTE_NAME_HREF.equals(name) || ATTRIBUTE_NAME_CONREF.equals(name)) {
                        // adjust href for pushbefore and replace
                        value = replaceURL(value);
                    }
                    final int offset = atts.getQName(index).indexOf(":");
                    final String prefix = offset != -1 ? atts.getQName(index).substring(0, offset) : "";
                    if (!namespaces.contains(prefix)) {
                        namespaces.add(prefix);
                        if (!prefix.isEmpty()) {
                            pushcontentWriter.writeNamespace(prefix, atts.getURI(index));
                        }
                    }
                    pushcontentWriter.writeAttribute(prefix, atts.getURI(index), atts.getLocalName(index), value);
                }
            }
            //id attribute should only be added to the starting element
            //which dosen't have id attribute set
            if (ATTR_CONACTION_VALUE_PUSHREPLACE.equals(pushType) &&
                    atts.getValue(ATTRIBUTE_NAME_ID) == null &&
                    level == 1) {
                final String fragment = target.getFragment();
                if (fragment == null) {
                    //if there is no '#' in target string, report error
                    logger.error(MessageUtils.getMessage("DOTJ041E", target.toString()).toString());
                } else {
                    String id;
                    //has element id
                    if (fragment.contains(SLASH)) {
                        id = fragment.substring(fragment.lastIndexOf(SLASH) + 1);
                    } else {
                        id = fragment;
                    }
                    //add id attribute
                    pushcontentWriter.writeAttribute(ATTRIBUTE_NAME_ID, id);
                }
            }
        } catch (final XMLStreamException e) {
            throw new SAXException(e);
        }
    }
949130
function getPosition(el) {
	var p = { left: el.offsetLeft, top: el.offsetTop };
	el = el.offsetParent;
	while (el) {
		p.left += el.offsetLeft;
		p.top += el.offsetTop;
		if (el !== doc.body && el !== doc.documentElement) {
			p.left -= el.scrollLeft;
			p.top -= el.scrollTop;
		}
		el = el.offsetParent;
	}
	return p;
}
1026875
public void setElementOptionBar(CmsElementOptionBar elementOptionBar) {

        if ((m_elementOptionBar != null) && (getWidgetIndex(m_elementOptionBar) >= 0)) {
            m_elementOptionBar.removeFromParent();
        }
        m_elementOptionBar = elementOptionBar;
        if (m_elementOptionBar != null) {
            getElement().addClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragElement());
            insert(m_elementOptionBar, 0);
            updateOptionBarPosition();
        } else {
            getElement().removeClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragElement());
        }
    }
67677
@Override
    public void startElementContents(ElementBox elem)
    {
        if (!elem.isReplaced())
        {
            SimpleAttributeSet attr = buildElement(elem);
            attr.addAttribute(Constants.ATTRIBUTE_DRAWING_ORDER, order++);
            elements.add(new ElementSpec(attr, ElementSpec.StartTagType, "{".toCharArray(), 1, 0));
        }
    }
345947
private void applyAbsolutePosition(Element element, Coordinate position) {
		Dom.setStyleAttribute(element, "position", "absolute");
		Dom.setStyleAttribute(element, "left", (int) position.getX() + "px");
		Dom.setStyleAttribute(element, "top", (int) position.getY() + "px");
	}
1080348
protected void writeReference(long offset, Object reference) {
        assert referenceMessageSize != 0 : "References are not in use";
        // Is there a way to compute the element offset once and just
        // arithmetic?
        UnsafeRefArrayAccess.spElement(references, UnsafeRefArrayAccess.calcElementOffset(offset), reference);
    }
204804
private void fixInlineElement(Element e) {
    if (e.getClientHeight() == 0 && e.getClientWidth() == 0
        && "inline".equals(curCSS(e, "display", true))) {
      setStyleProperty(e, "display", "inline-block");
      setStyleProperty(e, "width", "auto");
      setStyleProperty(e, "height", "auto");
    }
  }
491707
function placeCaret(el, position) {
    var range, sel;

    range = document.createRange();
    sel = window.getSelection();
    range.setStart(el.childNodes[0], position);
    range.collapse(true);
    sel.removeAllRanges();
    sel.addRange(range);
}
516392
public void setElement(int treap_node_index, int newElement) {
		if (m_comparator != null)
			m_comparator.onSetImpl_(this, treap_node_index);
		setElement_(treap_node_index, newElement);
	}
100705
function (elem)
    {
        var i, el, j, tag, attribute, value, css, cssAttrs, attr, cssName, cssValue;
        if (elem.nodeType == Strophe.ElementType.NORMAL) {
            tag = elem.nodeName;
            if(Strophe.XHTML.validTag(tag)) {
                try {
                    el = Strophe.xmlElement(tag);
                    for(i = 0; i < Strophe.XHTML.attributes[tag].length; i++) {
                        attribute = Strophe.XHTML.attributes[tag][i];
                        value = elem.getAttribute(attribute);
                        if(typeof value == 'undefined' || value === null || value === '' || value === false || value === 0) {
                            continue;
                        }
                        if(attribute == 'style' && typeof value == 'object') {
                            if(typeof value.cssText != 'undefined') {
                                value = value.cssText; // we're dealing with IE, need to get CSS out
                            }
                        }
                        // filter out invalid css styles
                        if(attribute == 'style') {
                            css = [];
                            cssAttrs = value.split(';');
                            for(j = 0; j < cssAttrs.length; j++) {
                                attr = cssAttrs[j].split(':');
                                cssName = attr[0].replace(/^\s*/, "").replace(/\s*$/, "").toLowerCase();
                                if(Strophe.XHTML.validCSS(cssName)) {
                                    cssValue = attr[1].replace(/^\s*/, "").replace(/\s*$/, "");
                                    css.push(cssName + ': ' + cssValue);
                                }
                            }
                            if(css.length > 0) {
                                value = css.join('; ');
                                el.setAttribute(attribute, value);
                            }
                        } else {
                            el.setAttribute(attribute, value);
                        }
                    }

                    for (i = 0; i < elem.childNodes.length; i++) {
                        el.appendChild(Strophe.createHtml(elem.childNodes[i]));
                    }
                } catch(e) { // invalid elements
                  el = Strophe.xmlTextNode('');
                }
            } else {
                el = Strophe.xmlGenerator().createDocumentFragment();
                for (i = 0; i < elem.childNodes.length; i++) {
                    el.appendChild(Strophe.createHtml(elem.childNodes[i]));
                }
            }
        } else if (elem.nodeType == Strophe.ElementType.FRAGMENT) {
            el = Strophe.xmlGenerator().createDocumentFragment();
            for (i = 0; i < elem.childNodes.length; i++) {
                el.appendChild(Strophe.createHtml(elem.childNodes[i]));
            }
        } else if (elem.nodeType == Strophe.ElementType.TEXT) {
            el = Strophe.xmlTextNode(elem.nodeValue);
        }

        return el;
    }
1275623
private void call(final Element e, final String arg) {
        JQuery.jQuery(e).tooltip(arg);
    }
283845
function setOffset(elem, offset) {
  // set position first, in-case top/left are set even on static elem
  if (css(elem, 'position') === 'static') {
    elem.style.position = 'relative';
  }

  var old = getOffset(elem);
  var ret = {};
  var current = undefined;
  var key = undefined;

  for (key in offset) {
    if (offset.hasOwnProperty(key)) {
      current = parseFloat(css(elem, key)) || 0;
      ret[key] = current + offset[key] - old[key];
    }
  }
  css(elem, ret);
}
1281110
function setLeftTop(elem, offset, option) {
  // set position first, in-case top/left are set even on static elem
  if (css(elem, 'position') === 'static') {
    elem.style.position = 'relative';
  }
  let presetH = -999;
  let presetV = -999;
  const horizontalProperty = getOffsetDirection('left', option);
  const verticalProperty = getOffsetDirection('top', option);
  const oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
  const oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);

  if (horizontalProperty !== 'left') {
    presetH = 999;
  }

  if (verticalProperty !== 'top') {
    presetV = 999;
  }
  let originalTransition = '';
  const originalOffset = getOffset(elem);
  if ('left' in offset || 'top' in offset) {
    originalTransition = getTransitionProperty(elem) || '';
    setTransitionProperty(elem, 'none');
  }
  if ('left' in offset) {
    elem.style[oppositeHorizontalProperty] = '';
    elem.style[horizontalProperty] = `${presetH}px`;
  }
  if ('top' in offset) {
    elem.style[oppositeVerticalProperty] = '';
    elem.style[verticalProperty] = `${presetV}px`;
  }
  // force relayout
  forceRelayout(elem);
  const old = getOffset(elem);
  const originalStyle = {};
  for (const key in offset) {
    if (offset.hasOwnProperty(key)) {
      const dir = getOffsetDirection(key, option);
      const preset = key === 'left' ? presetH : presetV;
      const off = originalOffset[key] - old[key];
      if (dir === key) {
        originalStyle[dir] = preset + off;
      } else {
        originalStyle[dir] = preset - off;
      }
    }
  }
  css(elem, originalStyle);
  // force relayout
  forceRelayout(elem);
  if ('left' in offset || 'top' in offset) {
    setTransitionProperty(elem, originalTransition);
  }
  const ret = {};
  for (const key in offset) {
    if (offset.hasOwnProperty(key)) {
      const dir = getOffsetDirection(key, option);
      const off = offset[key] - originalOffset[key];
      if (key === dir) {
        ret[dir] = originalStyle[dir] + off;
      } else {
        ret[dir] = originalStyle[dir] - off;
      }
    }
  }
  css(elem, ret);
}