1

我正在开发一个 javascript,库语法如下tex(selector).function(specifier):这是我到目前为止所拥有的:

(function(){
    var tex = function(selector,context){
                //code

    },
    tex.prototype = {
         show: function () {
             this.style.display = "inherit";
             return this
         }
    };
    window.tex = tex
})();

我遇到的问题是如何设置this元素。有谁知道我怎么能用 jQuery 的方式做到这一点?

谢谢大家的帮助。

4

1 回答 1

1

也许尝试:

if (document.querySelectorAll(selector==null || undefined) {
//nothing there

} else {
tex = document.querySelectorAll(selector);
}
于 2013-10-12T03:51:40.290 回答