aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorPete Bacon Darwin2013-04-22 13:38:18 +0100
committerPete Bacon Darwin2013-04-22 13:38:18 +0100
commitde296f1b52cdf4a50b2095cc4657adb49f75f333 (patch)
tree6f7222d185a46e0fe74cf69dc8bcf0a98f0e8a34 /docs
parent8c75b5f55aa80e03c455e1efcdba216f1e51bd05 (diff)
downloadangular.js-de296f1b52cdf4a50b2095cc4657adb49f75f333.tar.bz2
docs(compiler): don't drag selected content
In the example with draggable, the mouseDown handler needs to start with an event.preventDefault(). Otherwise the following bug occurs: 1) Select the text of the draggable span by clicking outside the span and dragging the mouse to the left or right through the span. Release the mouse button. 2) Now click on the span's inner text, and start to Drag it. The browser's default functionality that drags highlighted text so that it can be pasted into something else (say a document in a text editor) is invoked. 3) Release the mouse button. Now suddenly, you'll be dragging the span. But you won't be able to place it down on the page. It'll just follow the mouse around until the page is refreshed. Closes: #2465
Diffstat (limited to 'docs')
-rw-r--r--docs/content/guide/compiler.ngdoc2
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/content/guide/compiler.ngdoc b/docs/content/guide/compiler.ngdoc
index d315df45..ef0e08d1 100644
--- a/docs/content/guide/compiler.ngdoc
+++ b/docs/content/guide/compiler.ngdoc
@@ -79,6 +79,8 @@ Here is a directive which makes any element draggable. Notice the `draggable` at
cursor: 'pointer'
});
element.bind('mousedown', function(event) {
+ // Prevent default dragging of selected content
+ event.preventDefault();
startX = event.screenX - x;
startY = event.screenY - y;
$document.bind('mousemove', mousemove);