Local debugging switches
[bus.git] / busui / jquery-mobile-1.0a2.js
blob:a/busui/jquery-mobile-1.0a2.js -> blob:b/busui/jquery-mobile-1.0a2.js
   
   
  /*!
  * jQuery JavaScript Library v1.4.4
  * http://jquery.com/
  *
  * Copyright 2010, John Resig
  * Dual licensed under the MIT or GPL Version 2 licenses.
  * http://jquery.org/license
  *
  * Includes Sizzle.js
  * http://sizzlejs.com/
  * Copyright 2010, The Dojo Foundation
  * Released under the MIT, BSD, and GPL Licenses.
  *
  * Date: Thu Nov 11 19:04:53 2010 -0500
  */
  (function( window, undefined ) {
   
  // Use the correct document accordingly with window argument (sandbox)
  var document = window.document;
  var jQuery = (function() {
   
  // Define a local copy of jQuery
  var jQuery = function( selector, context ) {
  // The jQuery object is actually just the init constructor 'enhanced'
  return new jQuery.fn.init( selector, context );
  },
   
  // Map over jQuery in case of overwrite
  _jQuery = window.jQuery,
   
  // Map over the $ in case of overwrite
  _$ = window.$,
   
  // A central reference to the root jQuery(document)
  rootjQuery,
   
  // A simple way to check for HTML strings or ID strings
  // (both of which we optimize for)
  quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
   
  // Is it a simple selector
  isSimple = /^.[^:#\[\.,]*$/,
   
  // Check if a string has a non-whitespace character in it
  rnotwhite = /\S/,
  rwhite = /\s/,
   
  // Used for trimming whitespace
  trimLeft = /^\s+/,
  trimRight = /\s+$/,
   
  // Check for non-word characters
  rnonword = /\W/,
   
  // Check for digits
  rdigit = /\d/,
   
  // Match a standalone tag
  rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
   
  // JSON RegExp
  rvalidchars = /^[\],:{}\s]*$/,
  rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
   
  // Useragent RegExp
  rwebkit = /(webkit)[ \/]([\w.]+)/,
  ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
  rmsie = /(msie) ([\w.]+)/,
  rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
   
  // Keep a UserAgent string for use with jQuery.browser
  userAgent = navigator.userAgent,
   
  // For matching the engine and version of the browser
  browserMatch,
   
  // Has the ready events already been bound?
  readyBound = false,
   
  // The functions to execute on DOM ready
  readyList = [],
   
  // The ready event handler
  DOMContentLoaded,
   
  // Save a reference to some core methods
  toString = Object.prototype.toString,
  hasOwn = Object.prototype.hasOwnProperty,
  push = Array.prototype.push,
  slice = Array.prototype.slice,
  trim = String.prototype.trim,
  indexOf = Array.prototype.indexOf,
   
  // [[Class]] -> type pairs
  class2type = {};
   
  jQuery.fn = jQuery.prototype = {
  init: function( selector, context ) {
  var match, elem, ret, doc;
   
  // Handle $(""), $(null), or $(undefined)
  if ( !selector ) {
  return this;
  }
   
  // Handle $(DOMElement)
  if ( selector.nodeType ) {
  this.context = this[0] = selector;
  this.length = 1;
  return this;
  }
   
  // The body element only exists once, optimize finding it
  if ( selector === "body" && !context && document.body ) {
  this.context = document;
  this[0] = document.body;
  this.selector = "body";
  this.length = 1;
  return this;
  }
   
  // Handle HTML strings
  if ( typeof selector === "string" ) {
  // Are we dealing with HTML string or an ID?
  match = quickExpr.exec( selector );
   
  // Verify a match, and that no context was specified for #id
  if ( match && (match[1] || !context) ) {
   
  // HANDLE: $(html) -> $(array)
  if ( match[1] ) {
  doc = (context ? context.ownerDocument || context : document);
   
  // If a single string is passed in and it's a single tag
  // just do a createElement and skip the rest
  ret = rsingleTag.exec( selector );
   
  if ( ret ) {
  if ( jQuery.isPlainObject( context ) ) {
  selector = [ document.createElement( ret[1] ) ];
  jQuery.fn.attr.call( selector, context, true );
   
  } else {
  selector = [ doc.createElement( ret[1] ) ];
  }
   
  } else {
  ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
  selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
  }
   
  return jQuery.merge( this, selector );
   
  // HANDLE: $("#id")
  } else {
  elem = document.getElementById( match[2] );
   
  // Check parentNode to catch when Blackberry 4.6 returns
  // nodes that are no longer in the document #6963
  if ( elem && elem.parentNode ) {
  // Handle the case where IE and Opera return items
  // by name instead of ID
  if ( elem.id !== match[2] ) {
  return rootjQuery.find( selector );
  }
   
  // Otherwise, we inject the element directly into the jQuery object
  this.length = 1;
  this[0] = elem;
  }
   
  this.context = document;
  this.selector = selector;
  return this;
  }
   
  // HANDLE: $("TAG")
  } else if ( !context && !rnonword.test( selector ) ) {
  this.selector = selector;
  this.context = document;
  selector = document.getElementsByTagName( selector );
  return jQuery.merge( this, selector );
   
  // HANDLE: $(expr, $(...))
  } else if ( !context || context.jquery ) {
  return (context || rootjQuery).find( selector );
   
  // HANDLE: $(expr, context)
  // (which is just equivalent to: $(context).find(expr)
  } else {
  return jQuery( context ).find( selector );
  }
   
  // HANDLE: $(function)
  // Shortcut for document ready
  } else if ( jQuery.isFunction( selector ) ) {
  return rootjQuery.ready( selector );
  }
   
  if (selector.selector !== undefined) {
  this.selector = selector.selector;
  this.context = selector.context;
  }
   
  return jQuery.makeArray( selector, this );
  },
   
  // Start with an empty selector
  selector: "",
   
  // The current version of jQuery being used
  jquery: "1.4.4",
   
  // The default length of a jQuery object is 0
  length: 0,
   
  // The number of elements contained in the matched element set
  size: function() {
  return this.length;
  },
   
  toArray: function() {
  return slice.call( this, 0 );
  },
   
  // Get the Nth element in the matched element set OR
  // Get the whole matched element set as a clean array
  get: function( num ) {
  return num == null ?
   
  // Return a 'clean' array
  this.toArray() :
   
  // Return just the object
  ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
  },
   
  // Take an array of elements and push it onto the stack
  // (returning the new matched element set)
  pushStack: function( elems, name, selector ) {
  // Build a new jQuery matched element set
  var ret = jQuery();
   
  if ( jQuery.isArray( elems ) ) {
  push.apply( ret, elems );
   
  } else {
  jQuery.merge( ret, elems );
  }
   
  // Add the old object onto the stack (as a reference)
  ret.prevObject = this;
   
  ret.context = this.context;
   
  if ( name === "find" ) {
  ret.selector = this.selector + (this.selector ? " " : "") + selector;
  } else if ( name ) {
  ret.selector = this.selector + "." + name + "(" + selector + ")";
  }
   
  // Return the newly-formed element set
  return ret;
  },
   
  // Execute a callback for every element in the matched set.
  // (You can seed the arguments with an array of args, but this is
  // only used internally.)
  each: function( callback, args ) {
  return jQuery.each( this, callback, args );
  },
   
  ready: function( fn ) {
  // Attach the listeners
  jQuery.bindReady();
   
  // If the DOM is already ready
  if ( jQuery.isReady ) {
  // Execute the function immediately
  fn.call( document, jQuery );
   
  // Otherwise, remember the function for later
  } else if ( readyList ) {
  // Add the function to the wait list
  readyList.push( fn );
  }
   
  return this;
  },
   
  eq: function( i ) {
  return i === -1 ?
  this.slice( i ) :
  this.slice( i, +i + 1 );
  },
   
  first: function() {
  return this.eq( 0 );
  },
   
  last: function() {
  return this.eq( -1 );
  },
   
  slice: function() {
  return this.pushStack( slice.apply( this, arguments ),
  "slice", slice.call(arguments).join(",") );
  },
   
  map: function( callback ) {
  return this.pushStack( jQuery.map(this, function( elem, i ) {
  return callback.call( elem, i, elem );
  }));
  },
   
  end: function() {
  return this.prevObject || jQuery(null);
  },
   
  // For internal use only.
  // Behaves like an Array's method, not like a jQuery method.
  push: push,
  sort: [].sort,
  splice: [].splice
  };
   
  // Give the init function the jQuery prototype for later instantiation
  jQuery.fn.init.prototype = jQuery.fn;
   
  jQuery.extend = jQuery.fn.extend = function() {
  var options, name, src, copy, copyIsArray, clone,
  target = arguments[0] || {},
  i = 1,
  length = arguments.length,
  deep = false;
   
  // Handle a deep copy situation
  if ( typeof target === "boolean" ) {
  deep = target;
  target = arguments[1] || {};
  // skip the boolean and the target
  i = 2;
  }
   
  // Handle case when target is a string or something (possible in deep copy)
  if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  target = {};
  }
   
  // extend jQuery itself if only one argument is passed
  if ( length === i ) {
  target = this;
  --i;
  }
   
  for ( ; i < length; i++ ) {
  // Only deal with non-null/undefined values
  if ( (options = arguments[ i ]) != null ) {
  // Extend the base object
  for ( name in options ) {
  src = target[ name ];
  copy = options[ name ];
   
  // Prevent never-ending loop
  if ( target === copy ) {
  continue;
  }
   
  // Recurse if we're merging plain objects or arrays
  if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
  if ( copyIsArray ) {
  copyIsArray = false;
  clone = src && jQuery.isArray(src) ? src : [];
   
  } else {
  clone = src && jQuery.isPlainObject(src) ? src : {};
  }
   
  // Never move original objects, clone them
  target[ name ] = jQuery.extend( deep, clone, copy );
   
  // Don't bring in undefined values
  } else if ( copy !== undefined ) {
  target[ name ] = copy;
  }
  }
  }
  }
   
  // Return the modified object
  return target;
  };
   
  jQuery.extend({
  noConflict: function( deep ) {
  window.$ = _$;
   
  if ( deep ) {
  window.jQuery = _jQuery;
  }
   
  return jQuery;
  },
   
  // Is the DOM ready to be used? Set to true once it occurs.
  isReady: false,
 <