Merge "Removed old HTMLCacheUpdateJob b/c code"
[lhc/web/wiklou.git] / resources / src / jquery / jquery.getAttrs.js
index 5d6a1d4..64827fb 100644 (file)
@@ -2,6 +2,18 @@
  * @class jQuery.plugin.getAttrs
  */
 
+function serializeControls( controls ) {
+       var i,
+               data = {},
+               len = controls.length;
+
+       for ( i = 0; i < len; i++ ) {
+               data[ controls[i].name ] = controls[i].value;
+       }
+
+       return data;
+}
+
 /**
  * Get the attributes of an element directy as a plain object.
  *
  * @return {Object}
  */
 jQuery.fn.getAttrs = function () {
-       var i,
-               map = this[0].attributes,
-               attrs = {},
-               len = map.length;
-
-       for ( i = 0; i < len; i++ ) {
-               attrs[ map[i].name ] = map[i].value;
-       }
+       return serializeControls( this[0].attributes );
+};
 
-       return attrs;
+/**
+ * Get form data as a plain object mapping form control names to their values.
+ *
+ * @return {Object}
+ */
+jQuery.fn.serializeObject = function () {
+       return serializeControls( this.serializeArray() );
 };
 
 /**