How to Use MooTools Element Methods in an iFrame Element

Ever create an iFrame and wanted to use MooTools Elements methods in them, but you couldn\’t? One solution is to add a <script> element whose src attribute points to a MooTools JavaScript file. Instead of doing that, you could just use the MooTools that is loaded in the parent page! Continue reading How to Use MooTools Element Methods in an iFrame Element

Dedupe an Array with MooTools

shanebo asked on IRC today:

twhat is ze cleanest way to remove duplicate items from an array

I wrote a few solutions until I got what I think is a fairly quick and short snippet to remove duplicate items in an array. It\’s really basic. There are probably a few cases this doesn\’t cover.. such as objects with different ordered items but containing the same contents. I also didn\’t test these solutions for their performance. Continue reading Dedupe an Array with MooTools

Date.now!

Here\’s a little cool snippet I picked up from MDN. It\’s how to implement the Date.now method in browsers that don\’t currently support it. The method returns a number value in milliseconds from 1 January 1970 00:00:00 UTC till now.

if (!Date.now) {
  Date.now = function now() {
    return +(new Date);
  };
}

MooTools Core Has Your (Element.NativeEvents) Back

While scanning through MooTools-Core code the other day, I came across Element.NativeEvents and forgot what the value in each property meant. I remember asking MooTools-Core devs about it probably three to four times. You may be wondering \”What\’s the point?\” Well, let me tell you. Continue reading MooTools Core Has Your (Element.NativeEvents) Back

MooTools Core 1.3.2 and More 1.3.2.1

MooTools just released an update to their Core and More libs. They are mostly fixes but More also comes with a brand new and shiny new Utility class called Tables!

Changes (and I quote!) to Core

  • Fixed Slick bug with ~div-like selectors
  • Fixed MooTools in the Node.js environment
  • Fixed an exception in DOMReady in Chrome when the page with MooTools was in an IFrame
  • Fixed setOpacity for very small numbers in IE
  • Fixed an exception in FireFox 4 when MooTools tried to overwrite document.head
  • Added the possibility to create elements with boolean values with an selector, e.g. new Element(\’input[checked]\’);

Changes to More (that I also quote):

  • Rewritten Element.Position which solved some issues
  • Added Table, as described above
  • Ironed out some Event Delegation issues
  • Additional fixes can be found at the Lighthouse for 1.3.2.1

Yay, MooTools developers! You guys are seriously stepping up with a quicker release. In the words of my friend David Walsh: MooTools FTW!

Smarty Debug with Firebug

I use Smarty, a template engine, at work. One of the most awesome things about it is the debug window, where it can list all the templates being used and variables that are available.

Mike Horn shared with me how a user, named Hipska, created a Smarty debug template file that works with Firebug. I thought it was so awesome and decided to share it with you too, but with a slight tweak of my own. Continue reading Smarty Debug with Firebug

Sly, New Selector Engine & How to Use in MooTools

You\’ve heard of selector engines right? The engine that parses the HTML to match a string argument to return matching HTML elements? How about Sizzle and Peppy (two fast selector engines) that was released? Or how a couple JS frameworks were implementing Sizzle and the MooTools dev team decided not to follow suit?

Now, have you heard of Sly, the new selector engine on the block? No? That\’s because Harald Kirschner just released it yesterday, 03/25/09, and I can\’t tell you how awesome it is.. or can I?

I\’ll start you off with a brief description… and graphs! Continue reading Sly, New Selector Engine & How to Use in MooTools

Solution to Flash and Select Drop-downs Covering HTML Elements

I\’ve positioned elements absolutely and had to deal with a bug where the element appears below a flash object or select drop-downs, which usually occurs in IE. I\’ve seen a few solutions, which work great, and I have one more to add. Continue reading Solution to Flash and Select Drop-downs Covering HTML Elements