Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Bug 385434: Add support for HTML5 onhashchange. r=smaug, sr=sicking
- Loading branch information
jlebar
committed
Jun 26, 2009
1 parent
0f90334
commit 8e7e8ce
Showing
22 changed files
with
490 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- | ||
Inner frame for test of bug 385434. | ||
https://bugzilla.mozilla.org/show_bug.cgi?id=385434 | ||
--> | ||
<html> | ||
<head> | ||
<script type="application/javascript"> | ||
function hashchange() { | ||
parent.onIframeHashchange(); | ||
} | ||
|
||
function load() { | ||
parent.onIframeLoad(); | ||
} | ||
|
||
function scroll() { | ||
parent.onIframeScroll(); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body onscroll="scroll()" onload="load()" onhashchange="hashchange()"> | ||
<a href="#link1" id="link1">link1</a> | ||
<!-- Our parent loads us in an iframe with height 100px, so this spacer ensures | ||
that switching between #link1 and #link2 causes us to scroll --> | ||
<div style="height:200px;"></div> | ||
<a href="#link2" id="link2">link2</a> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!-- | ||
Inner frame for test of bug 385434. | ||
https://bugzilla.mozilla.org/show_bug.cgi?id=385434 | ||
--> | ||
<html> | ||
<head> | ||
<script type="application/javascript"> | ||
function hashchange(e) { | ||
// pass the event back to the parent so it can check its properties. | ||
parent.gSampleEvent = e; | ||
|
||
parent.statusMsg("Hashchange in 2."); | ||
parent.onIframeHashchange(); | ||
} | ||
|
||
function load() { | ||
parent.statusMsg("Loading 2."); | ||
parent.onIframeLoad(); | ||
} | ||
</script> | ||
</head> | ||
|
||
<frameset onload="load()" onhashchange="hashchange(event)"> | ||
<frame src="about:blank" /> | ||
</frameset> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- | ||
Inner frame for test of bug 385434. | ||
https://bugzilla.mozilla.org/show_bug.cgi?id=385434 | ||
--> | ||
<html> | ||
<head> | ||
<script type="application/javascript"> | ||
// Notify our parent if we have a hashchange and once we're done loading. | ||
window.addEventListener("hashchange", parent.onIframeHashchange, false); | ||
window.addEventListener("load", parent.onIframeLoad, false); | ||
|
||
// This shouldn't trigger a hashchange, because we haven't finished loading | ||
// the document. | ||
window.location.hash = "1"; | ||
|
||
window.addEventListener("DOMContentLoaded", function() { | ||
// This also shouldn't trigger a hashchange, becuase the readystate is | ||
// "interactive", not "complete" during DOMContentLoaded. | ||
window.location.hash = "2"; | ||
}, false); | ||
|
||
</script> | ||
</head> | ||
|
||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!-- | ||
Inner frame for test of bug 385434. | ||
https://bugzilla.mozilla.org/show_bug.cgi?id=385434 | ||
--> | ||
<html> | ||
<head> | ||
<script type="application/javascript"> | ||
window.addEventListener("hashchange", function() { | ||
parent.statusMsg("Hashchange in 4a."); | ||
parent.onIframeHashchange(); | ||
}, false); | ||
|
||
window.addEventListener("load", function() { | ||
parent.statusMsg("Load listener."); | ||
document.location.hash = "foo"; | ||
|
||
// synchronously wipe out the whole document. The new document shouldn't | ||
// have a hashchange event dispatched to it. | ||
document.open(); | ||
|
||
window.addEventListener("hashchange", function() { | ||
parent.statusMsg("Hashchange in 4a after document.open()"); | ||
parent.onIframeHashchange(); | ||
}, false); | ||
|
||
}, false); | ||
|
||
</script> | ||
</head> | ||
<body> | ||
<!-- This page is loaded in an iframe 100px high, so the div below forces #foo | ||
off the screen, and we can count that focusing it will trigger a scroll.--> | ||
<div style="height:200px"></div> | ||
<a name="foo">Foo</a> | ||
</body> | ||
</html> |
Oops, something went wrong.