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

Side by Side Diff: dart/site/try/iframe.js

Issue 126003002: Address comments from CL 125123002 and additional cleanup. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update copyright year. Created 6 years, 11 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
« no previous file with comments | « dart/site/try/extracted_themes.dart ('k') | dart/site/try/leap.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 function dartPrint(msg) { 5 function dartPrint(msg) {
6 window.parent.postMessage(String(msg), "*"); 6 window.parent.postMessage(String(msg), "*");
7 } 7 }
8 8
9 window.onerror = function (message, url, lineNumber) { 9 window.onerror = function (message, url, lineNumber) {
10 window.parent.postMessage( 10 window.parent.postMessage(
11 ["error", {message: message, url: url, lineNumber: lineNumber}], "*"); 11 ["error", {message: message, url: url, lineNumber: lineNumber}], "*");
12 }; 12 };
13 13
14 function onMessageReceived(event) { 14 function onMessageReceived(event) {
15 var data = event.data; 15 var data = event.data;
16 if (data instanceof Array) { 16 if (data instanceof Array) {
17 if (data.length == 2 && data[0] == 'source') { 17 if (data.length == 2 && data[0] == 'source') {
18 var script = document.createElement('script'); 18 var script = document.createElement('script');
19 script.innerHTML = data[1]; 19 script.innerHTML = data[1];
20 script.type = 'application/javascript'; 20 script.type = 'application/javascript';
21 document.head.appendChild(script); 21 document.head.appendChild(script);
22 return; 22 return;
23 } 23 }
24 } 24 }
25 } 25 }
26 26
27 window.addEventListener("message", onMessageReceived, false); 27 window.addEventListener("message", onMessageReceived, false);
28 28
29 (function () { 29 (function () {
30 function postScrollHeight() { 30 function postScrollHeight() {
31 window.parent.postMessage(["scrollHeight", document.documentElement.scrollHeig ht], "*"); 31 window.parent.postMessage(
32 } 32 ["scrollHeight", document.documentElement.scrollHeight], "*");
33 }
33 34
34 var observer = new (window.MutationObserver||window.WebKitMutationObserver||wind ow.MozMutationObserver)(function(mutations) { 35 var mutationObserverConstructor =
35 postScrollHeight() 36 window.MutationObserver ||
36 window.setTimeout(postScrollHeight, 500); 37 window.WebKitMutationObserver ||
37 }); 38 window.MozMutationObserver;
38 39
39 observer.observe( 40 var observer = new mutationObserverConstructor(function(mutations) {
40 document.body, 41 postScrollHeight()
41 { attributes: true, 42 window.setTimeout(postScrollHeight, 500);
42 childList: true, 43 });
43 characterData: true, 44
44 subtree: true }); 45 observer.observe(
46 document.body,
47 { attributes: true,
48 childList: true,
49 characterData: true,
50 subtree: true });
45 })(); 51 })();
OLDNEW
« no previous file with comments | « dart/site/try/extracted_themes.dart ('k') | dart/site/try/leap.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698