Skip to content

Commit b54f4b4

Browse files
author
Sebastien Pereira
committed
Rename attribute data-touch-action => touch-action.
Fixes #9
1 parent d32223d commit b54f4b4

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This project proposes a unified and consistent javascript events API which aims
55
This API is a shim of the [W3C Pointer Events specification][W3C_pointer] and adds features that are out of scope of the current specification.
66

77
- Generates **Pointer Events** according to the current specification..
8-
- Use attribute `data-touch-action` to set touch action on HTML elements; generates `touch-action` and `ms-touch-action` CSS properties when supported by the browser.
8+
- Use attribute `touch-action` to set touch action on HTML elements; generates `touch-action` and `ms-touch-action` CSS properties when supported by the browser.
99
- Support **Pointer Capture** with mouse and touch events.
1010
- Normalize **click** (Tap) events, **double click** (double Tap) events, and event **button/buttons/which** values.
1111
- Generate immediate clicks (no ~300ms delay)
@@ -48,14 +48,14 @@ _Manual_ master installation:
4848

4949
##Usage
5050
1. Require the module `dpointer/events`
51-
2. Set the attribute `data-touch-action` on elements you want to handle pointer events. Example: `<div data-touch-action="none"> </div>`
51+
2. Set the attribute `touch-action` on elements you want to handle pointer events. Example: `<div touch-action="none"> </div>`
5252
3. Start listening to Pointer Events:
5353
`pointerdown, pointerup, pointercancel, pointermove,`
5454
`pointerover, pointerout, pointerenter, pointerleave, gotpointercapture and lostpointercapture`.
5555

5656
###Setting the Touch Action attribute
5757
- Programmatic: use *dpointer/events* function `setTouchAction(targetElement, actionType)`
58-
- Declarative: add the attribute `data-touch-action='<actiontype>'`
58+
- Declarative: add the attribute `touch-action='<actiontype>'`
5959

6060
Where actionType is `none`to disable the user agent default behavior. `pan-x` and `pan-y` have the same effect as `none` (see Limitations)
6161

events.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ define([
6868
};
6969

7070
/**
71-
* Set the attribute data-touch-action on the target element.
71+
* Set the attribute touch-action on the target element.
7272
* Supported touch-actions are "auto" (user agent handles touch actions
7373
* default behaviors), "none" (disable user agent default behavior), pan-x and pan-y.
7474
*
@@ -132,7 +132,7 @@ define([
132132
};
133133

134134
/**
135-
* CSS rule to define touch-action or -ms-touch-action when data-touch-action attribute is set on Elements.
135+
* CSS rule to define touch-action or -ms-touch-action when touch-action attribute is set on Elements.
136136
*
137137
* @param styleName should be touch-action or -ms-touch-action
138138
*/

handlers/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ define([
2020
LOSTCAPTURE: "lostpointercapture"
2121
},
2222
TouchAction: { // touch action
23-
ATTR_NAME: "data-touch-action",
23+
ATTR_NAME: "touch-action",
2424
AUTO: 0, // 0000
2525
PAN_X: 1, // 0001
2626
PAN_Y: 2, // 0010
@@ -38,7 +38,7 @@ define([
3838

3939
/**
4040
* With touch events there is no CSS property touch-action: Touch action
41-
* is specified by the value of the HTML attribute data-touch-action.
41+
* is specified by the value of the HTML attribute touch-action.
4242
* This function returns the touch action which applies to the element, based on "touch action"
4343
* from its ancestors.
4444
* To be used only when underlying native events are touch events.

tests/capture/capture1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116

117117
</head>
118118
<body id="body">
119-
<div id="container" data-touch-action="none">Press inside a button, then move outside and over the other button.
119+
<div id="container" touch-action="none">Press inside a button, then move outside and over the other button.
120120
<div id="Btn" class="btn">NO CAPTURE</div>
121121
&#160;
122122
<div id="capturedBtn" class="btn">CAPTURE</div>

tests/paint/paint1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@
9090

9191
</head>
9292
<body>
93-
<canvas id="drawingArea" data-touch-action="none">Canvas not supported?</canvas>
93+
<canvas id="drawingArea" touch-action="none">Canvas not supported?</canvas>
9494
</body>
9595
</html>

tests/paint/paint2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,6 @@
110110

111111
</head>
112112
<body>
113-
<canvas id="drawingArea" data-touch-action="none">Canvas not supported?</canvas>
113+
<canvas id="drawingArea" touch-action="none">Canvas not supported?</canvas>
114114
</body>
115115
</html>

tests/tracker/tracker.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@
6161
var elementRef = document.getElementById(item[1]);
6262
checkboxRef.addEventListener("change", function(){
6363
if(checkboxRef.checked){
64-
tracker.log("set data-touch-action = none [" + item[1] + "]");
64+
tracker.log("set touch-action = none [" + item[1] + "]");
6565
pointer.setTouchAction(elementRef, "none");
6666
}else{
67-
tracker.log("set data-touch-action = auto [" + item[1] + "]");
67+
tracker.log("set touch-action = auto [" + item[1] + "]");
6868
pointer.setTouchAction(elementRef, "auto");
6969
}
7070
});

0 commit comments

Comments
 (0)