aboutsummaryrefslogtreecommitdiffstats
path: root/build/js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2006-09-01 05:52:26 +0000
committerJohn Resig <jeresig@gmail.com>2006-09-01 05:52:26 +0000
commitc8009abcce562198cbc3930ed11f74dd62eba531 (patch)
tree0653407bea3ee0c7332c9a4723b20328ffe2d978 /build/js
parent805d21c2360a10fa5e7ac85cc593b4403afb6c9f (diff)
downloadjquery-c8009abcce562198cbc3930ed11f74dd62eba531.tar.gz
jquery-c8009abcce562198cbc3930ed11f74dd62eba531.zip
Lots of documentation overhaul - much more documented, cat output works better now.
Diffstat (limited to 'build/js')
-rw-r--r--build/js/parse.js17
-rw-r--r--build/js/xml.js6
2 files changed, 15 insertions, 8 deletions
diff --git a/build/js/parse.js b/build/js/parse.js
index c9454d173..498361d71 100644
--- a/build/js/parse.js
+++ b/build/js/parse.js
@@ -69,7 +69,7 @@ function parse( f ) {
}
function categorize( json ) {
- var obj = { methods: [] };
+ var obj = { cat: [], method: [] };
for ( var i = 0; i < json.length; i++ ) {
if ( !json[i].cat ) json[i].cat = "";
@@ -79,17 +79,26 @@ function categorize( json ) {
var pos = obj;
for ( var j = 0; j < cat.length; j++ ) {
var c = cat[j];
+ var curCat = null;
+
+ // Locate current category
+ for ( var n = 0; n < pos.cat.length; n++ )
+ if ( pos.cat[n].value == c )
+ curCat = pos.cat[n];
// Create current category
- if ( !pos[c] ) pos[c] = { methods: [] };
+ if ( !curCat ) {
+ curCat = { value: c, cat: [], method: [] };
+ pos.cat.push( curCat )
+ }
// If we're at the end, add the method
if ( j == cat.length - 1 )
- pos[c].methods.push( json[i] );
+ curCat.method.push( json[i] );
// Otherwise, traverse deeper
else
- pos = pos[c];
+ pos = curCat;
}
}
diff --git a/build/js/xml.js b/build/js/xml.js
index b2b09c608..1d50558e1 100644
--- a/build/js/xml.js
+++ b/build/js/xml.js
@@ -9,15 +9,13 @@ Object.toXML = function( obj, tag ) {
var p = "", child = "";
for ( var i in obj )
- if ( obj[i].constructor != String || /</.test(obj[i] + "") || Object.toXML.force[i] )
+ if ( ( obj[i].constructor != String && obj[i].constructor != Number ) || /</.test(obj[i] + "") || Object.toXML.force[i] )
child += Object.toXML( obj[i], i );
else
p += " " + i + "='" + (obj[i] + "").replace(/'/g, "&apos;") + "'";
return "<" + tag + p + ( child ? ">\n" + child + "</" + tag + ">\n" : "/>\n" );
- } else if ( obj.constructor == String ) {
- //obj = obj.replace(/&lt;/g,"<").replace(/&gt;/g,">");
- //return "<" + tag + "><![CDATA[" + obj + "]]></" + tag + ">";
+ } else if ( obj.constructor == String || obj.constructor == Number ) {
return "<" + tag + ">" + obj + "</" + tag + ">\n";
}