I'm running JSLint checks in Rhino using jslintant.js.
I found something a bit strange and was wondering if I could gets some input from other programmers. Basically, the following line gets a JSLint 'Script URL' error:
var a = '<a href="javascript:alert(\'I am a bookmarklet\');" >Drag me to your Toolbar</a>';
Error:
Lint at line 124 character 35: Script URL.
I've gone into the code that Douglas Crockford wrote in fulljslint.js and found that indeed he is testing for this as follows:
// javascript url
jx = /(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i,
So, given this constraint and the fact that drag and drop bookmarklets only use the HREF attribute of the A tag. How are we meant to dynamically create bookmarklets that pass a JSLint test?
Thanks for your input.
'javascript' + ':' + bookmarkletJs
myself but I'm wondering if there is a more elegant approach. – Epigraphic