diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-12 13:29:15 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-12 13:29:15 +0100 |
commit | b9f5c216c6eb75f3a00c6b121da5a72885286fa0 (patch) | |
tree | f7af03f1119dc0bb852a7ac98702d709ba87e403 /src | |
parent | 7f67bc4ffa044607925246d846f544c87d5e00fa (diff) | |
download | svg.js-b9f5c216c6eb75f3a00c6b121da5a72885286fa0.tar.gz svg.js-b9f5c216c6eb75f3a00c6b121da5a72885286fa0.zip |
ticking off the last checkbox of (#645). return List whenever possible
Diffstat (limited to 'src')
-rw-r--r-- | src/elements/Dom.js | 7 | ||||
-rw-r--r-- | src/modules/core/selector.js | 7 | ||||
-rw-r--r-- | src/types/List.js | 3 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/elements/Dom.js b/src/elements/Dom.js index 192b9bd..6d35f1e 100644 --- a/src/elements/Dom.js +++ b/src/elements/Dom.js @@ -6,10 +6,11 @@ import { makeInstance, register } from '../utils/adopter.js' +import { globals } from '../utils/window.js' import { map } from '../utils/utils.js' import { ns } from '../modules/core/namespaces.js' -import { globals } from '../utils/window.js' import EventTarget from '../types/EventTarget.js' +import List from '../types/List.js' import attr from '../modules/core/attr.js' export default class Dom extends EventTarget { @@ -43,9 +44,9 @@ export default class Dom extends EventTarget { // Returns all child elements children () { - return map(this.node.children, function (node) { + return new List(map(this.node.children, function (node) { return adopt(node) - }) + })) } // Remove all elements in this container diff --git a/src/modules/core/selector.js b/src/modules/core/selector.js index f2a7c58..83a919f 100644 --- a/src/modules/core/selector.js +++ b/src/modules/core/selector.js @@ -1,12 +1,13 @@ import { adopt } from '../../utils/adopter.js' +import { globals } from '../../utils/window.js' import { map } from '../../utils/utils.js' import { registerMethods } from '../../utils/methods.js' -import { globals } from '../../utils/window.js' +import List from '../../types/List.js' export default function baseFind (query, parent) { - return map((parent || globals.document).querySelectorAll(query), function (node) { + return new List(map((parent || globals.document).querySelectorAll(query), function (node) { return adopt(node) - }) + })) } // Scoped find method diff --git a/src/types/List.js b/src/types/List.js index b50a18e..8bd3985 100644 --- a/src/types/List.js +++ b/src/types/List.js @@ -16,9 +16,6 @@ extend(List, { this.forEach((el) => { fnOrMethodName.call(el, el) }) } else { return this.map(el => { return el[fnOrMethodName](...args) }) - // this.forEach((el) => { - // el[fnOrMethodName](...args) - // }) } return this |