* technically, chainable - there really isn't much use for chaining against it.
* You can have as many $(document).ready events on your page as you like.
*
+ * See ready(Function) for details about the ready event.
+ *
* @example $(function(){
* // Document is ready
* });
* @type String
* @cat DOM
*/
+
+ /**
+ * Set the text contents of all matched elements. This has the same
+ * effect as calling .html() with your specified string.
+ *
+ * @example $("p").text("Some new text.");
+ * @before <p>Test Paragraph.</p>
+ * @result <p>Some new text.</p>
+ *
+ * @param String val The text value to set the contents of the element to.
+ *
+ * @name text
+ * @type String
+ * @cat DOM
+ */
text: function(e) {
+ // A surprisingly high number of people expect the
+ // .text() method to do this, so lets do it!
+ if ( typeof e == "string" )
+ return this.html( e );
+
e = e || this;
var t = "";
for ( var j = 0; j < e.length; j++ ) {
"^=": "z && !z.indexOf(m[4])",
"$=": "z && z.substr(z.length - m[4].length,m[4].length)==m[4]",
"*=": "z && z.indexOf(m[4])>=0",
- "": "z"
+ "": "z",
+ _resort: function(m){
+ return ["", m[1], m[3], m[2], m[5]];
+ },
+ _prefix: "z=jQuery.attr(a,m[3]);"
},
"[": "jQuery.find(m[2],a).length"
},
- /**
+ /**
* All elements on a specified axis.
*
* @private
* @name $.sibling
* @type Array
* @param Element elem The element to find all the siblings of (including itself).
- * @cat DOM/Traversing
- */
+ * @cat DOM/Traversing
+ */
sibling: function( n, elem ) {
var r = [];
value: "value",
disabled: "disabled",
checked: "checked",
- readonly: "readOnly"
+ readonly: "readOnly",
+ selected: "selected"
};
// IE actually uses filters for opacity ... elem is actually elem.style
if ( m ) {
// Re-organize the first match
- if ( !i )
- m = ["",m[1], m[3], m[2], m[5]];
+ if ( jQuery.expr[ m[1] ]._resort )
+ m = jQuery.expr[ m[1] ]._resort( m );
// Remove what we just matched
t = t.replace( re, "" );
// Build a custom macro to enclose it
eval("f = function(a,i){" +
- ( m[1] == "@" ? "z=jQuery.attr(a,m[3]);" : "" ) +
+ ( jQuery.expr[ m[1] ]._prefix || "" ) +
"return " + f + "}");
// Execute it against the current filter
event = jQuery.event.fix( event || window.event || {} ); // Empty object is for triggered events with no data
- // If no correct event was found, fail
- if ( !event ) return false;
-
var returnValue = true;
var c = this.events[event.type];
},
fix: function(event) {
- // check IE
- if(jQuery.browser.msie) {
- // fix target property, if available
- // check prevents overwriting of fake target coming from trigger
- if(event.srcElement)
- event.target = event.srcElement;
-
- // calculate pageX/Y
+ // Fix target property, if necessary
+ if ( !event.target && event.srcElement )
+ event.target = event.srcElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( typeof event.pageX == "undefined" && typeof event.clientX != "undefined" ) {
var e = document.documentElement, b = document.body;
event.pageX = event.clientX + (e.scrollLeft || b.scrollLeft);
event.pageY = event.clientY + (e.scrollTop || b.scrollTop);
+ }
- // check safari and if target is a textnode
- } else if(jQuery.browser.safari && event.target.nodeType == 3) {
+ // Check safari and if target is a textnode
+ if ( jQuery.browser.safari && event.target.nodeType == 3 ) {
// target is readonly, clone the event object
event = jQuery.extend({}, event);
// get parentnode from textnode
}
// fix preventDefault and stopPropagation
- if (!event.preventDefault)
+ if (!event.preventDefault) {
event.preventDefault = function() {
this.returnValue = false;
};
+ }
- if (!event.stopPropagation)
+ if (!event.stopPropagation) {
event.stopPropagation = function() {
this.cancelBubble = true;
};
+ }
return event;
}
/**
* Get the html contents of the first matched element.
+ * This property is not available on XML documents.
*
* @example $("div").html();
* @before <div><input/></div>
/**
* Set the html contents of every matched element.
+ * This property is not available on XML documents.
*
* @example $("div").html("<b>new stuff</b>");
* @before <div><input/></div>