src/aria/widgets/Text.js
function (textContent) {
            // String cast
            if (textContent !== null) {
                textContent = '' + textContent;
            } else {
                textContent = '';
            }
            var dom = this.getDom();
            if (dom) {
                var stringUtils = ariaUtilsString;
                this.textContent = textContent;

                dom.style.display = "inline-block";
                dom.style.overflow = "hidden";
                dom.style.whiteSpace = "nowrap";
                dom.style.verticalAlign = "top";

                var textWidth, ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0);
                if (!ellipsisElement) {
                    dom.innerHTML = '<span class="createdEllipisElement">' + stringUtils.escapeHTML(this.textContent)
                            + '</span>';
                    ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0);
                }
                if (this._cfg.width > 0) {
                    textWidth = this._cfg.width;
                    dom.style.width = this._cfg.width + "px";

                    this._ellipsis = new ariaUtilsEllipsis(ellipsisElement, textWidth, this._cfg.ellipsisLocation, this._cfg.ellipsis, this._context, this._cfg.ellipsisEndStyle);

                    if (!this._ellipsis.ellipsesNeeded) {
                        // No ellipsis was done so remove the <span> and put the full text into the text widget itself
                        dom.removeChild(ellipsisElement);
                        dom.innerHTML = stringUtils.escapeHTML(textContent);
                    }
                }

            }

        }
function (textContent) {
            // String cast
            if (textContent !== null) {
                textContent = '' + textContent;
            } else {
                textContent = '';
            }
            var dom = this.getDom();
            if (dom) {
                var stringUtils = ariaUtilsString;
                this.textContent = textContent;

                dom.style.display = "inline-block";
                dom.style.overflow = "hidden";
                dom.style.whiteSpace = "nowrap";
                dom.style.verticalAlign = "top";

                var textWidth, ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0);
                if (!ellipsisElement) {
                    dom.innerHTML = '<span class="createdEllipisElement">' + stringUtils.escapeHTML(this.textContent)
                            + '</span>';
                    ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0);
                }
                if (this._cfg.width > 0) {
                    textWidth = this._cfg.width;
                    dom.style.width = this._cfg.width + "px";

                    this._ellipsis = new ariaUtilsEllipsis(ellipsisElement, textWidth, this._cfg.ellipsisLocation, this._cfg.ellipsis, this._context, this._cfg.ellipsisEndStyle);

                    if (!this._ellipsis.ellipsesNeeded) {
                        // No ellipsis was done so remove the <span> and put the full text into the text widget itself
                        dom.removeChild(ellipsisElement);
                        dom.innerHTML = stringUtils.escapeHTML(textContent);
                    }
                }

            }

        }
function ( textContent ) { // String cast if ( textContent !== null ) { textContent = '' + textContent ; } else { textContent = '' ; } var dom = this . getDom ( ) ; if ( dom ) { var stringUtils = ariaUtilsString ; this . textContent = textContent ; dom . style . display = "inline-block" ; dom . style . overflow = "hidden" ; dom . style . whiteSpace = "nowrap" ; dom . style . verticalAlign = "top" ; var textWidth , ellipsisElement = ariaUtilsDom . getDomElementChild ( dom , 0 ) ; if ( ! ellipsisElement ) { dom . innerHTML = '<span class="createdEllipisElement">' + stringUtils . escapeHTML ( this . textContent ) + '</span>' ; ellipsisElement = ariaUtilsDom . getDomElementChild ( dom , 0 ) ; } if ( this . _cfg . width > 0 ) { textWidth = this . _cfg . width ; dom . style . width = this . _cfg . width + "px" ; this . _ellipsis = new ariaUtilsEllipsis ( ellipsisElement , textWidth , this . _cfg . ellipsisLocation , this . _cfg . ellipsis , this . _context , this . _cfg . ellipsisEndStyle ) ; if ( ! this . _ellipsis . ellipsesNeeded ) { // No ellipsis was done so remove the <span> and put the full text into the text widget itself dom . removeChild ( ellipsisElement ) ; dom . innerHTML = stringUtils . escapeHTML ( textContent ) ; } } } }
Check if the width of text is too long and if so, ellipse it
@param {String} textContent the text to be ellipsed
@private
Check if the width of text is too long and if so ellipse it