summaryrefslogtreecommitdiffstats
path: root/src/helpers.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-10-27 20:43:35 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-10-27 20:43:35 +0200
commit1c75fcaf02ceb144152d59557643c6fdd7264065 (patch)
tree5184af75f2fd27ca6b81c24a06b1676d17ca2c76 /src/helpers.js
parentb1b776a710d0ce0a6259043b8ce0665e205195fa (diff)
downloadsvg.js-1c75fcaf02ceb144152d59557643c6fdd7264065.tar.gz
svg.js-1c75fcaf02ceb144152d59557643c6fdd7264065.zip
resolve circular references and make example working again
Diffstat (limited to 'src/helpers.js')
-rw-r--r--src/helpers.js30
1 files changed, 4 insertions, 26 deletions
diff --git a/src/helpers.js b/src/helpers.js
index b4bddf9..289b59d 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -1,29 +1,7 @@
-import {Doc, Point, Element} from './classes.js'
-import {adopt, eid, makeNode} from './tools.js'
+import Point from './Point.js'
+import {eid, makeNode} from './tools.js'
import {dots, reference} from './regex.js'
-
-export function makeInstance (element, makeNested) {
- if (element instanceof Element) return element
-
- if (typeof element === 'object') {
- return adopt(element)
- }
-
- if (element == null) {
- return new Doc()
- }
-
- if (typeof element === 'string' && element.charAt(0) !== '<') {
- return adopt(document.querySelector(element))
- }
-
- var node = makeNode('svg')
- node.innerHTML = element
-
- element = adopt(node.firstElementChild)
-
- return element
-}
+import {adopt} from './adopter.js'
export function isNulledBox (box) {
return !box.w && !box.h && !box.x && !box.y
@@ -55,7 +33,7 @@ export function arrayClone (arr) {
}
// tests if a given selector matches an element
-export function matches (el, selector) {
+export function matcher (el, selector) {
return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector)
}