Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Web Browser? #35

Closed
angelozerr opened this issue Jan 12, 2015 · 2 comments
Closed

Support for Web Browser? #35

angelozerr opened this issue Jan 12, 2015 · 2 comments

Comments

@angelozerr
Copy link

I tell me if parse5 could be executedd too inside web browser?

tern https://github.com/marijnh/tern provides this cool feature. You can execute the JS inference engine

  • inside node
  • or web browser.

To fix problem with require, it use this code ::

(function(root, mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS
    return mod(exports, require("./infer"), require("./signal"),
               require("acorn/acorn"), require("acorn/util/walk"));
  if (typeof define == "function" && define.amd) // AMD
    return define(["exports", "./infer", "./signal", "acorn/acorn", "acorn/util/walk"], mod);
  mod(root.tern || (root.tern = {}), tern, tern.signal, acorn, acorn.walk); // Plain browser env
})(this, function(exports, infer, signal, acorn, walk) {
...

See https://github.com/marijnh/tern/blob/master/lib/tern.js

@inikulin
Copy link
Owner

Hi, I can't see any issue using it in the browser. However, you will need to browserify it first. See also: #34

@angelozerr
Copy link
Author

Hi, I can't see any issue using it in the browser.

In my case I would like to use to support completion for attributes id inside web browser editor with tern http://ternjs.net/doc/demo.html (and Sublime, Emacs, Vim, Eclipse which works with node) :

<html>
  <body>
    <div id="MyId" ></div> 
  </body>
  <script>
  document.getElementById(' // here Ctrl+Space shows MyId
  </script>
</html>

However, you will need to browserify it first. See also: #34

Thank's for the info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants