Hacker News new | ask | show | jobs
by mattl 4317 days ago
http://www.gnu.org/philosophy/javascript-trap.html

Our tentative policy is to consider a JavaScript program nontrivial if:

* it makes an AJAX request or is loaded along with scripts that make an AJAX request,

* it loads external scripts dynamically or is loaded along with scripts that do,

* it defines functions or methods and either loads an external script (from html) or is loaded as one,

* it uses dynamic JavaScript constructs that are difficult to analyze without interpreting the program, or is loaded along with scripts that use such constructs. These constructs are:

- using the eval function,

- calling methods with the square bracket notation,

- using any other construct than a string literal with certain methods (Obj.write, Obj.createElement, ...).

How do we tell whether the JavaScript code is free? At the end of this article we propose a convention by which a nontrivial JavaScript program in a web page can state the URL where its source code is located, and can state its license too, using stylized comments.