diff options
author | Morgan Harris <gormster@me.com> | 2021-11-24 11:35:39 +1100 |
---|---|---|
committer | Morgan Harris <gormster@me.com> | 2021-11-24 11:35:39 +1100 |
commit | e45843c71c73511ba0f499053184883ddc28f990 (patch) | |
tree | 93ad8d3ae854922b7f69eabac5f782cd63628c7f /src | |
parent | 480e5d77e2dcefd6bc4f95a053bb545d9916eb72 (diff) | |
download | svg.js-e45843c71c73511ba0f499053184883ddc28f990.tar.gz svg.js-e45843c71c73511ba0f499053184883ddc28f990.zip |
Allow access to original Array.prototype methods on List prefixed with $
Diffstat (limited to 'src')
-rw-r--r-- | src/types/List.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/types/List.js b/src/types/List.js index 197a155..97536ed 100644 --- a/src/types/List.js +++ b/src/types/List.js @@ -47,6 +47,11 @@ List.extend = function (methods) { // Don't add private methods if (name[0] === '_') return obj + // Allow access to original Array methods through a prefix + if (name in Array.prototype) { + obj['$' + name] = Array.prototype[name] + } + // Relay every call to each() obj[name] = function (...attrs) { return this.each(name, ...attrs) |