My Web Log Book

MooTools class keyword breaks in Safari

Having test the app in Chrome and Firefox, I happily strolled to Safari in a delightful mood only to find a blank page and JavaScript errors, yikes. After some digging on Google, I found the problem. Safari is not only backward compliant but forward compliant too. The class keyword that is very often used while creating an Element in MooTools is a future reserved keyword in ECMAScript language specification ECMA-262. Don’t believe me? Check it out for yourself at http://www.ecma-international.org/publications/standards/Ecma-262.htm

Not a huge problem and we have to quote the class keyword. So something like this:

var container = new Element("div", {class: "link"});

now becomes this. Note the quotes around class

var container = new Element("div", {"class": "link"});

And we’re good to go!

  1. vombat posted this