什么是".el"与JavaScript/HTML/jQuery的关系?

A L*_*A L 15 html javascript jquery

我从谷歌搜索中找不到多少,但我可能在谷歌搜索错误的条款.

我试图理解"$ .el"中的"el"来自这里:http://joestelmach.github.com/laconic/

$.el.table(
  $.el.tr(
    $.el.th('first name'),
    $.el.th('last name')),
  $.el.tr(
    $.el.td('Joe'),
    $.el.td('Stelmach'))
).appendTo(document.body);
Run Code Online (Sandbox Code Playgroud)

提前致谢!

und*_*ned 23

el 它只是一个标识符,它引用一个元素,一个DOM元素,它是该库中的约定.

  • 我想知道这是不是一个惯例.所以通常人们使用'el'来表示他们正在处理的任何DOM元素?这是惯例吗? (2认同)

Sér*_*els 5

您可以在github中获取有关项目的说明:

// If we're in a CommonJS environment, we export our laconic methods
  if(typeof module !== 'undefined' && module.exports) {
    module.exports = laconic;
  } 

  // otherwise, we attach them to the top level $.el namespace
  else {
    var dollar = context.$ || {};
    dollar.el = laconic;
    context.$ = dollar;
  }
Run Code Online (Sandbox Code Playgroud)

代码意味着$ .el命名空间将具有该函数,laconic()并且此函数使用并附加到正文创建元素document.createElement.