Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #498 from Polymer/revert-497-platform_issue_83
Browse files Browse the repository at this point in the history
Revert "restore isLoadLikeEvent"
  • Loading branch information
John Messerly committed Aug 27, 2014
2 parents b17c814 + 22ac2a8 commit 79837e5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 42 deletions.
18 changes: 3 additions & 15 deletions src/wrappers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,6 @@
}
}


function isLoadLikeEvent(event) {
switch (event.type) {
// http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#events-and-the-window-object
case 'load':
// http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#unloading-documents
case 'beforeunload':
case 'unload':
return true;
}
return false;
}

function dispatchEvent(event, originalWrapperTarget) {
if (currentlyDispatchingEvents.get(event))
throw new Error('InvalidStateError');
Expand All @@ -267,11 +254,12 @@
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#the-end
var overrideTarget;
var win;
var type = event.type;

// Should really be not cancelable too but since Firefox has a bug there
// we skip that check.
// https://bugzilla.mozilla.org/show_bug.cgi?id=999456
if (isLoadLikeEvent(event) && !event.bubbles) {
if (type === 'load' && !event.bubbles) {
var doc = originalWrapperTarget;
if (doc instanceof wrappers.Document && (win = doc.defaultView)) {
overrideTarget = doc;
Expand All @@ -286,7 +274,7 @@
} else {
eventPath = getEventPath(originalWrapperTarget, event);

if (!isLoadLikeEvent(event)) {
if (event.type !== 'load') {
var doc = eventPath[eventPath.length - 1];
if (doc instanceof wrappers.Document)
win = doc.defaultView;
Expand Down
26 changes: 0 additions & 26 deletions test/html/on-unload-test.html

This file was deleted.

1 change: 0 additions & 1 deletion test/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,6 @@ test('retarget order (multiple shadow roots)', function() {
});

htmlTest('html/on-load-test.html');
htmlTest('html/on-unload-test.html');

test('event wrap round trip', function() {
var e = new Event('x');
Expand Down

0 comments on commit 79837e5

Please sign in to comment.