diff options
author | John Resig <jeresig@gmail.com> | 2006-08-22 05:00:07 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2006-08-22 05:00:07 +0000 |
commit | ccabf2823b528c09455432cafdb504c6a0216a18 (patch) | |
tree | ea29f761f055d827f6c690000909c05db39a1f7a /build/js | |
parent | 5ae02b2ecd6293ef33de3d3acf00c456ed01b776 (diff) | |
download | jquery-ccabf2823b528c09455432cafdb504c6a0216a18.tar.gz jquery-ccabf2823b528c09455432cafdb504c6a0216a18.zip |
Updated the documentation parser to work with categories. Additionally, I updated the copyright notice in the jQuery header and removed some extraneous whitespace from jQuery Lite.
Diffstat (limited to 'build/js')
-rw-r--r-- | build/js/parse.js | 28 | ||||
-rw-r--r-- | build/js/xml.js | 2 |
2 files changed, 29 insertions, 1 deletions
diff --git a/build/js/parse.js b/build/js/parse.js index 5b60b0a5b..c9454d173 100644 --- a/build/js/parse.js +++ b/build/js/parse.js @@ -67,3 +67,31 @@ function parse( f ) { return c; } + +function categorize( json ) { + var obj = { methods: [] }; + + for ( var i = 0; i < json.length; i++ ) { + if ( !json[i].cat ) json[i].cat = ""; + + var cat = json[i].cat.split("/"); + + var pos = obj; + for ( var j = 0; j < cat.length; j++ ) { + var c = cat[j]; + + // Create current category + if ( !pos[c] ) pos[c] = { methods: [] }; + + // If we're at the end, add the method + if ( j == cat.length - 1 ) + pos[c].methods.push( json[i] ); + + // Otherwise, traverse deeper + else + pos = pos[c]; + } + } + + return obj; +} diff --git a/build/js/xml.js b/build/js/xml.js index cc94eb750..b2b09c608 100644 --- a/build/js/xml.js +++ b/build/js/xml.js @@ -9,7 +9,7 @@ Object.toXML = function( obj, tag ) { var p = "", child = ""; for ( var i in obj ) - if ( obj[i].constructor == Array || /</.test(obj[i] + "") || Object.toXML.force[i] ) + if ( obj[i].constructor != String || /</.test(obj[i] + "") || Object.toXML.force[i] ) child += Object.toXML( obj[i], i ); else p += " " + i + "='" + (obj[i] + "").replace(/'/g, "'") + "'"; |