aboutsummaryrefslogtreecommitdiffstats
path: root/src/jquery/jquery.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2007-06-29 19:52:38 +0000
committerJohn Resig <jeresig@gmail.com>2007-06-29 19:52:38 +0000
commitfd249ca808408166882847c217d55ae4c5a799e8 (patch)
tree23f80a09cbe6f9d36484d536d2e0415202bc496b /src/jquery/jquery.js
parent05864eebcd4b6907043197ca9817715c3a46aa1b (diff)
downloadjquery-fd249ca808408166882847c217d55ae4c5a799e8.tar.gz
jquery-fd249ca808408166882847c217d55ae4c5a799e8.zip
Added massive speed improvements to selectors. Also added support for :nth-child(An+B) syntax.
Diffstat (limited to 'src/jquery/jquery.js')
-rw-r--r--src/jquery/jquery.js70
1 files changed, 36 insertions, 34 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 52b524a74..fe8b32bc5 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -830,9 +830,9 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Traversing
*/
find: function(t) {
- return this.pushStack( jQuery.unique( jQuery.map( this, function(a){
- return jQuery.find(t,a);
- }) ), t );
+ var data = jQuery.map(this, function(a){ return jQuery.find(t,a); });
+ return this.pushStack( /[^+>] [^+>]/.test( t ) || t.indexOf("..") > -1 ?
+ jQuery.unique( data ) : data );
},
/**
@@ -1553,37 +1553,7 @@ jQuery.extend({
},
attr: function(elem, name, value){
- var fix = jQuery.isXMLDoc(elem) ? {} : {
- "for": "htmlFor",
- "class": "className",
- "float": jQuery.browser.msie ? "styleFloat" : "cssFloat",
- cssFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
- styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
- innerHTML: "innerHTML",
- className: "className",
- value: "value",
- disabled: "disabled",
- checked: "checked",
- readonly: "readOnly",
- selected: "selected",
- maxlength: "maxLength"
- };
-
- // IE actually uses filters for opacity ... elem is actually elem.style
- if ( name == "opacity" && jQuery.browser.msie ) {
- if ( value != undefined ) {
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- elem.zoom = 1;
-
- // Set the alpha filter to set the opacity
- elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") +
- (parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
- }
-
- return elem.filter ?
- (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : "";
- }
+ var fix = jQuery.isXMLDoc(elem) ? {} : jQuery.props;
// Certain attributes only work when accessed via the old DOM 0 way
if ( fix[name] ) {
@@ -1595,6 +1565,22 @@ jQuery.extend({
// IE elem.getAttribute passes even for style
else if ( elem.tagName ) {
+ // IE actually uses filters for opacity ... elem is actually elem.style
+ if ( name == "opacity" && jQuery.browser.msie ) {
+ if ( value != undefined ) {
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ elem.zoom = 1;
+
+ // Set the alpha filter to set the opacity
+ elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") +
+ (parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
+ }
+
+ return elem.filter ?
+ (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : "";
+ }
+
if ( value != undefined ) elem.setAttribute( name, value );
if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) )
return elem.getAttribute( name, 2 );
@@ -1833,6 +1819,22 @@ new function() {
// Check to see if the W3C box model is being used
jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat";
+
+ jQuery.props = {
+ "for": "htmlFor",
+ "class": "className",
+ "float": jQuery.browser.msie ? "styleFloat" : "cssFloat",
+ cssFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
+ styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
+ innerHTML: "innerHTML",
+ className: "className",
+ value: "value",
+ disabled: "disabled",
+ checked: "checked",
+ readonly: "readOnly",
+ selected: "selected",
+ maxlength: "maxLength"
+ };
};
/**