mootools 元素追加
As we were so excited to announce last week, MooTools 1.3 beta has been released. MooTools 1.3 marks the introduction of Slick, an ultra flexible, ultra powerful selector engine created by Thomas Aylott, Fabio Costa, and Valerio Proietti. As the release blog post cited:
上周我们很高兴地宣布, MooTools 1.3 beta已发布 。 MooTools 1.3标志着Slick的推出, Slick是由Thomas Aylott , Fabio Costa和Valerio Proietti创建的超灵活,超强大的选择器引擎。 如发布博客文章所述:
- Slick is an independent project; it may be implemented in any framework that is flexible enough to allow it. Slick是一个独立的项目; 它可以在足够灵活的框架中实现。
- Slick is much, much faster than the MooTools 1.2 selector engine. Slick比MooTools 1.2选择器引擎快得多。
- Supports just about every selector you can think of. 支持几乎所有您能想到的选择器。
- Slick has a detached parser. You can parse a CSS-style-selector string and get back a property-filled object. Slick具有独立的解析器。 您可以解析CSS样式选择器字符串,并获取一个填充属性的对象。
- Supports XML documents. 支持XML文档。
- Slick is so customizable that you can create your own Pseudo Selectors and Attribute Selectors. Slick是可定制的,因此您可以创建自己的伪选择器和属性选择器。
And if that's not enough, MooTools 1.3 has flawlessly incorporated Slick to allow you to create new elements on the fly. Check this out!
而且,如果这还不够的话,MooTools 1.3完美地整合了Slick,可以让您即时创建新元素。 看一下这个!
MooTools和Slick速记元素创建 (MooTools & Slick Shorthand Element Creation)
var div = new Element('div');
//creates <div />
The above snippet creates a DIV element. Too simple, lets get a bit trickier.
上面的代码段创建了一个DIV元素。 太简单了,让我们变得有些棘手。
var div = new Element('div.myClass');
//creates <div class="myClass" />
The above snippet creates a DIV element with a myClass CSS class. Still too simple.
上面的代码片段使用myClass CSS类创建了DIV元素。 还是太简单了。
var div = new Element('div#myId.myClass.myOtherClass[title=My Title][text=Element Inner Text]');
//creates <div class="myClass myOtherClass" title="My Title">Element Inner Text</div>
The above snippet creates a DIV element with an ID, CSS classes, a title attribute, and the text "My Text." I mean that's just stupid cool slick, right?
上面的代码段创建了一个具有ID,CSS类,title属性和文本“ My Text”的DIV元素。 我的意思是,这只是愚蠢的凉爽光滑的,对不对?
Slick is just one great enhancement within MooTools 1.3. Even if you don't use MooTools, you can still use Slick within your framework or project. Be sure to download Slick for your own work. Oh...an that small MooTools 1.3 thing too....
Slick只是MooTools 1.3中的一项重大增强。 即使您不使用MooTools,您仍然可以在框架或项目中使用Slick。 确保下载Slick进行自己的工作。 哦...那也是MooTools 1.3的小东西...
mootools 元素追加