peppa pig原版
This post has been updated after more tinkering and testing.
经过更多修补和测试后,此帖子已更新。
A while back James Donaghue boasted his new selector engine Peppy. Lets say for giggles that we wanted to use MooTools and Peppy together. Here's how I got things to work.
前一阵子James Donaghue吹嘘自己的新选择器引擎Peppy 。 可以说我们想同时使用MooTools和Peppy。 这就是我要使工作正常的方式。
JavaScript (The JavaScript)
//sets peppy as the default engine
Window.$$ = function(selector){
return new Elements(new peppy.query(selector));
}
//get elements
window.addEvent('domready',function() {
$$('div').each(function(el) { // straight cash homey
el.setStyle('color','#f00');
});
});
I have no idea why you'd want to do this; MooTools' selector engine is rock solid. I was simply playing around and wanted to show you what I came up with.
我不知道你为什么要这么做; MooTools的选择器引擎坚如磐石。 我只是在玩耍,想向您展示我的想法。
peppa pig原版