Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Resync with official repo

  • Loading branch information...
commit a8a84ed9314465dfb34bf09677e1b4b35311ca29 2 parents ed205ff + dde429a
@fakedarren fakedarren authored
Showing with 3,432 additions and 2,195 deletions.
  1. +0 −1  .gitignore
  2. +3 −0  .gitmodules
  3. +0 −24 CHANGELOG
  4. +25 −4 Docs/{Core → Browser}/Browser.md
  5. +195 −194 Docs/Core/Core.md
  6. +8 −1 Docs/Element/Element.Dimensions.md
  7. +1 −1  Docs/Element/Element.Event.md
  8. +1 −1  Docs/Element/Element.Style.md
  9. +1 −1  Docs/Fx/Fx.CSS.md
  10. 0  Docs/Request/Request.HTML.md
  11. 0  Docs/Request/Request.JSON.md
  12. 0  Docs/Request/Request.md
  13. +198 −0 Docs/Slick/Slick.md
  14. +172 −101 Docs/{Native → Types}/Array.md
  15. +18 −0 Docs/Types/Event.md
  16. +196 −81 Docs/{Native → Types}/Function.md
  17. +13 −4 Docs/{Native → Types}/Hash.md
  18. +61 −11 Docs/{Native → Types}/Number.md
  19. +76 −50 Docs/{Native → Types}/String.md
  20. +1 −1  Docs/Utilities/Cookie.md
  21. +1 −1  Docs/Utilities/DomReady.md
  22. 0  Docs/Utilities/JSON.md
  23. +7 −3 Docs/Utilities/Selectors.md
  24. +1 −1  Docs/Utilities/Swiff.md
  25. +1 −1  Docs/license.md
  26. +1 −0  Packager
  27. +243 −0 Source/Browser/Browser.js
  28. +14 −11 Source/Class/Class.Extras.js
  29. +83 −118 Source/Class/Class.js
  30. +0 −168 Source/Core/Browser.js
  31. +345 −174 Source/Core/Core.js
  32. +12 −13 Source/Element/Element.Dimensions.js
  33. +7 −9 Source/Element/Element.Event.js
  34. +29 −13 Source/Element/Element.Style.js
  35. +261 −247 Source/Element/Element.js
  36. +15 −13 Source/Fx/Fx.CSS.js
  37. +4 −5 Source/Fx/Fx.Morph.js
  38. +9 −8 Source/Fx/Fx.Transitions.js
  39. +4 −5 Source/Fx/Fx.Tween.js
  40. +11 −13 Source/Fx/Fx.js
  41. +0 −128 Source/Native/Event.js
  42. +8 −10 Source/Request/Request.HTML.js
  43. +3 −4 Source/Request/Request.JSON.js
  44. +21 −26 Source/Request/Request.js
  45. +841 −0 Source/Slick/Slick.Finder.js
  46. +229 −0 Source/Slick/Slick.Parser.js
  47. +43 −15 Source/{Native → Types}/Array.js
  48. +116 −0 Source/Types/Event.js
  49. +32 −14 Source/{Native → Types}/Function.js
  50. +5 −6 Source/{Native → Types}/Hash.js
  51. +6 −8 Source/{Native → Types}/Number.js
  52. +3 −15 Source/{Native → Types}/String.js
  53. +5 −6 Source/Utilities/Cookie.js
  54. +16 −14 Source/Utilities/DomReady.js
  55. +6 −19 Source/Utilities/JSON.js
  56. +0 −376 Source/Utilities/Selectors.js
  57. +8 −10 Source/Utilities/Swiff.js
  58. +0 −167 Source/scripts.json
  59. +1 −1  Specs
  60. +29 −0 build
  61. +0 −98 build.rb
  62. +43 −0 package.yml
