Skip to content

Commit

Permalink
Release v1.5.10
Browse files Browse the repository at this point in the history
  • Loading branch information
zenorocha committed Apr 4, 2016
1 parent 7a5a910 commit 53a733f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clipboard",
"version": "1.5.9",
"version": "1.5.10",
"description": "Modern copy to clipboard. No Flash. Just 2kb",
"license": "MIT",
"main": "dist/clipboard.js",
Expand Down
16 changes: 10 additions & 6 deletions dist/clipboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* clipboard.js v1.5.9
* clipboard.js v1.5.10
* https://zenorocha.github.io/clipboard.js
*
* Licensed MIT © Zeno Rocha
Expand Down Expand Up @@ -434,14 +434,10 @@ module.exports = E;
};

ClipboardAction.prototype.initSelection = function initSelection() {
if (this.text && this.target) {
throw new Error('Multiple attributes declared, use either "target" or "text"');
} else if (this.text) {
if (this.text) {
this.selectFake();
} else if (this.target) {
this.selectTarget();
} else {
throw new Error('Missing required attributes, use either "target" or "text"');
}
};

Expand Down Expand Up @@ -554,6 +550,14 @@ module.exports = E;
set: function set(target) {
if (target !== undefined) {
if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
if (this.action === 'copy' && target.hasAttribute('disabled')) {
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
}

if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
}

this._target = target;
} else {
throw new Error('Invalid "target" value, use a valid Element');
Expand Down
Loading

0 comments on commit 53a733f

Please sign in to comment.