This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RELNOTES[NEW]: Add basic support for pointer event types.
- Add BrowserEvent#pointerType property. - Add BrowserFeature#[MS]POINTER_EVENTS checks. - Add PointerFallbackEventType enum to simplify replacing mouse events with pointer events. NEW: replaced switch statement with object lookup in BrowserEvent.getPointerType_. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167759144
- Loading branch information
John Plaisted
committed
Sep 6, 2017
1 parent
2c1bf21
commit 339594e
Showing
9 changed files
with
255 additions
and
10 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,9 @@ | ||
<!DOCTYPE html><!-- DO NOT EDIT. This file auto-generated by generate_closure_unit_tests.js --><!-- | ||
Copyright 2017 The Closure Library Authors. All Rights Reserved. | ||
Use of this source code is governed by the Apache License, Version 2.0. | ||
See the COPYING file for details. | ||
--><html><head><meta charset="UTF-8"> | ||
<script src="../base.js"></script> | ||
<script>goog.require('goog.events.EventTypeTest');</script> | ||
<title>Closure Unit Tests - goog.events.EventTypeTest</title></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,45 @@ | ||
// Copyright 2017 The Closure Library Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS-IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
goog.provide('goog.events.EventTypeTest'); | ||
goog.setTestOnly('goog.events.EventTypeTest'); | ||
|
||
goog.require('goog.events.BrowserFeature'); | ||
goog.require('goog.events.EventType'); | ||
goog.require('goog.events.PointerFallbackEventType'); | ||
goog.require('goog.testing.jsunit'); | ||
goog.require('goog.userAgent'); | ||
|
||
function testPointerFallbackEventType() { | ||
if (goog.events.BrowserFeature.POINTER_EVENTS) { | ||
// Pointer events are supported; use W3C PointerEvent | ||
assertEquals( | ||
goog.events.EventType.POINTERDOWN, | ||
goog.events.PointerFallbackEventType.POINTERDOWN); | ||
} else if (goog.events.BrowserFeature.MSPOINTER_EVENTS) { | ||
// Only IE10 should support MSPointerEvent | ||
assertTrue( | ||
goog.userAgent.IE && goog.userAgent.isVersionOrHigher('10') && | ||
!goog.userAgent.isVersionOrHigher('11')); | ||
// W3C PointerEvent not supported; fall back to MSPointerEvent | ||
assertEquals( | ||
goog.events.EventType.MSPOINTERDOWN, | ||
goog.events.PointerFallbackEventType.POINTERDOWN); | ||
} else { | ||
// Pointer events not supported; fall back to MouseEvent | ||
assertEquals( | ||
goog.events.EventType.MOUSEDOWN, | ||
goog.events.PointerFallbackEventType.POINTERDOWN); | ||
} | ||
} |
Oops, something went wrong.