This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
As requested on the mailing-list by brian gianforcaro: This http://www.w3.org/QA/2008/08/markup_validator_updated.html post describes json support for the Markup validator. It mentions that it followed the design of validator.nu One of the feature's that validator.nu supports for it's JSON output is JSONP or JSON callback parameter. Essentially the entire json is rapped in a function call that you specify, very nice for some specific use cases. I havn't found this feature to be supported on the markup validator. Have I missed something? If not I would like to submit a feature request to add " callback " as a parameter to the validator when output is set to "json".
I asked henri sivonen how it was supposed to work. [01:32] <hsivonen> karl: not by default, but you can get a callback by appending &callback=foo to the URL [01:36] <karl> hsivonen: oh I see :) so the foo is more the choice of the developer who wants to use the output [01:36] <hsivonen> karl: you can use any ECMAScript-compatible identifier in place of foo [01:37] <hsivonen> (yes, it actually validates whether it is an ECMA-compliant ident) [01:37] <karl> hsivonen: what I meant… is that the "foo" is not imposed by me but by the user [01:38] <hsivonen> karl: foo is chosen by whoever puts together the URL [01:38] <karl> cool [01:38] <karl> thanks So the template is to be modified and the main source code to give the possibility of constructing such URI and sending to the template. It also seems that we have to be careful about the "foo" value which as to be a valid ECMAscript identifier. So a sanitizer seems to be necessary.
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf for the Identifier syntax. If we're lazy and want to use a CPAN module to validate the syntax: http://search.cpan.org/dist/JE/
Created attachment 621 [details] main program with callback support but no verification of the json value
Created attachment 622 [details] the template for the json output with the callback value
This is a first attempt at creating the callback feature. For now there is no checking if the value is an authorized ECMAScript identifier.
(In reply to comment #3) > Created an attachment (id=621) [details] > main program with callback support but no verification of the json value I looked at the diff, seems like you were working from a slightly outdated version of the check script. Hopefully a cvs update should merge properly. Other than that, great start. Let's see if we can perhaps figure out a regexp for what is an acceptable ECMASCIPT identifier? Then we'd be ready to go.