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

Side by Side Diff: Source/core/testing/Internals.js

Issue 362993004: Implement Blink-in-JS for DOM attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 "use strict"; 5 "use strict";
6 6
7 installClass("Internals", function(global) { 7 installClass("Internals", function(global) {
8 var InternalsPrototype = Object.create(Element.prototype); 8 var InternalsPrototype = Object.create(Element.prototype);
9 9
10 InternalsPrototype.constructor = function() {
11 this.m_shortAttribute = -1;
12 this.m_stringAttribute = "xxx";
13 this.m_nodeAttribute = null;
14 }
15
10 InternalsPrototype.doNothing = function() { 16 InternalsPrototype.doNothing = function() {
11 } 17 }
12 18
13 InternalsPrototype.return123 = function() { 19 InternalsPrototype.return123 = function() {
14 return 123; 20 return 123;
15 } 21 }
16 22
17 InternalsPrototype.echoInteger = function(value) { 23 InternalsPrototype.echoInteger = function(value) {
18 return value; 24 return value;
19 } 25 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 node.addEventListener("click", function () { 84 node.addEventListener("click", function () {
79 node.innerHTML = "clicked"; 85 node.innerHTML = "clicked";
80 }); 86 });
81 } 87 }
82 88
83 InternalsPrototype.clickNode = function(document, node) { 89 InternalsPrototype.clickNode = function(document, node) {
84 var event = new MouseEvent("click", { bubbles: true, cancelable: true, v iew: global }); 90 var event = new MouseEvent("click", { bubbles: true, cancelable: true, v iew: global });
85 node.dispatchEvent(event); 91 node.dispatchEvent(event);
86 } 92 }
87 93
94 Object.defineProperty(InternalsPrototype, "readonlyShortAttribute", {
95 get: function() { return 123; }
96 });
97
98 Object.defineProperty(InternalsPrototype, "shortAttribute", {
99 get: function() { return this.m_shortAttribute; },
100 set: function(value) { this.m_shortAttribute = value; }
101 });
102
103 Object.defineProperty(InternalsPrototype, "stringAttribute", {
104 get: function() { return this.m_stringAttribute; },
105 set: function(value) { this.m_stringAttribute = value; }
106 });
107
108 Object.defineProperty(InternalsPrototype, "nodeAttribute", {
109 get: function() { return this.m_nodeAttribute; },
110 set: function(value) { this.m_nodeAttribute = value; }
111 });
112
88 return InternalsPrototype; 113 return InternalsPrototype;
89 }); 114 });
OLDNEW
« Source/bindings/core/v8/PrivateScriptRunner.cpp ('K') | « Source/core/testing/Internals.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698