Socket
Socket
Sign inDemoInstall

metal-clipboard

Package Overview
Dependencies
4
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-rc to 1.0.0-rc.1

10

package.json
{
"name": "metal-clipboard",
"version": "1.0.0-rc",
"version": "1.0.0-rc.1",
"description": "Metal's component for copying content to the clipboard",

@@ -24,5 +24,5 @@ "license": "BSD",

"dependencies": {
"metal": "^1.0.0-rc",
"metal-attribute": "^1.0.0-rc",
"metal-dom": "^1.0.0-rc"
"metal": "^1.0.0-rc.1",
"metal-state": "^1.0.0-rc.1",
"metal-dom": "^1.0.0-rc.2"
},

@@ -32,4 +32,4 @@ "devDependencies": {

"gulp": "^3.8.11",
"gulp-metal": "^0.14.0"
"gulp-metal": "^1.0.0"
}
}
'use strict';
import Attribute from 'metal-attribute';
import core from 'metal';
import dom from 'metal-dom';
import State from 'metal-state';

@@ -10,3 +10,3 @@ /**

*/
class Clipboard extends Attribute {
class Clipboard extends State {
/**

@@ -53,7 +53,7 @@ * Delegates a click event to the passed selector.

/**
* Attributes definition.
* State definition.
* @type {!Object}
* @static
*/
Clipboard.ATTRS = {
Clipboard.STATE = {
/**

@@ -107,5 +107,5 @@ * A function that returns the name of the clipboard action that should be done

*/
class ClipboardAction extends Attribute {
class ClipboardAction extends State {
/**
* Initializes selection either from a `text` or `target` attribute.
* Initializes selection either from a `text` or `target` state.
*/

@@ -192,3 +192,3 @@ constructor(opt_config) {

/**
* Selects the content from element passed on `target` attribute.
* Selects the content from element passed on `target` state.
*/

@@ -212,3 +212,3 @@ selectTarget() {

/**
* Selects the content from value passed on `text` attribute.
* Selects the content from value passed on `text` state.
*/

@@ -234,7 +234,7 @@ selectValue() {

/**
* Attributes definition.
* State definition.
* @type {!Object}
* @static
*/
ClipboardAction.ATTRS = {
ClipboardAction.STATE = {
/**

@@ -241,0 +241,0 @@ * The action to be performed (either 'copy' or 'cut').

@@ -36,3 +36,3 @@ 'use strict';

it('should copy text from "text" attribute fn to clipboard', function() {
it('should copy text from "text" state fn to clipboard', function() {
dom.append(container, '<div data-clipboard data-text="From data-text"></div>');

@@ -42,3 +42,3 @@

text: function() {
return 'From text attribute fn';
return 'From text state fn';
}

@@ -48,3 +48,3 @@ });

assert.strictEqual('From text attribute fn', window.getSelection().toString());
assert.strictEqual('From text state fn', window.getSelection().toString());
assert.strictEqual(1, document.execCommand.callCount);

@@ -91,3 +91,3 @@ assert.strictEqual('copy', document.execCommand.args[0][0]);

it('should copy text to clipboard using the action specified by the action attribute', function() {
it('should copy text to clipboard using the action specified by the action state', function() {
dom.append(container, '<div data-clipboard data-text="From data-text" data-action="cut"></div>');

@@ -169,3 +169,3 @@

it('should copy text from the element given in the "target" attribute', function() {
it('should copy text from the element given in the "target" state', function() {
dom.append(container, '<div data-clipboard data-target="#target"></div>');

@@ -172,0 +172,0 @@ dom.append(container, '<div id="target">From div</div>');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc