没有任何数据可供显示
| 开源项目社区 | 当前位置 : |
|
| www.trustie.net/open_source_projects | 主页 > 开源项目社区 > golfdom |
|
golfdom
|
| 0 | 0 | 0 |
| 贡献者 | 讨论 | 代码提交 |
golfdom is a DOM implementation and browser environment written in JavaScript. It aims to be compatible with Mozilla's Gecko, and to support popular JavaScript libraries like jQuery and Prototype for use server-side or anywhere else a DOM is required but a browser is unavailable.
golfdom is close to basic functionality and can run Prototype 1.6 with some modifications to the Prototype source.
Statusgolfdom is unfortunately nowhere near completion. Some of the things it's lacking:
event handler support lots of other stuff DevelopmentI've been testing golfdom with SEE, a fantastic JavaScript interpreter library. SEE comes packaged with an interpreter that can be used to develop and run golfdom.
How to UseGet a JavaScript interpreter like SEE (C), Rhino (Java) or SpiderMonkey (C). Change the println() statements in document.js to the native output function of the interpreter you're using. In see-shell, the one packaged with libSEE, it's print(). Put together a simple test script that includes document.js and element.js, and use document.render() to print your browser-less DOM tree. Simple Exampledocument = new Document();
document.title = "golfdom is Awesome";
p1 = document.createElement("p");
p1.innerHTML = "this is the first paragraph.";
p1.id = "first_paragraph";
document.body.appendChild(p1);
p2 = document.createElement("p");
p2.innerHTML = "this is the second paragraph";
document.body.appendChild(p2);
if(document.getElementById("first_paragraph")) {
p2.innerHTML = "I found an element id using the dom interface.";
}else{
p2.innerHTML = "I didn't find an element id using the dom interface.";
}
document.render();
标签:
