spidermonkey

How does event handling work internally within JavaScript?

拜拜、爱过 提交于 2019-11-27 13:09:35
问题 Specifically Spidermonkey. I know you write functions and attach them to events to handle them. Where is the onClick handler defined and how does the JS engine know to fire onClick events when the user clicks? Any keywords, design patterns, links, etc are appreciated. UPDATE Aggregating links I find useful here: http://www.w3.org/TR/DOM-Level-2-Events/events.html https://github.com/joyent/node/blob/master/src/node_events.cc http://mxr.mozilla.org/mozilla/source/dom/src/events

Click on a javascript link within python?

不羁岁月 提交于 2019-11-27 11:43:38
I am navigating a site using python's mechanize module and having trouble clicking on a javascript link for next page. I did a bit of reading and people suggested I need python-spidermonkey and DOMforms. I managed to get them installed by I am not sure of the syntax to actually click on the link. I can identify the code on the page as: <a href="javascript:__doPostBack('ctl00$MainContent$gvSearchResults','Page$2')">2</a> Does anyone know how to click on it? or if perhaps there's another tool. Thanks I mainly use HtmlUnit under jython for these use cases. Also I published a simple article on the

Javascript Engines Advantages

限于喜欢 提交于 2019-11-27 09:28:19
问题 I am confused about JavaScript engines right now. I know that V8 was a big deal because it compiled JavaScript to native code. Then I started reading about Mozilla SpiderMonkey, which from what I understand is written in C and can compile JavaScript. So how is this different from V8 and if this is true, why does Firefox not do this? Finally, does Rhino literally compile the JavaScript to Java byte code so you would get all the speed advantages of Java? If not, why do people not run V8 when

How do I get console input in javascript?

你说的曾经没有我的故事 提交于 2019-11-26 22:50:20
问题 I'm currently using spidermonkey to run my JavaScript code. I'm wondering if there's a function to get input from the console similar to how Python does this: var = raw_input() Or in C++: std::cin >> var; I've looked around and all I've found so far is how to get input from the browser using the prompt() and confirm() functions. 回答1: Good old readline(); See MDN docs: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell#readline.28.29 回答2

Are javascript Arrays actually implemented as arrays?

天涯浪子 提交于 2019-11-26 20:54:04
问题 The difference between a javascript Array , and Object is not very big. In fact it seems Array mainly adds the length field, so you can use both Array s and Object s as numeric arrays: var ar = new Array(); ar[0] = "foo"; ar["bar"] = "foo"; var ob = new Object(); ob[0] = "foo"; ob["bar"] = "foo"; assert(ar[0] == ob[0] == ar["0"] == ob["0"] == ar.bar == ob.bar); // Should be true. So my questions is, in popular javascript engines (V8, JavaScriptCore, SpiderMonkey, etc), how is this handled?

Constant declaration with block

女生的网名这么多〃 提交于 2019-11-26 18:32:30
问题 Recently I was looking into Firefox Add-on Builder SDK sources, and stumbled on such constants declaration: const { getCodeForKey, toJSON } = require("../../keyboard/utils"); I could find information about CommonJS Modules, but left part of this assignment slightly confuses me, since it must be language specific, and I couldn't google anything on that. Can someone point me to some specification/draft that explains what's going on here? 回答1: This is a destructuring assignment, something that

Embedding JavaScript engine into .NET [closed]

浪尽此生 提交于 2019-11-26 01:25:58
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . just wondering if anyone has ever tried embedding and actually integrating any js engine into the .net environment. I could find and actually use (after a LOT of pain and effort, since it\'s pretty outdated and not quite finished) spidermonkey-dotnet project. Anyone with experience in this area? Engines like