aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-09-03 14:35:18 +0200
committerGitHub <noreply@github.com>2023-09-03 14:35:18 +0200
commit82778b7200a65d6f569da859353c103f8dd2ca2c (patch)
tree0668d4d6c82ff5e9098c0f23a1cd3d3e0e218716 /src
parent2a8b5ea3fb6b3a62ed53d367b6d16d1515422ab9 (diff)
parentbb8b54a3bbe415f1ca6c9fbe917604adb16b53ad (diff)
downloadsvg.js-82778b7200a65d6f569da859353c103f8dd2ca2c.tar.gz
svg.js-82778b7200a65d6f569da859353c103f8dd2ca2c.zip
Merge pull request #1238 from gormster/1237-list-expose-builtin-array-methods
Allow access to original Array.prototype methods on List prefixed with $
Diffstat (limited to 'src')
-rw-r--r--src/types/List.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/types/List.js b/src/types/List.js
index bdeb766..22b9027 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)