What is the best way to debug JavaScript and CSS? [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
There are quite a few tools out there to debug JavaScript and CSS. Firebug, "Alert" messages, Script Debugger, MSE7.exe
I was wondering if anyone could chime in on which one happens to be the best and easiest tool to debug JavaScript and CSS issues?
Thanks

Firebug and Chrome Dev tools are pretty much the gold standard client side.
Chrome docs:
http://code.google.com/chrome/devtools/docs/overview.html
Firebug docs:
http://getfirebug.com/wiki/index.php/Main_Page

As for CSS, Firebug has "Style" and "Computed" tabs. Just select an element, and inspect those tabs. I cannot think of any CSS issue that cannot be resolved with these.

For me, using Firebug (especially in Firefox) is the best solution.
Instead of using Alert messages have you tried console.log('your message')? This will save you clicking alert windows and output messages in the firebug console.

My personal choise is Chrome with its developer tools. Inspect element for css debugging, and Scripts tab for javascript source debugging. You may also use Console for js logging
But actually, web site should support debugging too. In production versions, generally both css and js files are minimized and concatenated, which is hard to debug.

Firefox : Firebug
IE : F12 and alert

I am an avid Firebug user, but another think you should consider is linting (validate against rules and best practices). This will not only help you learn some best practices but can also help identify coding issues before you get to the browser.
Here is a web based js lint tool which you have to paste your code into. Another alternative would be to find a plugin or extension for your IDE. For example, if you were an eclipse user, you can install the jslint plugin and check your code as you write it.

IE F12 is too slow to debug. With a heavy web apps, the browser will freeze for ages.

Related

JavaScript Documentation generator Cloud9 IDE [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Background
I just finished a small HTML5 project in cloud9 IDE. My project is composed of an index.html file, 3 JavaScript files, and a custom styles.css file.
I know I cannot document HTML and CSS, but since the core of my project is the JavaScript within it, I would like to document it.
Research
For this reason, I searched on how to use JavaScript documentation generator tools like JSDocs, Docco, Dox and Esdoc. I also read articles on the matter (comparison between JavaScript documentation tools) and I even gave a look at Naturaldocs.
Problem
The main problem here, is that (as far as I understand) these tools (with the exception of Naturaldocs) all produce beautiful HTML and Markdown pages based on the documentation that my files already have. They read the comments I added and then they generate a document based on it.
This is not what I am looking for.
What do I need?
I am looking for something like the comment feature of the pluggins Ghostdoc and Atomineer where you press a combination of keys and the pluggin documents your entire document with boilerplate code, saving you from that hassle.
Final notes
I installed all the previous tools (except Naturaldocs) using npm. Perhaps I missed something, but I didn't find any tool that does what Ghostdoc and Atomineer do, and I can't install any of these pluggins in the ACE editor that cloud9-ide uses (afaik).
TL;DR
Does anyone know of a way to document JavaScript files in the Cloud9 IDE?
Unfortunately, after researching, I concluded that there is no tool to automatically generate documentation based on JavaScript code. You have to document everything manually, and then pick one of the many existing tools to generate an HTML page or something similar.
I ended up using JSDoc, since its documentation standards are easily accessible and relatively well documented.
Hope this helps someone else coming from the same background I came from.
Additionally, I also created a feature request on the official forums:
https://community.c9.io/t/javascript-documentation-generator-cloud9-ide/5918
Hopefully someone will see it and make something out of it.
there is no plugin for ace, but there are cli tools like http://smartcomments.github.io/, you could use it on cloud9 too.

Pure JavaScript Programming [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm diving into web development again (first time was an utter failure), and I have some pretty spectacular resources for learning both HTML5 and CSS3. What I want to begin studying next is JavaScript so I can have absolute control over my pages. But before I begin integrating JavaScript into my work, I'd like to use JavaScript solely as a programming language (with console I/O and basic programs) to familiarize myself first. What are the best tools for accomplishing this? Because thus far, I haven't found any browser/tool that approaches the simplicity of writing a source file, and clicking run like you might with a C++ program. Thanks.
Node.js is your best shot.
Node is used for:
Server-side applications (Sails, Express, Socket.io)
Various frontend-related scripting (Grunt, LESS)
You can try Node.js, that allows you to run Javascript programs from commandline. Other than that, Javascript runs in a browser.
I think JetBrains makes the best IDEs in the world. Their support of JavaScript, HTML5, and CSS3 is first-rate. I'd recommend looking at WebStorm as your IDE.
I would recommend jsfiddle.net which allows you to type and run code. I might also suggest codecademy.com which has a very good program to teach you javascript and many other languages as well. There is also a really simple part of there website called "codebits" where you can compile js, html, and css and play around. W3schools.com is also very helpful for reference.
If you are running windows, the Windows Scripting Host (WSH) can run both Visual Basic Scripting and JavaScript... with the JavaScript having full access to things.
Because Microsoft supprorted VB Script over JScript (their version of EMCAScript), it is difficult to find documentation, though it does exist. I have a fair number of admin tools written in JScript.
Because that's not how Javascript works. You can't read user input from console.
You can use any browser's development tools and write Javascript code line by line.

Greasemonkey-like Firefox plugin for automatic browsing [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Is there a plug-in for Firefox that would allow user's Javascript code like Greasemonkey and be able to browse from page to page?
I'd like to write a script to:
Log in to a website.
Follow several links.
Make a GET request to that host periodically with given data and time intervals.
Make a POST request based on the results of the previous in-loop requests.
Now I use Python's mechanize for a browser so I'm looking for something with similar (maybe not that rich) functionality within Firefox. Do you have experience with that type of things? What should I check out?
Selenium - which has an interface for recording and running tests inside the browser but can also export tests in many languages including Python for running as a suite in the SeleniumRC tool.
Or
Chickenfoot (You'll probably need to use setTimeout for the repeating requests.)
(source: mit.edu)
You also have iMacros
The software's description on Mozilla Addons says :
Automate Firefox. Record and replay
repetitious work. If you love the
Firefox web browser, but are tired of
repetitive tasks like visiting the
same sites every days, filling out
forms, and remembering passwords, then
iMacros for Firefox is the solution
you’ve been dreaming of! Whatever you
do with Firefox, iMacros can automate
it.
(source: extjs.com)
I would recommend Selenium RC. It comes as a Java command line tool and allows you to remote-control both Firefox, IE and Safari. Although it is officially a browser based web-testing tool, it can be very useful for crawling and scraping AJAX-based web applications and for all sort of automated tasks otherwise difficult to accomplish with non graphical HTTP clients such as Curl, Hpricot and Mechanize.
Moreover, it's widely spread, has an API for most popular programming languages (including python), and allows you inject custom javascript code within web-pages.
PS:
Documentation is here

What's the best way to debug Javascript on IE? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What's the best way to debug Javascript on Internet Explorer?
Depends on what tools you have available to you.
If you have a copy of Visual Studio, I'd use the Visual Studio debugger. It works pretty well. You'll need to try following the instructions in that link if you don't have a full copy of Visual Studio, otherwise it's built in to the IDE and is pretty simple to use.
Another option is Firebug Lite, which is pretty good for most situations, but you need to add a script reference to every page you want to debug in order for it to work.
Using Microsoft Script Editor is an option too:
See my answer here.
I try to run the same code in Firefox to see if Firebug will be any help. But, with IE specific errors, this obviously doesn't work.
You could always fall back on alert statements peppered throughout your suspect code. It's not pretty or easy, though.
The VS debugger is usually decent, but things like Firebug Lite never worked well for me.
google says :
http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx
http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html
Use MS Visual Studio (free) to debug JS, explained here: http://www.berniecode.com/blog/2007/03/08/how-to-debug-javascript-with-visual-web-developer-express/
I tend to use a mix of blackbird, Companion.JS and Microsoft Script Editor.
I have got to say, that Firebug is unstable for my current project, maybe because I use jQuery. But it is the best because of his interface and feature list. As to stability, I have no claims on Microsoft Script Editor. But it's useless for cases, when script has syntax errors
As to Visual Studio's debugger, I didn't try that one
By the way, Firebug lite can be used through bookmarklet (http://remysharp.com/2007/03/13/firebug-in-ie-for-any-web-site/). So there is no need "to add a script reference to every page you want to debug in order for it to work"
I have been using IE8 beta with its built in debugger for a few months now. It is very powerful and works well. It has a few trivial glitches, but is the best tool I have used so far for client side debugging.
http://www.microsoft.com/windows/Internet-explorer/beta/default.aspx
It's a big commitment to install the IE8 beta, though.

What is the best tool to benchmark my JavaScript? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm currently working on a JavaScript tool that, during the course of its execution, will ultimately traverse each node in the DOM. Because this has potential to be a very expensive task, I'd like to benchmark the performance of this script.
What's the best, free tool for benchmarking a script such as this across the major browsers? Ideally, I'd like the tool (or set of tools, even):
**To generate some form of report based on the results of the test.** It can be as simple as a table showing execution times, or as complex as generating some form of a chart. Either way is fine.
**To be free.** it's not that I don't believe in paying for software, it's just that I don't have a major need for a tool like this in my typical day-to-day tasks.
If possible, I'd also like the tool to generate varying levels of complex pages so that I can stress test a set of DOMs. This isn't a necessity - if I need to do so, I can write one myself; however, I'd figure I'd poll the community first to see if something already exists.
Firebug does include JS profiling, and it is probably the best out there. While I've had problems with Firebug's debugger, its profiler is currently top-of-the-line. Venkman is also an older JS debugger/profiler for Firefox, just in case you run into Firebug issues.
Using these tools should get you just about all the profiling you need across all browsers even though you'll only be monitoring Firefox. If you truly need to get down to dirty details of IE profiling and the like, there are a number of tools online that inject profiling calls into your javascript to help monitor all profiler-lacking browsers....but even to a JS performance nazi like me, this seems unnecessary.
Note: A new, very promising IE8 JS profiler has recently been announced: http://blogs.msdn.com/ie/archive/2008/09/11/introducing-the-ie8-developer-tools-jscript-profiler.aspx.
In FireBug and FireBug Lite you can call the console.time() and console.timeEnd() methods in your code to start and end a timer around a particular piece of code. The Profiler tool in FireBug will measure how long each function takes. I've used it a lot to narrow down which lines of a particularly slow function are causing the slowdown
I believe Firebug includes profiling of JS code. Of course, it's not available in all the major browsers--only Firefox.
Jeff posted The great browser javascript shutdown
SunSpider JavaScript Benchmark
But i wonder where the download link is ;)
For JavaScript, XmlHttpRequest, DOM Access, Rendering Times and Network traffic for IE6, 7 & 8 you can use the free dynaTrace AJAX Edition

Categories