Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: Source/bindings/v8/BlinkInJSTest.js

Issue 345893002: Implement an infrastructure of Blink-in-JS Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 "use strict";
6
7 installClass("BlinkInJSTest", function() {
8 function doNothing() {
9 }
10 function return123() {
11 return 123;
12 }
13 function echoInteger(value) {
14 return value;
15 }
16 function echoString(value) {
17 return value;
18 }
19 function echoNode(value) {
20 return value;
21 }
22 function addInteger(value1, value2) {
23 return value1 + value2;
24 }
25 function addString(value1, value2) {
26 return value1 + value2;
27 }
28 function setIntegerToDocument(document, value) {
29 document.integer = value;
30 }
31 function getIntegerFromDocument(document) {
32 return document.integer;
33 }
34 function createElement(document) {
35 return document.createElement("div");
36 }
37 function appendChild(node1, node2) {
38 node1.appendChild(node2);
39 }
40 function firstChild(node) {
41 return node.firstChild;
42 }
43 function nextSibling(node) {
44 return node.nextSibling;
45 }
46 function innerHTML(node) {
47 return node.innerHTML;
48 }
49 function setInnerHTML(node, string) {
arv (Not doing code reviews) 2014/06/20 15:06:22 Is there a plan to support getters and setters?
haraken 2014/06/23 01:32:55 Yes, will do that in a follow-up.
50 node.innerHTML = string;
51 }
52 function addClickListener(node) {
53 node.addEventListener("click", function () {
54 node.innerHTML = "clicked";
55 });
56 }
57 function clickNode(document, node) {
58 var event = document.createEvent("MouseEvents");
arv (Not doing code reviews) 2014/06/20 15:06:22 var event = new MouseEvent('click', { bubbles: t
haraken 2014/06/23 01:32:55 Hmm, if I use 'new MouseEvent', it crashes. This l
haraken 2014/06/23 07:15:03 Fixed. The reason of the crash was that I was cach
59 event.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
60 node.dispatchEvent(event);
61 }
62
63 return { doNothing : doNothing,
64 return123 : return123,
65 echoInteger : echoInteger,
66 echoString : echoString,
67 echoNode : echoNode,
68 addInteger : addInteger,
69 addString : addString,
70 setIntegerToDocument : setIntegerToDocument,
71 getIntegerFromDocument : getIntegerFromDocument,
72 createElement : createElement,
73 appendChild : appendChild,
74 firstChild : firstChild,
75 nextSibling : nextSibling,
76 innerHTML : innerHTML,
77 setInnerHTML : setInnerHTML,
78 addClickListener : addClickListener,
79 clickNode : clickNode,
80 };
81 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698