Created
March 5, 2010 21:18
-
-
Save gsf/323161 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// name, attrs, content, callback | |
libxml.Element.Arguments = function(args) { | |
var ret_args = null; | |
switch (args.length) { | |
case 1: | |
ret_args = [args[0], null, null, null]; | |
break; | |
case 2: // name, callback; name, attrs; name, content | |
if (typeof args[1] == 'function') | |
ret_args = [args[0], null, null, args[1]]; | |
else if (typeof args[1] == 'string') | |
ret_args = [args[0], null, args[1], null]; | |
else | |
ret_args = [args[0], args[1], null, null]; | |
break; | |
case 3: // name, attrs, content; name, attrs, callback | |
if (typeof args[2] == 'function') | |
ret_args = [args[0], args[1], null, args[2]]; | |
else | |
ret_args = [args[0], args[1], args[2], null]; | |
break; | |
case 4: // name, attrs, content, callback | |
ret_args = [args[0], args[1], args[2], args[3]]; | |
} | |
return ret_args; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment