diff options
Diffstat (limited to 'src/elements/Text.js')
-rw-r--r-- | src/elements/Text.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/elements/Text.js b/src/elements/Text.js index bd27428..b4ba0ad 100644 --- a/src/elements/Text.js +++ b/src/elements/Text.js @@ -1,4 +1,10 @@ -import { adopt, extend, nodeOrNew, register } from '../utils/adopter.js' +import { + adopt, + extend, + nodeOrNew, + register, + wrapWithAttrCheck +} from '../utils/adopter.js' import { attrs } from '../modules/core/defaults.js' import { registerMethods } from '../utils/methods.js' import SVGNumber from '../types/SVGNumber.js' @@ -166,14 +172,14 @@ extend(Text, textable) registerMethods({ Container: { // Create text element - text (text) { + text: wrapWithAttrCheck(function (text) { return this.put(new Text()).text(text) - }, + }), // Create plain text element - plain (text) { + plain: wrapWithAttrCheck(function (text) { return this.put(new Text()).plain(text) - } + }) } }) |