Release v1.5.10

This commit is contained in:
Zeno Rocha
2016-04-03 22:33:02 -07:00
parent 7a5a910bcd
commit 53a733fcb5
5 changed files with 15 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "clipboard", "name": "clipboard",
"version": "1.5.9", "version": "1.5.10",
"description": "Modern copy to clipboard. No Flash. Just 2kb", "description": "Modern copy to clipboard. No Flash. Just 2kb",
"license": "MIT", "license": "MIT",
"main": "dist/clipboard.js", "main": "dist/clipboard.js",

16
dist/clipboard.js vendored
View File

@@ -1,5 +1,5 @@
/*! /*!
* clipboard.js v1.5.9 * clipboard.js v1.5.10
* https://zenorocha.github.io/clipboard.js * https://zenorocha.github.io/clipboard.js
* *
* Licensed MIT © Zeno Rocha * Licensed MIT © Zeno Rocha
@@ -434,14 +434,10 @@ module.exports = E;
}; };
ClipboardAction.prototype.initSelection = function initSelection() { ClipboardAction.prototype.initSelection = function initSelection() {
if (this.text && this.target) { if (this.text) {
throw new Error('Multiple attributes declared, use either "target" or "text"');
} else if (this.text) {
this.selectFake(); this.selectFake();
} else if (this.target) { } else if (this.target) {
this.selectTarget(); this.selectTarget();
} else {
throw new Error('Missing required attributes, use either "target" or "text"');
} }
}; };
@@ -554,6 +550,14 @@ module.exports = E;
set: function set(target) { set: function set(target) {
if (target !== undefined) { if (target !== undefined) {
if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) { 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; this._target = target;
} else { } else {
throw new Error('Invalid "target" value, use a valid Element'); throw new Error('Invalid "target" value, use a valid Element');

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@
Package.describe({ Package.describe({
name: "zenorocha:clipboard", name: "zenorocha:clipboard",
summary: "Modern copy to clipboard. No Flash. Just 2kb.", summary: "Modern copy to clipboard. No Flash. Just 2kb.",
version: "1.5.9", version: "1.5.10",
git: "https://github.com/zenorocha/clipboard.js" git: "https://github.com/zenorocha/clipboard.js"
}); });

View File

@@ -1,6 +1,6 @@
{ {
"name": "clipboard", "name": "clipboard",
"version": "1.5.9", "version": "1.5.10",
"description": "Modern copy to clipboard. No Flash. Just 2kb", "description": "Modern copy to clipboard. No Flash. Just 2kb",
"repository": "zenorocha/clipboard.js", "repository": "zenorocha/clipboard.js",
"license": "MIT", "license": "MIT",