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

Commit 79837e5

Browse files
author
John Messerly
committed
Merge pull request #498 from Polymer/revert-497-platform_issue_83
Revert "restore isLoadLikeEvent"
2 parents b17c814 + 22ac2a8 commit 79837e5

File tree

3 files changed

+3
-42
lines changed

3 files changed

+3
-42
lines changed

src/wrappers/events.js

+3-15
Original file line numberDiff line numberDiff line change
@@ -237,19 +237,6 @@
237237
}
238238
}
239239

240-
241-
function isLoadLikeEvent(event) {
242-
switch (event.type) {
243-
// http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#events-and-the-window-object
244-
case 'load':
245-
// http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#unloading-documents
246-
case 'beforeunload':
247-
case 'unload':
248-
return true;
249-
}
250-
return false;
251-
}
252-
253240
function dispatchEvent(event, originalWrapperTarget) {
254241
if (currentlyDispatchingEvents.get(event))
255242
throw new Error('InvalidStateError');
@@ -267,11 +254,12 @@
267254
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#the-end
268255
var overrideTarget;
269256
var win;
257+
var type = event.type;
270258

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

289-
if (!isLoadLikeEvent(event)) {
277+
if (event.type !== 'load') {
290278
var doc = eventPath[eventPath.length - 1];
291279
if (doc instanceof wrappers.Document)
292280
win = doc.defaultView;

test/html/on-unload-test.html

-26
This file was deleted.

test/js/events.js

-1
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,6 @@ test('retarget order (multiple shadow roots)', function() {
928928
});
929929

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

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

0 commit comments

Comments
 (0)