OLD | NEW |
(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("Internals", function(global) { |
| 8 var InternalsPrototype = Object.create(Element.prototype); |
| 9 |
| 10 InternalsPrototype.doNothing = function() { |
| 11 } |
| 12 |
| 13 InternalsPrototype.return123 = function() { |
| 14 return 123; |
| 15 } |
| 16 |
| 17 InternalsPrototype.echoInteger = function(value) { |
| 18 return value; |
| 19 } |
| 20 |
| 21 InternalsPrototype.echoString = function(value) { |
| 22 return value; |
| 23 } |
| 24 |
| 25 InternalsPrototype.echoNode = function(value) { |
| 26 return value; |
| 27 } |
| 28 |
| 29 InternalsPrototype.addInteger = function(value1, value2) { |
| 30 return value1 + value2; |
| 31 } |
| 32 |
| 33 InternalsPrototype.addString = function(value1, value2) { |
| 34 return value1 + value2; |
| 35 } |
| 36 |
| 37 InternalsPrototype.setIntegerToDocument = function(document, value) { |
| 38 document.integer = value; |
| 39 } |
| 40 |
| 41 InternalsPrototype.getIntegerFromDocument = function(document) { |
| 42 return document.integer; |
| 43 } |
| 44 |
| 45 InternalsPrototype.setIntegerToPrototype = function(value) { |
| 46 this.integer = value; |
| 47 } |
| 48 |
| 49 InternalsPrototype.getIntegerFromPrototype = function() { |
| 50 return this.integer; |
| 51 } |
| 52 |
| 53 InternalsPrototype.createElement = function(document) { |
| 54 return document.createElement("div"); |
| 55 } |
| 56 |
| 57 InternalsPrototype.appendChild = function(node1, node2) { |
| 58 node1.appendChild(node2); |
| 59 } |
| 60 |
| 61 InternalsPrototype.firstChild = function(node) { |
| 62 return node.firstChild; |
| 63 } |
| 64 |
| 65 InternalsPrototype.nextSibling = function(node) { |
| 66 return node.nextSibling; |
| 67 } |
| 68 |
| 69 InternalsPrototype.innerHTML = function(node) { |
| 70 return node.innerHTML; |
| 71 } |
| 72 |
| 73 InternalsPrototype.setInnerHTML = function(node, string) { |
| 74 node.innerHTML = string; |
| 75 } |
| 76 |
| 77 InternalsPrototype.addClickListener = function(node) { |
| 78 node.addEventListener("click", function () { |
| 79 node.innerHTML = "clicked"; |
| 80 }); |
| 81 } |
| 82 |
| 83 InternalsPrototype.clickNode = function(document, node) { |
| 84 var event = new MouseEvent("click", { bubbles: true, cancelable: true, v
iew: global }); |
| 85 node.dispatchEvent(event); |
| 86 } |
| 87 |
| 88 return InternalsPrototype; |
| 89 }); |
OLD | NEW |