Skip to content

Instantly share code, notes, and snippets.

@savetheclocktower
Created December 28, 2012 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savetheclocktower/b57071237417d8743f88 to your computer and use it in GitHub Desktop.
Save savetheclocktower/b57071237417d8743f88 to your computer and use it in GitHub Desktop.
Test case for #82 (https://github.com/sstephenson/prototype/pull/82). Place both files into the `test` directory in the Prototype source code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Prototype Console</title>
<script src="../dist/prototype.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
if (window.top && window.top !== window) {
window.top.Foo.bar('from iframe');
} else if (parent && parent.opener) {
parent.opener.Foo.bar('from popup');
}
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Prototype Console</title>
<script src="../dist/prototype.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
var Foo = {
variable: 9,
bar: function(description) {
[1].each(function() {
console.log(description, 'this:', this, 'this.variable:', this.variable);
}, this);
}
};
</script>
<iframe src="iframe.html"></iframe>
<button id="open_window">Open window</button>
<script type="text/javascript">
$('open_window').on('click', function () { window.open('iframe.html'); });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment