What is “.el” in relationship to JavaScript/HTML/jQuery?

后端 未结 4 1902
梦如初夏
梦如初夏 2021-02-19 04:13

I couldn\'t find much from Googling, but I\'m probably Googling the wrong terms.

I\'m trying to understand what the \"el\" in \"$.el\" is from here: http://joestelmach.g

相关标签:
4条回答
  • 2021-02-19 04:43

    It creates a tree of elements and appends them to body

    0 讨论(0)
  • 2021-02-19 04:52

    el is just an identifier and it refers to an element, a DOM element, which is a convention in that library.

    0 讨论(0)
  • 2021-02-19 04:52

    el is a function that's been placed on the $ object, and can be invoked to generate DOM elements:

    $.el('table')
    

    el also acts as a placeholder for other objects, like the table function:

    $.el.table()
    
    0 讨论(0)
  • 2021-02-19 05:03

    You can obtain the explanation seeing the source of the project in the 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;
      }
    

    The code means that $.el namespace will have the function laconic() and this function create elements using document.createElement and append to the body.

    0 讨论(0)
提交回复
热议问题