Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added Docs and changelog for Element.match(element), cleanup

  • Loading branch information...
commit a861d1f374880017528dab9cece303f680ce6b61 1 parent f75ea8d
Jan Kassens kassens authored
1  CHANGELOG
View
@@ -3,6 +3,7 @@
[ADD] Browser.Engine detection for WebKit version 525
[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
2  Compatibility/Class/Class.js
View
@@ -5,4 +5,4 @@ Class.empty = $empty;
Class.prototype.extend = function(properties){
properties.Extends = this;
return new Class(properties);
-};
+};
6 Docs/Core/Browser.md
View
@@ -24,10 +24,10 @@ Some browser properties are attached to the Browser Object for browser and platf
* Browser.Platform.mac - (*boolean*) True if the platform is Mac.
* Browser.Platform.win - (*boolean*) True if the platform is Windows.
* Browser.Platform.linux - (*boolean*) True if the platform is Linux.
-* Browser.Platform.ipod - (*boolean*) True if the platform is an ipod touch / iphone.
-* Browser.Platform.other - (*boolean*) True if the platform is neither Mac, Windows or Linux.
+* Browser.Platform.ipod - (*boolean*) True if the platform is an iPod touch / iPhone.
+* 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:
-- Engine detection is entirely feature-based.
+- Engine detection is entirely feature-based.
2  Docs/Core/Core.md
View
@@ -45,7 +45,7 @@ Clears a Timeout or an Interval. Useful when working with [Function:delay][] and
### Returns:
-* (*false*) returns null.
+* (*null*) returns null.
### Example:
27 Docs/Element/Element.md
View
@@ -380,28 +380,39 @@ This is a "dynamic arguments" method. Properties passed in can be any of the 'er
Element Method: match {#Element:match}
--------------------------------------
-Tests this Element to see if its tag name is the same as the tag passed in. If [Selectors][] is included, CSS selectors may also be passed.
+Tests this Element to see if it matches the argument passed in.
### Syntax:
- myElement.match(tag);
+ myElement.match(match);
### Arguments:
-1. tag - (*string*) The tag name to test against this element.
+1. match - can be a string or element
+ - (*string*) The tag name to test against this element. If [Selectors][] is included, any single CSS selectors may also be passed.
+ - (*element*) An element to match; returns true if this is the actual element passed in.
### Returns:
-* (*boolean*) If the element has the specified tag name, returns true. Otherwise, returns false.
+* (*boolean*) If the element matched, returns true. Otherwise, returns false.
### Examples:
- $('myDiv').match('div'); //Returns true if myDiv is a div.
+#### Using a Tag Name:
-### Notes:
+ //Returns true if #myDiv is a div.
+ $('myDiv').match('div');
+
+#### Using a CSS Selector:
+
+ //Returns true if #myDiv has the class foo and is named "bar"
+ $('myDiv').match('.foo[name=bar]');
+
+#### Using an Element:
-- See [Element:match](/Selectors/Selectors#Element:match).
-- This method is overwritten by a more powerful version when [Selectors][] is included.
+ var el = $('myDiv');
+ $('myDiv').match(el); //Returns true
+ $('otherElement').match(el); //Returns false
2  Docs/Native/Array.md
View
@@ -390,7 +390,7 @@ Returns the last item from the array.
### Returns:
* (*mixed*) The last item in this array.
-* (*false*) If this array is empty, returns null.
+* (*null*) If this array is empty, returns null.
### Examples:
2  Docs/Native/Hash.md
View
@@ -263,7 +263,7 @@ Retrieves a value from the hash.
### Returns:
* (*mixed*) Returns the value that corresponds to the key if found.
-* (*false*) null if the key doesn't exist
+* (*null*) null if the key doesn't exist.
### Examples:
4 Docs/Native/String.md
View
@@ -199,7 +199,7 @@ Parses this string and returns a number of the specified radix or base.
### Returns:
* (*number*) The number.
-* (*false*) If the string is not numeric, returns NaN.
+* (*NaN*) If the string is not numeric, returns NaN.
### Examples:
@@ -224,7 +224,7 @@ Parses this string and returns a floating point number.
### Returns:
* (*number*) The float.
-* (*false*) If the string is not numeric, returns NaN.
+* (*NaN*) If the string is not numeric, returns NaN.
### Examples:
33 Docs/Utilities/Selectors.md
View
@@ -74,36 +74,7 @@ Same as [Element:getElements](#Element:getElements), but returns only the first.
var found = $('myElement').getElement('.findMe').setStyle('color', '#f00');
-### Note:
-
-Element Method: match {#Element:match}
---------------------------------------
-
-Matches the Element with the given selector.
-
-### Syntax:
-
- var matched = myElement.match(selector);
-### Arguments:
-
-1. selector - (*string*) Selector to match the Element to.
-
-### Returns:
-
-* (*boolean*) true if matched, otherwise false.
-
-### Example:
-
- //Returns true if the Element is a div named "somename".
- $('myElement').match('div[name=somename]');
-
-
-
-### See Also:
-
-[$]: /Element/Element#dollar
-[Element]: /Element/Element
Selectors.Pseudo {#Selectors}
=============================
@@ -286,6 +257,6 @@ Matches an only child of its parent Element.
$$('td:only-child');
-
+[$]: /Element/Element#dollar
[Element]: /Element/Element
-[Selectors]: /Selectors/Selectors
+[Selectors]: /Selectors/Selectors
30 Source/Core/Browser.js
View
@@ -7,33 +7,33 @@ License:
*/
var Browser = $merge({
-
+
Engine: {name: 'unknown', version: 0},
-
+
Platform: {name: (window.orientation != undefined) ? 'ipod' : (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase()},
-
+
Features: {xpath: !!(document.evaluate), air: !!(window.runtime), query: !!(document.querySelector)},
-
+
Plugins: {},
-
+
Engines: {
-
+
presto: function(){
return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925));
},
-
+
trident: function(){
return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? 5 : 4);
},
-
+
webkit: function(){
return (navigator.taintEnabled) ? false : ((Browser.Features.xpath) ? ((Browser.Features.query) ? 525 : 420) : 419);
},
-
+
gecko: function(){
return (document.getBoxObjectFor == undefined) ? false : ((document.getElementsByClassName) ? 19 : 18);
}
-
+
}
}, Browser || {});
@@ -41,7 +41,7 @@ var Browser = $merge({
Browser.Platform[Browser.Platform.name] = true;
Browser.detect = function(){
-
+
for (var engine in this.Engines){
var version = this.Engines[engine]();
if (version){
@@ -50,11 +50,11 @@ Browser.detect = function(){
break;
}
}
-
+
return {name: engine, version: version};
-
+
};
-
+
Browser.detect();
Browser.Request = function(){
@@ -153,4 +153,4 @@ var Document = new Native({
Document.Prototype = {$family: {name: 'document'}};
-new Document(document);
+new Document(document);
4 Source/Element/Element.js
View
@@ -533,7 +533,7 @@ Element.implement({
});
return this;
},
-
+
dispose: function(){
return (this.parentNode) ? this.parentNode.removeChild(this) : this;
},
@@ -663,4 +663,4 @@ if (Browser.Engine.webkit && Browser.Engine.version < 420) Element.Properties.te
temp.destroy();
return text;
}
-};
+};
Please sign in to comment.
Something went wrong with that request. Please try again.