View
1  .gitignore
@@ -1,4 +1,3 @@
-mootools.js
mootools-core.js
mootools-core.tmproj
mootools-core.esproj
View
3  .gitmodules
@@ -4,6 +4,9 @@
[submodule "Tests/UnitTester"]
path = Tests/UnitTester
url = git://github.com/anutron/mootools-unittester.git
+[submodule "Packager"]
+ path = Packager
+ url = git://github.com/kamicane/packager.git
[submodule "Specs"]
path = Specs
url = git://github.com/mootools/mootools-core-specs.git
View
24 CHANGELOG
@@ -1,24 +0,0 @@
-MooTools 1.2.1 - October 16th, 2008
-
-[ADD] Element.set('html') now allows to set the innerHTML of all Elements (including tables and selects)
-[ADD] Browser.Features.query to check if the Browser supports the new querySelector method on the document object
-[ADD] Browser.Engine detection for WebKit version 525
-[ADD] Browser.Engine detection for Opera 9.6
-[ADD] Element.removeEvents now also accepts an object
-[ADD] Class.removeEvents now also accepts an object
-[ADD] Element.match now also accepts an Element
-[CHG] Element.js has been refactored to make use of private variables wherever possible
-[CHG] $unlink now returns an unlinked Hash instead of an object when a Hash is passed in
-[CHG] Faster Element.hasChild
-[CHG] The domready event for WebKit version 525 (or later) uses the native DomContentLoaded event
-[FIX] Fixed getPosition in Internet Explorer to be faster and more reliable
-[FIX] Selector [attribute!=val] now matches elements with empty attribute
-[FIX] Element.clone is now much faster and retains state of form elements
-[FIX] Fixed memory leaks related to IFrame unloading
-[FIX] Fixed memory leaks related to Element storage
-[FIX] Custom Events no longer stop the event when the condition returns false
-[FIX] Documentation fixes and improvements
-[FIX] :checked pseudo now works properly in Internet Explorer
-[FIX] Class.js works in Safari 2 again, and contains no more eval hack
-[FIX] Element text setter/getter is now working in Safari 2
-[FIX] $exec is now working in Safari 2
View
29 Docs/Core/Browser.md → Docs/Browser/Browser.md
@@ -1,13 +1,20 @@
-Hash: Browser {#Browser}
-========================
+Object: Browser {#Browser}
+==========================
Some browser properties are attached to the Browser Object for browser and platform detection.
### Features:
* Browser.Features.xpath - (*boolean*) True if the browser supports DOM queries using XPath.
+* Browser.Features.air - (*boolean*) True if the browser supports AIR.
+* Browser.Features.query - (*boolean*) True if the browser supports querySelectorAll.
+* Browser.Features.json - (*boolean*) True if the browser has a native JSON object.
* Browser.Features.xhr - (*boolean*) True if the browser supports native XMLHTTP object.
+### Request:
+
+* Browser.Request - (*object*) The XMLHTTP object or equivalent.
+
### Engine:
* Browser.Engine.trident - (*boolean*) True if the current browser uses the trident engine (e.g. Internet Explorer).
@@ -19,6 +26,20 @@ Some browser properties are attached to the Browser Object for browser and platf
* Browser.Plugins.Flash.version - (*number*) The major version of the flash plugin installed.
* Browser.Plugins.Flash.build - (*number*) The build version of the flash plugin installed.
+### Name:
+
+* Browser.ie - (*boolean*) True if the current browser is Internet Explorer.
+* Browser.ie6 - (*boolean*) True if the current browser is Internet Explorer 6.
+* Browser.ie7 - (*boolean*) True if the current browser is Internet Explorer 7.
+* Browser.ie8 - (*boolean*) True if the current browser is Internet Explorer 8.
+* Browser.firefox - (*boolean*) True if the current browser is Firefox
+* Browser.firefox2 - (*boolean*) True if the current browser is Firefox 2
+* Browser.firefox3 - (*boolean*) True if the current browser is Firefox 3
+* Browser.safari - (*boolean*) True if the current browser is Safari
+* Browser.safari3 - (*boolean*) True if the current browser is Safari 3
+* Browser.safari4 - (*boolean*) True if the current browser is Safari 4
+* Browser.chrome - (*boolean*) True if the current browser is Chrome
+
### Platform:
* Browser.Platform.mac - (*boolean*) True if the platform is Mac.
@@ -28,6 +49,6 @@ Some browser properties are attached to the Browser Object for browser and platf
* Browser.Platform.other - (*boolean*) True if the platform is neither Mac, Windows, Linux nor iPod.
* Browser.Platform.name - (*string*) The name of the platform.
-### Notes:
+### Plugins:
-- Engine detection is entirely feature-based.
+* Browser.Plugins.Flash - (*boolean*) - True if Flash is present.
View
389 Docs/Core/Core.md
@@ -2,156 +2,223 @@ Core {#Core}
============
Core contains an handful of common sense functions used in [MooTools](http://mootools.net).
-It also contains some basic [Hash][] and [Array][] methods.
-Function: $chk {#chk}
----------------------
-Checks to see if a value exists or is 0. Useful for allowing 0.
+
+Function: nil {#nil}
+--------------------
+
+Returns true if a value is undefined.
### Syntax:
- $chk(item);
+ nil(obj);
### Arguments:
-1. item - (*mixed*) The item to inspect.
+1. obj - (*mixed*) The object to inspect.
### Returns:
-* (*boolean*) If the object passed in exists or is 0, returns true. Otherwise, returns false.
+* (*boolean*) If the object passed is null or undefined, returns true. Otherwise, returns false.
### Example:
function myFunction(arg){
- if($chk(arg)) alert('The object exists or is 0.');
- else alert('The object is either null, undefined, false, or ""');
+ if(nil(arg)) alert('The object is null or undefined.');
+ else alert('The object is defined.');
}
+
+### Notes:
+This method is equivalent to *$defined* from MooTools 1.2, but opposite.
-Function: $clear {#clear}
--------------------------
-Clears a Timeout or an Interval. Useful when working with [Function:delay][] and [Function:periodical][].
+Function: typeOf {#typeOf}
+--------------------------
+
+Returns the type of object that matches the item passed in.
### Syntax:
- $clear(timer);
+ typeOf(obj);
### Arguments:
-1. timer - (*number*) The identifier of the setInterval (periodical) or setTimeout (delay) to clear.
+1. obj - (*object*) The object to inspect.
### Returns:
-* (*null*) returns null.
+* 'element' - (*string*) If object is a DOM element node.
+* 'textnode' - (*string*) If object is a DOM text node.
+* 'whitespace' - (*string*) If object is a DOM whitespace node.
+* 'arguments' - (*string*) If object is an arguments object.
+* 'array' - (*string*) If object is an array.
+* 'object' - (*string*) If object is an object.
+* 'string' - (*string*) If object is a string.
+* 'number' - (*string*) If object is a number.
+* 'date' - (*string*) If object is a date.
+* 'boolean' - (*string*) If object is a boolean.
+* 'function' - (*string*) If object is a function.
+* 'regexp' - (*string*) If object is a regular expression.
+* 'class' - (*string*) If object is a Class (created with new Class, or the extend of another class).
+* 'collection' - (*string*) If object is a native htmlelements collection, such as childNodes, getElementsByTagName, etc.
+* 'window' - (*string*) If object is the window object.
+* 'document' - (*string*) If object is the document object.
+* 'event' - (*string*) If object is an event.
+* false - (*boolean*) If object is undefined, null, NaN or none of the above.
### Example:
- var myTimer = myFunction.delay(5000); //Waits 5 seconds then executes myFunction.
- myTimer = $clear(myTimer); //Cancels myFunction.
-
-### See also:
+ var myString = 'hello';
+ typeOf(myString); //Returns "string".
+
+### Notes:
-- [Function:delay][]
-- [Function:periodical][]
+This method is equivalent to *$type* from MooTools 1.2.
-Function: $defined {#defined}
------------------------------
+Function: instanceOf {#instanceOf}
+----------------------------------
-Checks to see if a value is defined.
+Checks to see if an object is an instance of a particular Type.
### Syntax:
- $defined(obj);
-
+ instanceOf(item, object)
+
### Arguments:
-1. obj - (*mixed*) The object to inspect.
+1. item - (*mixed*) The item which you want to check
+2. object - (*mixed*) The Type you wish to compare with
### Returns:
-* (*boolean*) If the object passed is not null or undefined, returns true. Otherwise, returns false.
+* (*boolean*) Whether or not the item is an instance of the object.
-### Example:
+### Examples:
- function myFunction(arg){
- if($defined(arg)) alert('The object is defined.');
- else alert('The object is null or undefined.');
- }
+ var foo = [];
+ instanceOf(foo, Array) // true
+ instanceOf(foo, String) // false
+
+ var myClass = new Class();
+ var bar = new myClass();
+ instanceOf(bar, myClass) // true
-Function: $arguments {#arguments}
----------------------------------
+Function: Object.each {#Object-each}
+------------------------------------
-Creates a function which returns the passed argument according to the index (i) passed.
+Used to iterate through an object.
### Syntax:
- var argument = $arguments(i);
+ Object.each(obj, fn[, bind]);
-### Arguments
+### Arguments:
+
+1. obj - (*object*) The object to iterate through.
+2. fn - (*function*) The function to test for each element.
+3. bind - (*object*, optional) The object to use as 'this' within the function. For more information see [Function:bind][].
+
+#### Argument: fn
+
+##### Syntax:
-1. i - (*number*) The index of the argument to return.
+ fn(item, index, object)
-### Returns
+##### Arguments:
-* (*function*) The function that returns a certain argument from the function's arguments.
+1. item - (*mixed*) The current item in the array.
+2. index - (*number*) The current item's key.
+3. object - (*mixed*) The actual array/object.
### Example:
- var secondArgument = $arguments(1);
- alert(secondArgument('a','b','c')); //Alerts "b".
+ //Alerts "The first day of the week is Sunday", "The second day of the week is Monday", etc:
+ Object.each({first: "Sunday", second: "Monday", third: "Tuesday"}, function(value, key){
+ alert("The " + key + " day of the week is " + value);
+ });
+
+### Notes:
+
+This method is an object-specific equivalent of *$each* from MooTools 1.2.
-Function: $empty {#empty}
--------------------------
+Function: Object.merge {#Object-merge}
+--------------------------------------
-An empty function, that's it. Typically used for as a placeholder inside event methods of classes.
+Merges any number of objects recursively without referencing them or their sub-objects.
### Syntax:
- var emptyFn = $empty;
+ var merged = Object.merge(obj1, obj2[, obj3[, ...]]);
-### Example:
+### Arguments:
- var myFunc = $empty;
+1. (objects) Any number of objects.
-Function: $lambda {#lambda}
--------------------------
+### Returns:
-Creates an empty function which does nothing but return the value passed.
+* (*object*) The object that is created as a result of merging all the objects passed in.
-### Syntax:
+### Examples:
- var returnTrue = $lambda(true);
+ var obj1 = {a: 0, b: 1};
+ var obj2 = {c: 2, d: 3};
+ var obj3 = {a: 4, d: 5};
+ var merged = Object.merge(obj1, obj2, obj3); //returns {a: 4, b: 1, c: 2, d: 5}, (obj1, obj2, and obj3 are unaltered)
-### Arguments
+ var nestedObj1 = {a: {b: 1, c: 1}};
+ var nestedObj2 = {a: {b: 2}};
+ var nested = Object.merge(nestedObj1, nestedObj2); //returns: {a: {b: 2, c: 1}}
+
+
+
+Function: Object.clone {#Object-clone}
+--------------------------------------
+
+Returns a copy of an object.
+
+### Syntax:
+
+ var clone = Object.clone(obj);
+
+### Arguments:
-1. value - (*mixed*) The value for the created function to return.
+1. (obj) The object to clone
-### Returns
+### Returns:
-* (*function*) A function which returns the desired value.
+* (*object*) A copy of the passed object
### Example:
- myLink.addEvent('click', $lambda(false)); //Prevents a link Element from being clickable.
+ var obj1 = {a: 0, b: 1};
+ var obj2 = Object.clone(obj1);
+
+ obj1.a = 42;
+ alert(obj1.a); // alerts '42'
+ alert(obj2.a); // alerts '0'
+### Notes:
-Function: $extend {#extend}
----------------------------
+This is an object-specific equivalent of *$unlink* from MooTools 1.2.
+
+
+Function: Object.append {#Object-append}
+----------------------------------------
Copies all the properties from the second object passed in to the first object passed in.
### Syntax:
- $extend(original, extension);
+ Object.append(original, extension);
### Arguments:
@@ -173,171 +240,141 @@ Copies all the properties from the second object passed in to the first object p
'sex': 'male',
'lastName': 'Dorian'
};
- $extend(firstObj, secondObj);
+ Object.append(firstObj, secondObj);
//firstObj is now: {'name': 'John', 'lastName': 'Dorian', 'age': '20', 'sex': 'male'};
+
+----------------------
-Function: $merge {#merge}
--------------------------
-
-Merges any number of objects recursively without referencing them or their sub-objects.
-
-### Syntax:
-
- var merged = $merge(obj1, obj2[, obj3[, ...]]);
-
-### Arguments:
-
-1. (objects) Any number of objects.
-
-### Returns:
-
-* (*object*) The object that is created as a result of merging all the objects passed in.
-
-### Examples:
+
+----------------------
- var obj1 = {a: 0, b: 1};
- var obj2 = {c: 2, d: 3};
- var obj3 = {a: 4, d: 5};
- var merged = $merge(obj1, obj2, obj3); //returns {a: 4, b: 1, c: 2, d: 5}, (obj1, obj2, and obj3 are unaltered)
- var nestedObj1 = {a: {b: 1, c: 1}};
- var nestedObj2 = {a: {b: 2}};
- var nested = $merge(nestedObj1, nestedObj2); //returns: {a: {b: 2, c: 1}}
+Deprecated Functions {#Deprecated-Functions}
+============================================
+Function: $chk {#chk}
+---------------------
-Function: $each {#each}
------------------------
+This method has been deprecated and will have no equivalent in MooTools 2.0.
-Used to iterate through iterables that are not regular arrays, such as built in getElementsByTagName calls, arguments of a function, or an object.
+If you really need this function you can implement it like so:
-### Syntax:
+### Example:
- $each(iterable, fn[, bind]);
+ var $chk = function(obj){
+ return !!(obj || obj === 0);
+ };
-### Arguments:
+
-1. iterable - (*object* or *array*) The object or array to iterate through.
-2. fn - (*function*) The function to test for each element.
-3. bind - (*object*, optional) The object to use as 'this' within the function. For more information see [Function:bind][].
+Function: $clear {#clear}
+-------------------------
-#### Argument: fn
+This method has been deprecated. Please use [Function:clear](/core/Types/Function/#clear) instead.
-##### Syntax:
- fn(item, index, object)
-##### Arguments:
+Function: $defined {#defined}
+-----------------------------
-1. item - (*mixed*) The current item in the array.
-2. index - (*number*) The current item's index in the array. In the case of an object, it is passed the key of that item rather than the index.
-3. object - (*mixed*) The actual array/object.
+This method has been deprecated. Please use [nil](#nil) instead.
-### Examples:
-#### Array Example:
- $each(['Sun','Mon','Tue'], function(day, index){
- alert('name:' + day + ', index: ' + index);
- }); //Alerts "name: Sun, index: 0", "name: Mon, index: 1", etc.
+Function: $arguments {#arguments}
+---------------------------------
+This method has been deprecated and will have no equivalent in MooTools 2.0.
-#### Object Example:
+If you really need this function you can implement it like so:
- //Alerts "The first day of the week is Sunday", "The second day of the week is Monday", etc:
- $each({first: "Sunday", second: "Monday", third: "Tuesday"}, function(value, key){
- alert("The " + key + " day of the week is " + value);
- });
+### Example:
+ var $arguments = function(i){
+ return function(){
+ return arguments[i];
+ };
+ };
-Function: $pick {#pick}
------------------------
-Returns the first defined argument passed in, or null.
+Function: $empty {#empty}
+-------------------------
-### Syntax:
+This method has been deprecated. Use [Function.from](/core/Types/Function/#Function-from) instead.
- var picked = $pick(var1[, var2[, var3[, ...]]]);
+### Example:
-### Arguments:
+ var myFunc = Function.from();
+ // Or probably better....
+ var myFunc = function(){};
+
-* (*mixed*) Any number of variables.
-### Returns:
+Function: $lambda {#lambda}
+---------------------------
-* (*mixed*) The first variable that is defined.
-* (*null*) If all variables passed in are `null` or `undefined`, returns `null`.
+This method has been deprecated. Use [Function.from](/core/Types/Function/#Function-from) instead.
### Example:
- function say(infoMessage, errorMessage){
- alert($pick(errorMessage, infoMessage, 'There was no message supplied.'));
- }
- say(); //Alerts "There was no message supplied."
- say("This is an info message."); //Alerts "This is an info message."
- say("This message will be ignored.", "This is the error message."); //Alerts "This is the error message."
+ myLink.addEvent('click', Function.from(false)); //Prevents a link Element from being clickable.
-Function: $random {#random}
+Function: $extend {#extend}
---------------------------
-Returns a random integer between the two passed in values.
+This method has been deprecated. Please use [Object.append](#Object-append) instead.
-### Syntax:
- var random = $random(min, max);
-### Arguments:
+Function: $merge {#merge}
+-------------------------
-1. min - (*number*) The minimum value (inclusive).
-2. max - (*number*) The maximum value (inclusive).
+This method has been deprecated. Please use [Object.merge](#Object-merge) instead.
-### Returns:
-* (*number*) A random number between min and max.
-### Example:
+Function: $each {#each}
+-----------------------
- alert($random(5, 20)); //Alerts a random number between 5 and 20.
+This method has been deprecated. Please use [Array.each](/core/Types/Array/#Array-each) or [Object.each](#Object-each) instead.
-Function: $splat {#splat}
--------------------------
+Function: $pick {#pick}
+-----------------------
-Converts the argument passed in to an array if it is defined and not already an array.
+This method has been deprecated. Please use [Array.pick](/core/Types/Array/#pick) instead.
-### Syntax:
- var splatted = $splat(obj);
-### Arguments:
+Function: $random {#random}
+---------------------------
-1. obj - (*mixed*) Any type of variable.
+This method has been deprecated. Please use [Number.random](/core/Types/Number/#Number-random) instead.
-### Returns:
-* (*array*) If the variable passed in is an array, returns the array. Otherwise, returns an array with the only element being the variable passed in.
-### Example:
+Function: $splat {#splat}
+-------------------------
- $splat('hello'); //Returns ['hello'].
- $splat(['a', 'b', 'c']); //Returns ['a', 'b', 'c'].
+This method has been deprecated. Please use [Array.from](/core/Types/Array/#Array-from) instead.
Function: $time {#time}
-----------------------
-Returns the current time as a timestamp.
+This method has been deprecated. Please use *Date.now()* instead.
### Syntax:
- var time = $time();
+ var time = Date.now();
### Returns:
@@ -348,52 +385,15 @@ Returns the current time as a timestamp.
Function: $try {#try}
---------------------
-Tries to execute a number of functions. Returns immediately the return value of the first non-failed function without executing successive functions, or null.
-
-### Syntax:
-
- $try(fn[, fn, fn, fn, ...]);
-
-### Arguments:
-
-* fn - (*function*) The function to execute.
+This method has been deprecated. Please use [Function.stab](/core/Types/Function/#Function-stab) instead.
-### Returns:
-* (*mixed*) Standard return of the called function.
-* (*null*) `null` if all the passed functions fail.
-
-### Examples:
-
- var result = $try(function(){
- return some.made.up.object;
- }, function(){
- return jibberish.that.doesnt.exists;
- }, function(){
- return false;
- });
-
- //result is false
-
- var failure, success;
-
- $try(function(){
- some.made.up.object = 'something';
- success = true;
- }, function(){
- failure = true;
- });
-
- if (success) alert('yey!');
Function: $type {#type}
-----------------------
-Returns the type of object that matches the element passed in.
+This method has been deprecated. Please use [typeOf](#typeOf) instead.
-### Syntax:
-
- $type(obj);
### Arguments:
@@ -426,6 +426,7 @@ Returns the type of object that matches the element passed in.
$type(myString); //Returns "string".
+
[Hash]: /core/Native/Hash
[Array]: /core/Native/Array
[Function:bind]: /core/Native/Function/#Function:bind
View
9 Docs/Element/Element.Dimensions.md
@@ -14,6 +14,7 @@ Custom Native to allow all of its methods to be used with any DOM element via th
- Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html).
+
Element Method: scrollTo {#Element:scrollTo}
--------------------------------------------
@@ -39,7 +40,6 @@ The following method is also available on the Window object.
-
Element Method: getSize {#Element:getSize}
------------------------------------------
@@ -115,6 +115,7 @@ The following method is also available on the Window object.
If you need to measure the properties of elements that are not displayed (either their display style is none or one of their parents display style is none), you will need to use [Element.measure][] to expose it.
+
Element Method: getPosition {#Element:getPosition}
--------------------------------------------------
@@ -144,6 +145,7 @@ relative - (Element, defaults to the document) If set, the position will be rela
If you need to measure the properties of elements that are not displayed (either their display style is none or one of their parents display style is none), you will need to use [Element.measure][] to expose it.
+
Element Method: setPosition {#Element:setPosition}
--------------------------------------------------
@@ -165,6 +167,8 @@ Sets the position of the element's *left* and *top* values to the x/y positions
myElement.setPosition({x: 10, y: 100});
+
+
Element Method: getCoordinates {#Element:getCoordinates}
--------------------------------------------------------
@@ -205,6 +209,7 @@ relative - (*element*, optional) if set, the position will be relative to this e
If you need to measure the properties of elements that are not displayed (either their display style is none or one of their parents display style is none), you will need to use [Element.measure][] to expose it.
+
Element Method: getOffsetParent {#Element:getOffsetParent}
----------------------------------------------------------
@@ -218,6 +223,8 @@ Returns the parent of the element that is positioned, if there is one.
* (*mixed*) If the element has a parent that is positioned, it returns that element, otherwise it returns *null*.
+
+
[$]: /core/Element/Element#dollar
[MDC Element:scrollLeft]: http://developer.mozilla.org/en/docs/DOM:element.scrollLeft
[MDC Element:scrollTop]: http://developer.mozilla.org/en/docs/DOM:element.scrollTop
View
2  Docs/Element/Element.Event.md
@@ -322,4 +322,4 @@ This event fires when the mouse wheel is rotated;
[Function]: /core/Native/Function
[Function:bind]: /core/Native/Function/#Function:bind
[Function:pass]: /core/Native/Function/#Function:pass
-[Function:delay]: /core/Native/Function/#Function:delay
+[Function:delay]: /core/Native/Function/#Function:delay
View
2  Docs/Element/Element.Style.md
@@ -119,4 +119,4 @@ Returns an object of styles of the Element for each argument passed in.
[$]: /core/Element/Element/#dollar
[Function]: /core/Native/Function
-[Element:getStyle]: #Element:getStyle
+[Element:getStyle]: #Element:getStyle
View
2  Docs/Fx/Fx.CSS.md
@@ -9,4 +9,4 @@ Has no public methods.
[Fx.Tween]: /core/Fx/Fx.Tween
[Fx.Morph]: /core/Fx/Fx.Morph
-[Fx.Elements]: /more/Fx/Fx.Elements
+[Fx.Elements]: /more/Fx/Fx.Elements
View
0  Docs/Request/Request.HTML.md 100755 → 100644
File mode changed
View
0  Docs/Request/Request.JSON.md 100755 → 100644
File mode changed
View
0  Docs/Request/Request.md 100755 → 100644
File mode changed
View
198 Docs/Slick/Slick.md
@@ -0,0 +1,198 @@
+Slick {#Slick}
+================
+
+Slick is the standalone selector engine used in MooTools.
+
+Below is a brief explanation of the CSS3 selectors it supports, and how to extend it with custom psuedos.
+
+
+
+Selector: enabled {#Selector:enabled}
+-------------------------------------
+
+Matches all Elements that are enabled.
+
+### Usage:
+
+ ':enabled'
+
+### Examples:
+
+ $$('*:enabled')
+
+ $('myElement').getElements(':enabled');
+
+
+
+Selector: empty {#Selector:empty}
+---------------------------------
+
+Matches all elements which are empty.
+
+### Usage:
+
+ ':empty'
+
+### Example:
+
+ $$('div:empty');
+
+
+
+Selector: contains {#Selector:contains}
+---------------------------------------
+
+Matches all the Elements which contains the text.
+
+### Usage:
+
+ ':contains(text)'
+
+### Variables:
+
+* text - (string) The text that the Element should contain.
+
+### Example:
+
+ $$('p:contains("find me")');
+
+
+
+Selector: nth-child {#Selector:nth-child}
+-----------------------------------------
+
+Matches every nth child.
+
+### Usage:
+
+Nth Expression:
+
+ ':nth-child(nExpression)'
+
+### Variables:
+
+* nExpression - (string) A nth expression for the "every" nth-child.
+
+### Examples:
+
+ $$('#myDiv:nth-child(2n)'); //Returns every even child.
+
+ $$('#myDiv:nth-child(n)'); //Returns all children.
+
+ $$('#myDiv:nth-child(2n+1)') //Returns every odd child.
+
+ $$('#myDiv:nth-child(4n+3)') //Returns Elements 3, 7, 11, 15, etc.
+
+
+Every Odd Child:
+
+ ':nth-child(odd)'
+
+Every Even Child:
+
+ ':nth-child(even)'
+
+Only Child:
+
+ ':nth-child(only)'
+
+First Child:
+
+ 'nth-child(first)'
+
+Last Child:
+
+ 'nth-child(last)'
+
+### Note:
+
+This selector respects the w3c specifications, so it has 1 as its first child, not 0. Therefore nth-child(odd) will actually select the even children, if you think in zero-based indexes.
+
+
+
+Selector: even {#Selector:even}
+-------------------------------
+
+Matches every even child.
+
+### Usage:
+
+ ':even'
+
+### Example:
+
+ $$('td:even');
+
+### Note:
+
+This selector is not part of the w3c specification, therefore its index starts at 0. This selector is highly recommended over nth-child(even), as this will return the real even children.
+
+
+
+Selector: odd {#Selector:odd}
+-----------------------------
+
+Matches every odd child.
+
+### Usage:
+
+ ':odd'
+
+### Example:
+
+ $$('td:odd');
+
+### Note:
+
+This selector is not part of the w3c specification, therefore its index starts at 0. This selector is highly recommended over nth-child(odd), as this will return the real odd children.
+
+
+
+Selector: first {#Selector:first-child}
+---------------------------------
+
+Matches the first child.
+
+### Usage:
+
+ ':first-child'
+
+### Example:
+
+ $$('td:first-child');
+
+
+
+Selector: last {#Selector:last-child}
+-------------------------------------
+
+ Matches the last child.
+
+### Usage:
+
+ ':last-child'
+
+### Example:
+
+ $$('td:last-child');
+
+
+
+Selector: only {#Selector:only-child}
+-------------------------------------
+
+Matches an only child of its parent Element.
+
+### Usage:
+
+ ':only-child'
+
+### Example:
+
+ $$('td:only-child');
+
+
+
+[$]: /core/Element/Element#dollar
+[Element]: /core/Element/Element
+[Selectors]: /core/Selectors/Selectors
View
273 Docs/Native/Array.md → Docs/Types/Array.md
@@ -1,5 +1,5 @@
-Native: Array {#Array}
-======================
+Array {#Array}
+==============
A collection of Array methods.
@@ -8,53 +8,130 @@ A collection of Array methods.
- [MDC Array][]
-Array Method: each {#Array:each}
----------------------------------
+Function: Array.each {#Array-each}
+----------------------------------
-Calls a function for each element in the array.
+Used to iterate through arrays, or iterables that are not regular arrays, such as built in getElementsByTagName calls or arguments of a function.
### Syntax:
- myArray.each(fn[, bind]);
+ Array.each(iterable, fn[, bind]);
### Arguments:
-1. fn - (*function*) The function which should be executed on each item in the array. This function is passed the item and its index in the array.
-2. bind - (*object*, optional) The object to be used as 'this' in the function. For more information see [Function:bind][].
+1. iterable - (*array*) The array to iterate through.
+2. fn - (*function*) The function to test for each element.
+3. bind - (*object*, optional) The object to use as 'this' within the function. For more information see [Function:bind][].
#### Argument: fn
-##### Syntax
+##### Syntax:
- fn(item, index, array)
+ fn(item, index, object)
##### Arguments:
1. item - (*mixed*) The current item in the array.
-2. index - (*number*) The current item's index in the array.
-3. array - (*array*) The actual array.
+2. index - (*number*) The current item's index in the array. In the case of an object, it is passed the key of that item rather than the index.
+3. object - (*mixed*) The actual array/object.
-### Examples:
+### Example:
+
+ Array.each(['Sun','Mon','Tue'], function(day, index){
+ alert('name:' + day + ', index: ' + index);
+ }); //Alerts "name: Sun, index: 0", "name: Mon, index: 1", etc.
- //Alerts "0 = apple", "1 = banana", and so on:
- ['apple', 'banana', 'lemon'].each(function(item, index){
- alert(index + " = " + item);
- }); //The optional second argument for binding isn't used here.
+### Notes:
+This is an array-specific equivalent of *$each* from MooTools 1.2.
-### See Also:
-- [MDC Array:forEach][]
+
+Function: Array.clone {#Array-clone}
+------------------------------------
+
+Returns a copy of the passed array.
+
+### Syntax:
+
+ var clone = Array.clone(myArray);
+
+### Arguments:
+
+1. myArray - (*array*) The array you wish to copy.
+
+### Returns:
+
+* (*array*) a copy of the passed array.
+
+### Example:
+
+ var myArray = ['red', 'blue', 'green'];
+ var otherArray = Array.clone(myArray);
+
+ var myArray[0] = 'yellow';
+
+ alert(myArray[0]); // alerts 'yellow'
+ alert(otherArray[0]) // alerts 'red'
### Notes:
-- This method is only available for browsers without native [MDC Array:forEach][] support.
+This is an array-specific equivalent of *$unlink* from MooTools 1.2.
-Array Method: every {#Array:every}
+Function: Array.from {#Array-from}
----------------------------------
+Converts the argument passed in to an array if it is defined and not already an array.
+
+### Syntax:
+
+ var splatted = Array.from(obj);
+
+### Arguments:
+
+1. obj - (*mixed*) Any type of variable.
+
+### Returns:
+
+* (*array*) If the variable passed in is an array, returns the array. Otherwise, returns an array with the only element being the variable passed in.
+
+### Example:
+
+ Array.from('hello'); //Returns ['hello'].
+ Array.from(['a', 'b', 'c']); //Returns ['a', 'b', 'c'].
+
+
+
+Array method: call {#call}
+--------------------------
+
+Returns an array with the named method applied to the array's contents.
+
+### Syntax:
+
+ var arr = myArray.call(method, arg1[, arg2, arg3])
+
+### Arguments:
+
+1. method - (*string*) The method to apply to each item in the array.
+2. arg1, arg2 - (*mixed*) Any number of arguments to pass to the named method.
+
+### Returns:
+
+* (*array*) A new array containing the results of the applied method.
+
+### Example:
+
+ var foo = [4, 8, 15, 16, 23, 42];
+ var bar = foo.invoke('limit', 10, 30); // bar is now [10, 10, 15, 16, 23, 30]
+
+
+
+Array method: every {#every}
+----------------------------
+
Returns true if every element in the array satisfies the provided testing function.
This method is provided only for browsers without native [Array:every][] support.
@@ -96,8 +173,8 @@ This method is provided only for browsers without native [Array:every][] support
-Array Method: filter {#Array:filter}
-------------------------------------
+Array method: filter {#filter}
+------------------------------
Creates a new array with all of the elements of the array for which the provided filtering function returns true.
This method is provided only for browsers without native [Array:filter][] support.
@@ -138,8 +215,9 @@ This method is provided only for browsers without native [Array:filter][] suppor
- [MDC Array:filter][]
-Array Method: clean {#Array:clean}
-------------------------------------
+
+Array method: clean {#clean}
+----------------------------
Creates a new array with all of the elements of the array which are defined (i.e. not null or undefined).
@@ -157,8 +235,9 @@ Creates a new array with all of the elements of the array which are defined (i.e
myArray.clean() // returns [1, 0, true, false, "foo", ""]
-Array Method: indexOf {#Array:indexOf}
---------------------------------------
+
+Array method: indexOf {#indexOf}
+--------------------------------
Returns the index of the first element within the array equal to the specified value, or -1 if the value is not found.
This method is provided only for browsers without native [Array:indexOf][] support.
@@ -187,8 +266,8 @@ This method is provided only for browsers without native [Array:indexOf][] suppo
-Array Method: map {#Array:map}
-------------------------------
+Array method: map {#map}
+------------------------
Creates a new array with the results of calling a provided function on every element in the array.
This method is provided only for browsers without native [Array:map][] support.
@@ -230,8 +309,8 @@ This method is provided only for browsers without native [Array:map][] support.
-Array Method: some {#Array:some}
---------------------------------
+Array method: some {#some}
+--------------------------
Returns true if at least one element in the array satisfies the provided testing function.
This method is provided only for browsers without native [Array:some][] support.
@@ -273,8 +352,8 @@ This method is provided only for browsers without native [Array:some][] support.
-Array Method: associate {#Array:associate}
-------------------------------------------
+Array method: associate {#associate}
+------------------------------------
Creates an object with key-value pairs based on the array of keywords passed in and the current content of the array.
@@ -299,8 +378,8 @@ Creates an object with key-value pairs based on the array of keywords passed in
-Array Method: link {#Array:link}
---------------------------------
+Array method: link {#link}
+--------------------------
Accepts an object of key / function pairs to assign values.
@@ -325,8 +404,8 @@ Accepts an object of key / function pairs to assign values.
-Array Method: contains {#Array:contains}
-----------------------------------------
+Array method: contains {#contains}
+----------------------------------
Tests an array for the presence of an item.
@@ -354,32 +433,32 @@ Tests an array for the presence of an item.
-Array Method: extend {#Array:extend}
-------------------------------------
+Array method: append {#append}
+------------------------------
-Extends an array with all the items of another.
+Appends the passed array to the end of the current array.
### Syntax:
- myArray.extend(array);
+ var myArray = myArray.append(otherArray);
### Arguments:
-1. array - (*array*) The array whose items should be extended into this array.
+1. otherArray - (*array*) The array containing values you wish to append.
### Returns:
-* (*array*) This array, extended.
+* (*array*) The original array including the new values.
### Examples:
- var animals = ['Cow', 'Pig', 'Dog'];
- animals.extend(['Cat', 'Dog']); //animals = ['Cow', 'Pig', 'Dog', 'Cat', 'Dog'];
+ var myOtherArray = ['green', 'yellow'];
+ ['red', 'blue'].appemd(myOtherArray); //returns ['red', 'blue', 'green', 'yellow'];
-Array Method: getLast {#Array:getLast}
---------------------------------------
+Array method: getLast {#getLast}
+--------------------------------
Returns the last item from the array.
@@ -398,8 +477,8 @@ Returns the last item from the array.
-Array Method: getRandom {#Array:getRandom}
-------------------------------------------
+Array method: getRandom {#getRandom}
+------------------------------------
Returns a random item from the array.
@@ -417,8 +496,8 @@ Returns a random item from the array.
-Array Method: include {#Array:include}
---------------------------------------
+Array method: include {#include}
+--------------------------------
Pushes the passed element into the array if it's not already present (case and type sensitive).
@@ -441,8 +520,8 @@ Pushes the passed element into the array if it's not already present (case and t
-Array Method: combine {#Array:combine}
-----------------------------------
+Array method: combine {#combine}
+--------------------------------
Combines an array with all the items of another. Does not allow duplicates and is case and type sensitive.
@@ -465,8 +544,8 @@ Combines an array with all the items of another. Does not allow duplicates and i
-Array Method: erase {#Array:erase}
-------------------------------------
+Array method: erase {#erase}
+----------------------------
Removes all occurrences of an item from the array.
@@ -489,8 +568,8 @@ Removes all occurrences of an item from the array.
-Array Method: empty {#Array:empty}
-----------------------------------
+Array method: empty {#empty}
+----------------------------
Empties an array.
@@ -508,8 +587,8 @@ Empties an array.
myArray.empty(); //myArray is now []
-Array Method: flatten {#Array:flatten}
---------------------------------------
+Array method: flatten {#flatten}
+--------------------------------
Flattens a multidimensional array into a single array.
@@ -528,8 +607,36 @@ Flattens a multidimensional array into a single array.
-Array Method: hexToRgb {#Array:hexToRgb}
-----------------------------------------
+Array method: pick {#pick}
+--------------------------
+Returns the first defined argument passed in, or null.
+
+### Syntax:
+
+ var picked = Array.pick(var1[, var2[, var3[, ...]]]);
+
+### Arguments:
+
+* (*mixed*) Any number of variables.
+
+### Returns:
+
+* (*mixed*) The first variable that is defined.
+* (*null*) If all variables passed in are `null` or `undefined`, returns `null`.
+
+### Example:
+
+ function say(infoMessage, errorMessage){
+ alert(Array.pick(errorMessage, infoMessage, 'There was no message supplied.'));
+ }
+ say(); //Alerts "There was no message supplied."
+ say("This is an info message."); //Alerts "This is an info message."
+ say("This message will be ignored.", "This is the error message."); //Alerts "This is the error message."
+
+
+
+Array method: hexToRgb {#hexToRgb}
+----------------------------------
Converts an hexidecimal color value to RGB. Input array must be the following hexidecimal color format.
\['FF','FF','FF'\]
@@ -554,12 +661,12 @@ Converts an hexidecimal color value to RGB. Input array must be the following he
### See Also:
-- [String:hexToRgb](/Native/String/#hexToRgb)
+- [String:hexToRgb](/Types/String/#hexToRgb)
-Array Method: rgbToHex {#Array:rgbToHex}
-----------------------------------------
+Array method: rgbToHex {#rgbToHex}
+----------------------------------
Converts an RGB color value to hexidecimal. Input array must be in one of the following RGB color formats.
\[255,255,255\], or \[255,255,255,1\]
@@ -585,44 +692,8 @@ Converts an RGB color value to hexidecimal. Input array must be in one of the fo
### See Also:
-- [String:rgbToHex](/Native/String/#rgbToHex)
-
-Utility Functions {#Utility}
-============================
-
-
-Function: $A {#A}
------------------
-
-Creates a copy of an Array. Useful for applying the Array prototypes to iterable objects such as a DOM Node collection or the arguments object.
-
-### Syntax:
-
- var copiedArray = $A(iterable);
-
-### Arguments:
-
-1. iterable - (array) The iterable to copy.
-
-### Returns:
-
-* (*array*) The new copied array.
-
-### Examples:
-
-#### Apply Array to arguments:
-
- function myFunction(){
- $A(arguments).each(function(argument, index){
- alert(argument);
- });
- };
- myFunction("One", "Two", "Three"); //Alerts "One", then "Two", then "Three".
-
-#### Copy an Array:
+- [String:rgbToHex](/Types/String/#rgbToHex)
- var anArray = [0, 1, 2, 3, 4];
- var copiedArray = $A(anArray); //Returns [0, 1, 2, 3, 4].
[Array]: /core/Native/Array
View
18 Docs/Types/Event.md
@@ -0,0 +1,18 @@
+Event {#Event}
+================
+
+
+Event method: stop {#stop}
+--------------------------
+
+
+Event method: stopPropogation {#stopPropogation}
+------------------------------------------------
+
+
+Event method: preventDefault {#preventDefault}
+----------------------------------------------
+
+
+
+Event.Keys
View
277 Docs/Native/Function.md → Docs/Types/Function.md
@@ -1,4 +1,4 @@
-Native: Function {#Function}
+Function {#Function}
============================
Function Methods.
@@ -9,8 +9,122 @@ Function Methods.
-Function Method: create {#Function:create}
-------------------------------------------
+Function: Function.from {#Function-from}
+----------------------------------------
+
+If the passed argument is a function, it will return itself. Otherwise, it will return a function that returns the passed argument.
+
+### Syntax:
+
+ var foo = Function.from(obj);
+
+### Arguments:
+
+1. obj - (*mixed*) If this argument is a function, it will simply return itself. Otherwise, an object you wish to convert into a function that returns the argument.
+
+### Returns:
+
+* (*function*) Either the passed function or an anonymous function that returns the passed argument.
+
+### Examples:
+
+ var fn = Function.from(42);
+ alert(fn()); // alerts '42'
+
+ var fn2 = Function.from(fn);
+ alert(fn2()); // alerts '42'
+
+### Notes:
+
+This function is equivalent to the following deprecated MooTools 1.2 methods:
+
+ var fn1 = Function.from(); // Equivalent to var fn1 = $empty();
+ var fn2 = Function.from(foo); // Equivalent to var fn2 = $lambda(foo);
+
+
+
+Function method: extend {#extend}
+---------------------------------
+
+
+Function method: implement {#implement}
+---------------------------------------
+
+
+Function method: clear {#clear}
+-------------------------------
+
+Clears a Timeout or an Interval. Useful when working with [Function:delay](#delay) and [Function:periodical](#periodical).
+
+### Syntax:
+
+ myTimer.clear(timer);
+
+### Arguments:
+
+1. timer - (*number*) The identifier of the setInterval (periodical) or setTimeout (delay) to clear.
+
+### Returns:
+
+* (*null*) returns null.
+
+### Example:
+
+ var myTimer = myFunction.delay(5000); //Waits 5 seconds then executes myFunction.
+ myTimer = myTimer.clear(); //Cancels myFunction.
+
+### See also:
+
+- [Function:delay][]
+- [Function:periodical][]
+
+
+
+Function method: stab {#stab}
+-----------------------------
+
+Tries to execute a number of functions. Returns immediately the return value of the first non-failed function without executing successive functions, or null.
+
+### Syntax:
+
+ Function.stab(fn[, fn, fn, fn, ...]);
+
+### Arguments:
+
+* fn - (*function*) The function to execute.
+
+### Returns:
+
+* (*mixed*) Standard return of the called function.
+* (*null*) `null` if all the passed functions fail.
+
+### Examples:
+
+ var result = Function.stab(function(){
+ return some.made.up.object;
+ }, function(){
+ return jibberish.that.doesnt.exists;
+ }, function(){
+ return false;
+ });
+
+ //result is false
+
+ var failure, success;
+
+ Function.stab(function(){
+ some.made.up.object = 'something';
+ success = true;
+ }, function(){
+ failure = true;
+ });
+
+ if (success) alert('yey!');
+
+
+
+Function method: create {#create}
+---------------------------------
Base function for creating functional closures which is used by all other Function prototypes.
@@ -52,50 +166,53 @@ Base function for creating functional closures which is used by all other Functi
-Function Method: pass {#Function:pass}
---------------------------------------
+Function method: run {#run}
+---------------------------
-Returns a closure with arguments and bind.
+Runs the Function with specified arguments and binding. The same as apply but reversed and with support for a single argument.
### Syntax:
- var newFunction = myFunction.pass([args[, bind]]);
+ var myFunctionResult = myFunction.run(args[, bind]);
### Arguments:
-1. args - (*mixed*, optional) The arguments to pass to the function (must be an array if passing more than one argument).
+1. args - (*mixed*) An argument, or array of arguments to run the function with.
2. bind - (*object*, optional) The object that the "this" of the function will refer to.
### Returns:
-* (*function*) The function whose arguments are passed when called.
+* (*mixed*) This Function's return value.
-### Example:
+### Examples:
- var myFunction = function(){
- var result = 'Passed: ';
- for (var i = 0, l = arguments.length; i < l; i++){
- result += (arguments[i] + ' ');
- }
- return result;
+#### Simple Run:
+
+ var myFn = function(a, b, c){
+ return a + b + c;
}
- var myHello = myFunction.pass('hello');
- var myItems = myFunction.pass(['peach', 'apple', 'orange']);
+ var myArgs = [1,2,3];
+ myFn.run(myArgs); //Returns: 6
- //Later in the code, the functions can be executed:
- alert(myHello()); //Passes "hello" to myFunction.
- alert(myItems()); //Passes the array of items to myFunction.
+
+#### Run With Binding:
+
+ var myFn = function(a, b, c) {
+ return a + b + c + this;
+ }
+ var myArgs = [1,2,3];
+ myFn.run(myArgs, 6); //Returns: 12
-Function Method: attempt {#Function:attempt}
---------------------------------------------
+Function method: pass {#pass}
+-----------------------------
-Tries to execute the function.
+Returns a closure with arguments and bind.
### Syntax:
- var result = myFunction.attempt([args[, bind]]);
+ var newFunction = myFunction.pass([args[, bind]]);
### Arguments:
@@ -104,25 +221,28 @@ Tries to execute the function.
### Returns:
-* (*mixed*) The function's return value or `null` if an exception is thrown.
+* (*function*) The function whose arguments are passed when called.
### Example:
- var myObject = {
- 'cow': 'moo!'
- };
-
var myFunction = function(){
- for (var i = 0; i < arguments.length; i++){
- if(!this[arguments[i]]) throw('doh!');
+ var result = 'Passed: ';
+ for (var i = 0, l = arguments.length; i < l; i++){
+ result += (arguments[i] + ' ');
}
- };
- var result = myFunction.attempt(['pig', 'cow'], myObject); //result = null
+ return result;
+ }
+ var myHello = myFunction.pass('hello');
+ var myItems = myFunction.pass(['peach', 'apple', 'orange']);
+
+ //Later in the code, the functions can be executed:
+ alert(myHello()); //Passes "hello" to myFunction.
+ alert(myItems()); //Passes the array of items to myFunction.
-Function Method: bind {#Function:bind}
---------------------------------------
+Function method: bind {#bind}
+-----------------------------
Changes the scope of `this` within the target function to refer to the bind parameter.
@@ -151,8 +271,8 @@ Changes the scope of `this` within the target function to refer to the bind para
-Function Method: bindWithEvent {#Function:bindWithEvent}
---------------------------------------------------------
+Function method: bindWithEvent {#bindWithEvent}
+-----------------------------------------------
Changes the scope of `this` within the target function to refer to the bind parameter. It also makes "space" for an event.
This allows the function to be used in conjunction with [Element:addEvent][] and arguments.
@@ -188,8 +308,42 @@ This allows the function to be used in conjunction with [Element:addEvent][] and
}.bindWithEvent(Log, 100));
-Function Method: delay {#Function:delay}
-----------------------------------------
+
+Function method: attempt {#attempt}
+-----------------------------------
+
+Tries to execute the function.
+
+### Syntax:
+
+ var result = myFunction.attempt([args[, bind]]);
+
+### Arguments:
+
+1. args - (*mixed*, optional) The arguments to pass to the function (must be an array if passing more than one argument).
+2. bind - (*object*, optional) The object that the "this" of the function will refer to.
+
+### Returns:
+
+* (*mixed*) The function's return value or `null` if an exception is thrown.
+
+### Example:
+
+ var myObject = {
+ 'cow': 'moo!'
+ };
+
+ var myFunction = function(){
+ for (var i = 0; i < arguments.length; i++){
+ if(!this[arguments[i]]) throw('doh!');
+ }
+ };
+ var result = myFunction.attempt(['pig', 'cow'], myObject); //result = null
+
+
+
+Function method: delay {#delay}
+-------------------------------
Delays the execution of a function by a specified duration.
@@ -223,8 +377,8 @@ Delays the execution of a function by a specified duration.
-Function Method: periodical {#Function:periodical}
---------------------------------------------------
+Function method: periodical {#periodical}
+-----------------------------------------
Executes a function in the specified intervals of time. Periodic execution can be stopped using the [$clear][] function.
@@ -255,45 +409,6 @@ Executes a function in the specified intervals of time. Periodic execution can b
-Function Method: run {#Function:run}
-------------------------------------
-
-Runs the Function with specified arguments and binding. The same as apply but reversed and with support for a single argument.
-
-### Syntax:
-
- var myFunctionResult = myFunction.run(args[, bind]);
-
-### Arguments:
-
-1. args - (*mixed*) An argument, or array of arguments to run the function with.
-2. bind - (*object*, optional) The object that the "this" of the function will refer to.
-
-### Returns:
-
-* (*mixed*) This Function's return value.
-
-### Examples:
-
-#### Simple Run:
-
- var myFn = function(a, b, c){
- return a + b + c;
- }
- var myArgs = [1,2,3];
- myFn.run(myArgs); //Returns: 6
-
-
-#### Run With Binding:
-
- var myFn = function(a, b, c) {
- return a + b + c + this;
- }
- var myArgs = [1,2,3];
- myFn.run(myArgs, 6); //Returns: 12
-
-
-
[options]: #Function:create:options
[Element:addEvent]: /core/Element/Element.Event/#Element:addEvent
[$clear]: /core/Core/Core/#clear
View
17 Docs/Native/Hash.md → Docs/Types/Hash.md
@@ -4,6 +4,11 @@ Native: Hash {#Hash}
A custom Object ({}) implementation which does not account for prototypes when setting, getting, or iterating.
Useful because in JavaScript, we cannot use Object.prototype. Instead, we can use Hash.prototype!
+### Notes
+
+MooTools 2.0 -core will not include Hash as a Native - it will however be supported as part of -More. Where possible, you should use native Objects.
+
+
Hash Method: constructor {#Hash:constructor}
--------------------------------------------
@@ -33,7 +38,7 @@ Hash Method: constructor {#Hash:constructor}
Hash Method: each {#Hash:each}
--------------------------------
+------------------------------
Calls a function for each key-value pair in the object.
@@ -152,6 +157,7 @@ Tests for the presence of a specified value in the Hash.
hash.hasValue('four'); //returns false
+
Hash Method: extend {#Hash:extend}
----------------------------------
@@ -186,7 +192,7 @@ Extends this Hash with the key-value pairs from the object passed in.
Hash Method: combine {#Hash:combine}
---------------------------------
+------------------------------------
Combines this Hash with the key-value pairs of the object passed in. Does not allow duplicates (old values are **not** overwritten by new ones) and is case and type sensitive.
@@ -220,7 +226,7 @@ Combines this Hash with the key-value pairs of the object passed in. Does not al
Hash Method: erase {#Hash:erase}
-----------------------------------
+--------------------------------
Removes the specified key from the Hash.
@@ -427,6 +433,7 @@ Creates a new Hash with all of the elements of the Hash for which the provided f
}); //biggerThanTwenty now holds an object containing: {c: 30}
+
Hash Method: every {#Hash:every}
--------------------------------
@@ -464,6 +471,7 @@ Returns true if every value in the object satisfies the provided testing functio
}); //areAllBigEnough = false
+
Hash Method: some {#Hash:some}
------------------------------
@@ -506,7 +514,7 @@ Returns true if at least one value in the object satisfies the provided testing
Hash Method: getClean {#Hash:getClean}
--------------------------------------
-Returns a a clean object from an Hash.
+Returns a clean object from an Hash.
### Syntax:
@@ -609,6 +617,7 @@ Generates a query string from key/value pairs in an object and URI encodes the v
myHash.toQueryString(); //returns "apple=red&lemon=yellow"
+
Utility Functions {#Utility}
============================
View
72 Docs/Native/Number.md → Docs/Types/Number.md
@@ -1,5 +1,5 @@
-Native: Number {#Number}
-========================
+Number {#Number}
+================
A collection of the Number Object methods.
@@ -12,9 +12,59 @@ A collection of the Number Object methods.
Every Math method is mirrored in the Number object, both as prototype and generic.
-Number Method: limit {#Number:limit}
+
+Function: Number.from {#Number-from}
------------------------------------
+Returns the passed parameter as a Number, or null if not a number.
+
+### Syntax:
+
+ Number.from(arg);
+
+### Arguments:
+
+1. arg - (*mixed*) The argument to return as a number.
+
+### Returns:
+
+* (*number*) The argument as a number.
+* (*null*) Returns null if the number cannot be converted.
+
+### Example:
+
+ Number.from('12') // returns 12
+ Number.from('hello') // returns null
+
+
+
+Function: Number.random {#Number-random}
+----------------------------------------
+
+Returns a random integer between the two passed in values.
+
+### Syntax:
+
+ var random = Number.random(min, max);
+
+### Arguments:
+
+1. min - (*number*) The minimum value (inclusive).
+2. max - (*number*) The maximum value (inclusive).
+
+### Returns:
+
+* (*number*) A random number between min and max.
+
+### Example:
+
+ alert(Number.random(5, 20)); //Alerts a random number between 5 and 20.
+
+
+
+Number method: limit {#limit}
+-----------------------------
+
Limits this number between two bounds.
### Syntax:
@@ -38,8 +88,8 @@ Limits this number between two bounds.
-Number Method: round {#Number:round}
-------------------------------------
+Number method: round {#round}
+-----------------------------
Returns this number rounded to the specified precision.
@@ -67,8 +117,8 @@ Returns this number rounded to the specified precision.
-Number Method: times {#Number:times}
-------------------------------------
+Number method: times {#times}
+-----------------------------
Executes the function passed in the specified number of times.
@@ -87,8 +137,8 @@ Executes the function passed in the specified number of times.
-Number Method: toFloat {#Number:toFloat}
-----------------------------------------
+Number method: toFloat {#toFloat}
+---------------------------------
Returns this number as a float. Useful because toFloat must work on both Strings and Numbers.
@@ -107,8 +157,8 @@ Returns this number as a float. Useful because toFloat must work on both Strings
-Number Method: toInt {#Number:toInt}
-------------------------------------
+Number method: toInt {#toInt}
+-----------------------------
Returns this number as another number with the passed in base. Useful because toInt must work on both Strings and Numbers.
View
126 Docs/Native/String.md → Docs/Types/String.md
@@ -1,5 +1,5 @@
-Native: String {#String}
-========================
+String {#String}
+================
A collection of the String Object prototype methods.
@@ -9,8 +9,32 @@ A collection of the String Object prototype methods.
-String Method: test {#String:test}
-----------------------------------
+Function: String.from {#String-from}
+------------------------------------
+
+Returns the passed parameter as a String.
+
+### Syntax:
+
+ String.from(arg);
+
+### Arguments:
+
+1. arg - (*mixed*) The argument to return as a string.
+
+### Returns:
+
+* (*string*) The argument as a string.
+
+### Example:
+
+ String.from(2) // returns '2'
+ String.from(true) // returns 'true'
+
+
+
+String method: test {#test}
+---------------------------
Searches for a match between the string and a regular expression.
For more information see [MDC Regexp:test][].
@@ -41,8 +65,8 @@ For more information see [MDC Regexp:test][].
-String Method: contains {#String:contains}
-------------------------------------------
+String method: contains {#contains}
+-----------------------------------
Checks to see if the string passed in is contained in this string.
If the separator parameter is passed, will check to see if the string is contained in the list of values separated by that parameter.
@@ -69,8 +93,8 @@ If the separator parameter is passed, will check to see if the string is contain
-String Method: trim {#String:trim}
-----------------------------------
+String method: trim {#trim}
+---------------------------
Trims the leading and trailing spaces off a string.
@@ -88,8 +112,8 @@ Trims the leading and trailing spaces off a string.
-String Method: clean {#String:clean}
-------------------------------------
+String method: clean {#clean}
+-----------------------------
Removes all extraneous whitespace from a string and trims it ([String:trim][]).
@@ -107,8 +131,8 @@ Removes all extraneous whitespace from a string and trims it ([String:trim][]).
-String Method: camelCase {#String:camelCase}
---------------------------------------------
+String method: camelCase {#camelCase}
+-------------------------------------
Converts a hyphenated string to a camelcased string.
@@ -126,8 +150,8 @@ Converts a hyphenated string to a camelcased string.
-String Method: hyphenate {#String:hyphenate}
---------------------------------------------
+String method: hyphenate {#hyphenate}
+-------------------------------------
Converts a camelcased string to a hyphenated string.
@@ -145,8 +169,8 @@ Converts a camelcased string to a hyphenated string.
-String Method: capitalize {#String:capitalize}
-----------------------------------------------
+String method: capitalize {#capitalize}
+---------------------------------------
Converts the first letter of each word in a string to uppercase.
@@ -164,8 +188,8 @@ Converts the first letter of each word in a string to uppercase.
-String Method: escapeRegExp {#String:escapeRegExp}
---------------------------------------------------
+String method: escapeRegExp {#escapeRegExp}
+-------------------------------------------
Escapes all regular expression characters from the string.
@@ -183,8 +207,8 @@ Escapes all regular expression characters from the string.
-String Method: toInt {#String:toInt}
-------------------------------------
+String method: toInt {#toInt}
+-----------------------------
Parses this string and returns a number of the specified radix or base.
@@ -212,8 +236,8 @@ Parses this string and returns a number of the specified radix or base.
-String Method: toFloat {#String:toFloat}
-----------------------------------------
+String method: toFloat {#toFloat}
+---------------------------------
Parses this string and returns a floating point number.
@@ -237,10 +261,10 @@ Parses this string and returns a floating point number.
-String Method: hexToRgb {#String:hexToRgb}
-------------------------------------------
+String method: hexToRgb {#hexToRgb}
+-----------------------------------
-Converts a hexidecimal color value to RGB. Input string must be in one of the following hexidecimal color formats (with or without the hash).
+Converts a hexidecimal colour value to RGB. Input string must be in one of the following hexidecimal colour formats (with or without the hash).
'#ffffff', #fff', 'ffffff', or 'fff'
### Syntax:
@@ -264,10 +288,10 @@ Converts a hexidecimal color value to RGB. Input string must be in one of the fo
-String Method: rgbToHex {#String:rgbToHex}
-------------------------------------------
+String method: rgbToHex {#rgbToHex}
+-----------------------------------
-Converts an RGB color value to hexidecimal. Input string must be in one of the following RGB color formats.
+Converts an RGB colour value to hexidecimal. Input string must be in one of the following RGB color formats.
"rgb(255,255,255)", or "rgba(255,255,255,1)"
### Syntax:
@@ -280,7 +304,7 @@ Converts an RGB color value to hexidecimal. Input string must be in one of the f
### Returns:
-* (*string*) A string representing the color in hexadecimal, or transparent if the fourth value of rgba in the input string is 0.
+* (*string*) A string representing the colour in hexadecimal, or transparent if the fourth value of rgba in the input string is 0.
* (*array*) If the array flag is set, an array will be returned instead.
### Examples:
@@ -295,54 +319,55 @@ Converts an RGB color value to hexidecimal. Input string must be in one of the f
-String Method: stripScripts {#String:stripScripts}
-------------------------------------------
+String method: substitute {#substitute}
+---------------------------------------
-Strips the String of its `<script>` tags and anything in between them.
+Substitutes keywords in a string using an object/array.
+Removes undefined keywords and ignores escaped keywords.
### Syntax:
- myString.stripScripts([evaluate]);
+ myString.substitute(object[, regexp]);
### Arguments:
-1. evaluate - (*boolean*, optional) If true is passed, the scripts within the String will be evaluated.
+1. object - (*mixed*) The key/value pairs used to substitute a string.
+1. regexp - (*regexp*, optional) The regexp pattern to be used in the string keywords, with global flag. Defaults to /\\?\{([^}]+)\}/g .
### Returns:
-* (*string*) - The String without the stripped scripts.
+* (*string*) - The substituted string.
### Examples:
- var myString = "<script>alert('Hello')</script>Hello, World.";
- myString.stripScripts(); //Returns "Hello, World."
- myString.stripScripts(true); //Alerts "Hello", then returns "Hello, World."
+ var myString = "{subject} is {property_1} and {property_2}.";
+ var myObject = {subject: 'Jack Bauer', property_1: 'our lord', property_2: 'saviour'};
+ myString.substitute(myObject); //Jack Bauer is our lord and saviour
-String Method: substitute {#String:substitute}
-------------------------------------------
-Substitutes keywords in a string using an object/array.
-Removes undefined keywords and ignores escaped keywords.
+String method: stripScripts {#stripScripts}
+----------------------------------------------------
+
+Strips the String of its *<script>* tags and anything in between them.
### Syntax:
- myString.substitute(object[, regexp]);
+ myString.stripScripts([evaluate]);
### Arguments:
-1. object - (*mixed*) The key/value pairs used to substitute a string.