some work on making js magic more uniform and less surprising

some work on #1038, more work needed later