From 0181c0110985cfd2659e81c8cc1ef5a2f73bc697 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 14 Aug 2012 19:04:32 +0400 Subject: dojo: remove uncompressed files --- lib/dojo/dom-form.js.uncompressed.js | 166 ----------------------------------- 1 file changed, 166 deletions(-) delete mode 100644 lib/dojo/dom-form.js.uncompressed.js (limited to 'lib/dojo/dom-form.js.uncompressed.js') diff --git a/lib/dojo/dom-form.js.uncompressed.js b/lib/dojo/dom-form.js.uncompressed.js deleted file mode 100644 index 5a7210709..000000000 --- a/lib/dojo/dom-form.js.uncompressed.js +++ /dev/null @@ -1,166 +0,0 @@ -define("dojo/dom-form", ["./_base/lang", "./dom", "./io-query", "./json"], function(lang, dom, ioq, json){ - // module: - // dojo/dom-form - // summary: - // This module defines form-processing functions. - - /*===== - dojo.fieldToObject = function(inputNode){ - // summary: - // Serialize a form field to a JavaScript object. - // description: - // Returns the value encoded in a form field as - // as a string or an array of strings. Disabled form elements - // and unchecked radio and checkboxes are skipped. Multi-select - // elements are returned as an array of string values. - // inputNode: DOMNode|String - // returns: Object - }; - =====*/ - - /*===== - dojo.formToObject = function(formNode){ - // summary: - // Serialize a form node to a JavaScript object. - // description: - // Returns the values encoded in an HTML form as - // string properties in an object which it then returns. Disabled form - // elements, buttons, and other non-value form elements are skipped. - // Multi-select elements are returned as an array of string values. - // formNode: DOMNode|String - // returns: Object - // - // example: - // This form: - // |
- // | - // | - // | - // | - // |
- // - // yields this object structure as the result of a call to - // formToObject(): - // - // | { - // | blah: "blah", - // | multi: [ - // | "thud", - // | "thonk" - // | ] - // | }; - }; - =====*/ - - /*===== - dojo.formToQuery = function(formNode){ - // summary: - // Returns a URL-encoded string representing the form passed as either a - // node or string ID identifying the form to serialize - // formNode: DOMNode|String - // returns: String - }; - =====*/ - - /*===== - dojo.formToJson = function(formNode, prettyPrint){ - // summary: - // Create a serialized JSON string from a form node or string - // ID identifying the form to serialize - // formNode: DOMNode|String - // prettyPrint: Boolean? - // returns: String - }; - =====*/ - - function setValue(/*Object*/obj, /*String*/name, /*String*/value){ - // summary: - // For the named property in object, set the value. If a value - // already exists and it is a string, convert the value to be an - // array of values. - - // Skip it if there is no value - if(value === null){ - return; - } - - var val = obj[name]; - if(typeof val == "string"){ // inline'd type check - obj[name] = [val, value]; - }else if(lang.isArray(val)){ - val.push(value); - }else{ - obj[name] = value; - } - } - - var exclude = "file|submit|image|reset|button"; - - var form = { - fieldToObject: function fieldToObject(/*DOMNode|String*/ inputNode){ - var ret = null; - inputNode = dom.byId(inputNode); - if(inputNode){ - var _in = inputNode.name, type = (inputNode.type || "").toLowerCase(); - if(_in && type && !inputNode.disabled){ - if(type == "radio" || type == "checkbox"){ - if(inputNode.checked){ - ret = inputNode.value; - } - }else if(inputNode.multiple){ - ret = []; - var nodes = [inputNode.firstChild]; - while(nodes.length){ - for(var node = nodes.pop(); node; node = node.nextSibling){ - if(node.nodeType == 1 && node.tagName.toLowerCase() == "option"){ - if(node.selected){ - ret.push(node.value); - } - }else{ - if(node.nextSibling){ - nodes.push(node.nextSibling); - } - if(node.firstChild){ - nodes.push(node.firstChild); - } - break; - } - } - } - }else{ - ret = inputNode.value; - } - } - } - return ret; // Object - }, - - toObject: function formToObject(/*DOMNode|String*/ formNode){ - var ret = {}, elems = dom.byId(formNode).elements; - for(var i = 0, l = elems.length; i < l; ++i){ - var item = elems[i], _in = item.name, type = (item.type || "").toLowerCase(); - if(_in && type && exclude.indexOf(type) < 0 && !item.disabled){ - setValue(ret, _in, form.fieldToObject(item)); - if(type == "image"){ - ret[_in + ".x"] = ret[_in + ".y"] = ret[_in].x = ret[_in].y = 0; - } - } - } - return ret; // Object - }, - - toQuery: function formToQuery(/*DOMNode|String*/ formNode){ - return ioq.objectToQuery(form.toObject(formNode)); // String - }, - - toJson: function formToJson(/*DOMNode|String*/ formNode, /*Boolean?*/prettyPrint){ - return json.stringify(form.toObject(formNode), null, prettyPrint ? 4 : 0); // String - } - }; - - return form; -}); -- cgit v1.2.3