DOM Elements Creator
- 授权协议: 未知
- 开发语言:
- 操作系统: 未知
- 软件首页: http://plugins.jquery.com/project/DOMEC
软件介绍
What is it?
DOM Elements Creator is a simple plugin for creating DOM elements on-a-fly which can be used as part of jQuery statements.
When you want to create new DOM element in pure jQuery you must use document.createElement() method and then new element must be wrapped in $() before it can be used in jQuery context. You can also use HTML code as a selector to create a new object but this way requires writing HTML, which is rarely comfortable. And you must also remember to espace any quotes.
This plugin provides more elegant way to achieve the same effect and requires writting less code.
How to use it?
Just import plugin file after importing the jQuery library and you're set.
Syntax:
$.create(element[, attributes[, children]])
Parameters:
- string
element- name of the element to create - object|array
attributes- element properties to be set, you shouln't use events attributes here such as onclick, onmouseover etc. since they won't work - string|array
children- child elements (could also contain text value)
Example:
- JavaScript/jQuery approach:
var div = document.createElement('div');
$(div).attr('id', 'myId').text('myText').appendTo('#myElem'); - standard jQuery approach:or
$('<div>').attr('id', 'myId').text('myText').appendTo('#myElem');$('<div id="myId">myText</div>').appendTo('#myElem'); - plugin approach:
$.create('div', {'id': 'myId'}, 'myText').appendTo('#myElem');
Incompatible changes
0.3
Plugin function was renamed from $.new to $.create to fix issues on Internet Explorer.
Rust编程之道
张汉东 / 电子工业出版社 / 2019-1 / 128
Rust 是一门利用现代化的类型系统,有机地融合了内存管理、所有权语义和混合编程范式的编程语言。它不仅能科学地保证程序的正确性,还能保证内存安全和线程安全。同时,还有能与C/C++语言媲美的性能,以及能和动态语言媲美的开发效率。 《Rust编程之道》并非对语法内容进行简单罗列讲解,而是从四个维度深入全面且通透地介绍了Rust 语言。从设计哲学出发,探索Rust 语言的内在一致性;从源码分析入......一起来看看 《Rust编程之道》 这本书的介绍吧!
