mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
changed "fakeElem" element type.
This commit is contained in:
120
dist/clipboard.js
vendored
120
dist/clipboard.js
vendored
@ -51,57 +51,57 @@ exports.unbind = function(el, type, fn, capture){
|
|||||||
};
|
};
|
||||||
|
|
||||||
},{"closest":2,"component-event":4}],2:[function(require,module,exports){
|
},{"closest":2,"component-event":4}],2:[function(require,module,exports){
|
||||||
var matches = require('matches-selector')
|
var matches = require('matches-selector')
|
||||||
|
|
||||||
module.exports = function (element, selector, checkYoSelf) {
|
module.exports = function (element, selector, checkYoSelf) {
|
||||||
var parent = checkYoSelf ? element : element.parentNode
|
var parent = checkYoSelf ? element : element.parentNode
|
||||||
|
|
||||||
while (parent && parent !== document) {
|
while (parent && parent !== document) {
|
||||||
if (matches(parent, selector)) return parent;
|
if (matches(parent, selector)) return parent;
|
||||||
parent = parent.parentNode
|
parent = parent.parentNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"matches-selector":3}],3:[function(require,module,exports){
|
},{"matches-selector":3}],3:[function(require,module,exports){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Element prototype.
|
* Element prototype.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var proto = Element.prototype;
|
var proto = Element.prototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vendor function.
|
* Vendor function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var vendor = proto.matchesSelector
|
var vendor = proto.matchesSelector
|
||||||
|| proto.webkitMatchesSelector
|
|| proto.webkitMatchesSelector
|
||||||
|| proto.mozMatchesSelector
|
|| proto.mozMatchesSelector
|
||||||
|| proto.msMatchesSelector
|
|| proto.msMatchesSelector
|
||||||
|| proto.oMatchesSelector;
|
|| proto.oMatchesSelector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expose `match()`.
|
* Expose `match()`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = match;
|
module.exports = match;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Match `el` to `selector`.
|
* Match `el` to `selector`.
|
||||||
*
|
*
|
||||||
* @param {Element} el
|
* @param {Element} el
|
||||||
* @param {String} selector
|
* @param {String} selector
|
||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
* @api public
|
* @api public
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function match(el, selector) {
|
function match(el, selector) {
|
||||||
if (vendor) return vendor.call(el, selector);
|
if (vendor) return vendor.call(el, selector);
|
||||||
var nodes = el.parentNode.querySelectorAll(selector);
|
var nodes = el.parentNode.querySelectorAll(selector);
|
||||||
for (var i = 0; i < nodes.length; ++i) {
|
for (var i = 0; i < nodes.length; ++i) {
|
||||||
if (nodes[i] == el) return true;
|
if (nodes[i] == el) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},{}],4:[function(require,module,exports){
|
},{}],4:[function(require,module,exports){
|
||||||
var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
|
var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
|
||||||
@ -148,12 +148,12 @@ function E () {
|
|||||||
E.prototype = {
|
E.prototype = {
|
||||||
on: function (name, callback, ctx) {
|
on: function (name, callback, ctx) {
|
||||||
var e = this.e || (this.e = {});
|
var e = this.e || (this.e = {});
|
||||||
|
|
||||||
(e[name] || (e[name] = [])).push({
|
(e[name] || (e[name] = [])).push({
|
||||||
fn: callback,
|
fn: callback,
|
||||||
ctx: ctx
|
ctx: ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ E.prototype = {
|
|||||||
self.off(name, fn);
|
self.off(name, fn);
|
||||||
callback.apply(ctx, arguments);
|
callback.apply(ctx, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.on(name, fn, ctx);
|
return this.on(name, fn, ctx);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -172,11 +172,11 @@ E.prototype = {
|
|||||||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var len = evtArr.length;
|
var len = evtArr.length;
|
||||||
|
|
||||||
for (i; i < len; i++) {
|
for (i; i < len; i++) {
|
||||||
evtArr[i].fn.apply(evtArr[i].ctx, data);
|
evtArr[i].fn.apply(evtArr[i].ctx, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -184,21 +184,21 @@ E.prototype = {
|
|||||||
var e = this.e || (this.e = {});
|
var e = this.e || (this.e = {});
|
||||||
var evts = e[name];
|
var evts = e[name];
|
||||||
var liveEvents = [];
|
var liveEvents = [];
|
||||||
|
|
||||||
if (evts && callback) {
|
if (evts && callback) {
|
||||||
for (var i = 0, len = evts.length; i < len; i++) {
|
for (var i = 0, len = evts.length; i < len; i++) {
|
||||||
if (evts[i].fn !== callback) liveEvents.push(evts[i]);
|
if (evts[i].fn !== callback) liveEvents.push(evts[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove event from queue to prevent memory leak
|
// Remove event from queue to prevent memory leak
|
||||||
// Suggested by https://github.com/lazd
|
// Suggested by https://github.com/lazd
|
||||||
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
||||||
|
|
||||||
(liveEvents.length)
|
(liveEvents.length)
|
||||||
? e[name] = liveEvents
|
? e[name] = liveEvents
|
||||||
: delete e[name];
|
: delete e[name];
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -278,7 +278,7 @@ var ClipboardAction = (function () {
|
|||||||
return _this.removeFake();
|
return _this.removeFake();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.fakeElem = document.createElement('input');
|
this.fakeElem = document.createElement('textarea');
|
||||||
this.fakeElem.style.position = 'absolute';
|
this.fakeElem.style.position = 'absolute';
|
||||||
this.fakeElem.style.left = '-9999px';
|
this.fakeElem.style.left = '-9999px';
|
||||||
this.fakeElem.setAttribute('readonly', '');
|
this.fakeElem.setAttribute('readonly', '');
|
||||||
@ -575,4 +575,4 @@ exports['default'] = Clipboard;
|
|||||||
module.exports = exports['default'];
|
module.exports = exports['default'];
|
||||||
|
|
||||||
},{"./clipboard-action":6,"delegate-events":1,"tiny-emitter":5}]},{},[7])(7)
|
},{"./clipboard-action":6,"delegate-events":1,"tiny-emitter":5}]},{},[7])(7)
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user