How to use the jquery.trim function in jquery

To help you get started, we’ve selected a few jquery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / incubator-echarts-doc / public / en / js / docTool / schemaHelper.js View on Github external
schemaHelper.parseOptionPath = function (optionPath, options) {
        options = options || {};
        var errorInfo = 'Path is illegal: \'' + optionPath + '\'';
        dtLib.assert(
            optionPath && (optionPath = $.trim(optionPath)), errorInfo
        );
        // 因为mark down的url中不支持小括号(marked实现太简单了),所以小括号改用减号,数组不再用减号。
        // URL中的数组,不写[i]。
        // optionPath = optionPath.replace(/\-i/g, '-i]'); // 兼容 series-i表示数组的情况。
        var pathArr = optionPath.split(/\.|\[/);
        var retArr = [];

        for (var i = 0, len = pathArr.length; i < len; i++) {
            var itemStr = $.trim(pathArr[i]);
            if (options.ignoreEmptyItem && itemStr === '') {
                continue;
            }
            // 因为mark down的url中不支持小括号(marked实现太简单了),所以不用小括号,改用减号表示type。
            // match: 'asdf-bb' 'asdf-' 'i]-bb' 'i]-' 'asdf' 'i]'
            var regResult = itemStr.match(PATH_ITEM_REG) || [];
github chenhongdong / article / SVG / subway_pc / src / js / components / routeplan.js View on Github external
if (rc) {
                    isRc = true
                    pathStr += `Q${x} ${y} `;
                } else {
                    if (j == 0) {
                        pathStr += `M${x} ${y} `;
                    } else {
                        pathStr += `L${x} ${y} `;
                    }
                }
            }
        }
        // 绘制线路path
        let path = createSvg('path').appendTo(g);
        path.attr({
            d: $.trim(pathStr),
            stroke: `#${color}`
        });
    }
}
github nhn / tui.grid / test / unit / js / common / util.spec.js View on Github external
it('button과 anchor가 둘다 포함된 경우 button은 태그 사이 내용 모두 제거하고 anchor는 태그만 제거한다', function() {
            var htmlStr = $.trim($('#button').html()) + $.trim($('#anchor').html()),
                expectStr = 'ButtonEnd of ExampleAnchor LinkEnd of Example';
            expect(util.stripTags(htmlStr)).toBe(expectStr);
        });
    });
github amazeui / amazeui-sass / js / core.js View on Github external
self.each(function(i, it) {
    var cn = ' ' + it.className + ' ';
    while (classPattern.test(cn)) {
      cn = cn.replace(classPattern, ' ');
    }
    it.className = $.trim(cn);
  });
github cgravolet / scroblr / src / js / plugins / beats.js View on Github external
beats.scrape = function () {
    var player = $("#app__transport");
    var durationElapsed = $.trim($(".horizontal_bar__handle").text()).split(" | ");
    var info = {};

    if (!player.length) {
        return false;
    }

    if (durationElapsed.length === 2) {
        info.duration = Utils.calculateDuration(durationElapsed[1]);
        info.elapsed  = Utils.calculateDuration(durationElapsed[0]);
    }

    info.artist   = $(".artist-track-target .artist", player).text();
    info.stopped  = $("#play_pause_icon").hasClass("icon-bicons_play");
    info.title    = $(".artist-track-target .track", player).text();

    return info;
github cyverse / troposphere / troposphere / static / js / components / modals / instance / image / steps / ImageInfoStep.react.js View on Github external
onNext: function () {
      this.props.onNext({
        name: $.trim(this.state.name),
        description: $.trim(this.state.description),
        imageTags: this.state.imageTags,
        newImage: this.state.newImage
      });
    },
    setNameError: function (newName) {
github mtth / avsc / js / index.js View on Github external
typingTimer = setTimeout(function() {
        if(updateContent(inputElement)) {
          var rawInput = $.trim(inputElement.text());        
          eventObj.trigger('input-changed', rawInput);
        };
      }, doneTypingInterval);
    }).on('keydown', function() {
github cyverse / troposphere / troposphere / static / js / components / modals / instance / image / steps / ImageInfoStep.jsx View on Github external
onNext: function() {
        this.props.onNext({
            name: $.trim(this.state.name),
            description: $.trim(this.state.description),
            imageTags: this.state.imageTags,
            newImage: this.state.newImage
        });
    },
    setNameError: function(newName) {
github oTranscribe / oTranscribe / src / js / app / texteditor.js View on Github external
function countWords(str){
    var trimmedStr = $.trim(str);
    if (trimmedStr){
        return trimmedStr.match(/\S+/gi).length;
    }
    return 0;
}
github liuyunzhuge / blog / form / dist / js / mod / listView / tableView.js View on Github external
function class2Selector(classStr) {
        return ('.' + $.trim(classStr)).replace(/\s+/g, '.');
    }