/documentation/appframework/$.create.md
Markdown | 50 lines | 31 code | 19 blank | 0 comment | 0 complexity | 048abcb65f1c7dc451c02e2aae995854 MD5 | raw file
- #$.create(type,[params])
- ```
- $.create - a faster alertnative to $("this is some text");
- ```
- ##Example
- ```
- $.create("div",{id:"main",innerHTML:"this is some text"});
- $.create("this is some text");
- ```
- ##Parameters
- ```
- DOM String
- properties [Object]
- ```
- ##Returns
- ```
- Object Returns an appframework object
- ```
- ##Detail
- $.create(type,[params]) is new for 2.0. It is a faster, and sometimes "safter" way to create DOM Nodes.
- $.create allows you to bypass logic inside the $() engine and jump right to element creation. It returns an App Framework collection.
- $.create works two ways.
- <ol>
- <li>Parse a string and return the DOM elements (slower)</li>
- <li>Create the element using document.createElement and setting properties (faster)</li>
- </ol>
- Below are two examples that provide the same node. The first is faster.
- ```
- var faster=$.create("div",{id:"test",html:"Test HTML"})
- var slower=$.create(" < div id='test'>Test HTML< /div> ");
- ```