diff --git a/src/js/parser/javascript/base.js b/src/js/parser/javascript/base.js index 753287d..a415d8b 100644 --- a/src/js/parser/javascript/base.js +++ b/src/js/parser/javascript/base.js @@ -40,7 +40,11 @@ export default { }); }, - render() { + render(container) { + if (container) { + this.setContainer(container); + } + this._labelGroups = []; this._render(); }, @@ -56,8 +60,7 @@ export default { proxy(node) { this._proxy = node; - this._proxy.setContainer(this.container); - this._proxy.render(); + this._proxy.render(this.container); }, _render() { diff --git a/src/js/parser/javascript/charset.js b/src/js/parser/javascript/charset.js index 33540de..6e15f61 100644 --- a/src/js/parser/javascript/charset.js +++ b/src/js/parser/javascript/charset.js @@ -10,8 +10,7 @@ export default _.extend({}, Base, { this.partContainer = this.container.group(); _.each(this.parts.elements, (part => { - part.setContainer(this.partContainer.group()); - part.render(); + part.render(this.partContainer.group()); }).bind(this)); }, diff --git a/src/js/parser/javascript/charset_range.js b/src/js/parser/javascript/charset_range.js index 7c08ad6..d943338 100644 --- a/src/js/parser/javascript/charset_range.js +++ b/src/js/parser/javascript/charset_range.js @@ -5,11 +5,8 @@ export default _.extend({}, Base, { type: 'charset-range', _render() { - this.first.setContainer(this.container.group()); - this.first.render(); - - this.last.setContainer(this.container.group()); - this.last.render(); + this.first.render(this.container.group()); + this.last.render(this.container.group()); this.hyphen = this.container.text() .attr({ @@ -18,8 +15,6 @@ export default _.extend({}, Base, { }, _position() { - var box; - this.first.position(); this.last.position(); diff --git a/src/js/parser/javascript/match.js b/src/js/parser/javascript/match.js index 034afde..4ffce7c 100644 --- a/src/js/parser/javascript/match.js +++ b/src/js/parser/javascript/match.js @@ -16,8 +16,7 @@ export default _.extend({}, Base, { } this.contents.parts = _.map(parts, (function(part) { - part.setContainer(this.container.group()); - part.render(); + part.render(this.container.group()); return part; }).bind(this)); diff --git a/src/js/parser/javascript/match_fragment.js b/src/js/parser/javascript/match_fragment.js index 276c3c2..21c273d 100644 --- a/src/js/parser/javascript/match_fragment.js +++ b/src/js/parser/javascript/match_fragment.js @@ -8,8 +8,7 @@ export default _.extend({}, Base, { if (this._repeat.textValue === '') { this.proxy(this._content); } else { - this._content.setContainer(this.container.group()); - this._content.render(); + this._content.render(this.container.group()); } }, diff --git a/src/js/parser/javascript/regexp.js b/src/js/parser/javascript/regexp.js index 74bf207..4e22b81 100644 --- a/src/js/parser/javascript/regexp.js +++ b/src/js/parser/javascript/regexp.js @@ -14,9 +14,7 @@ export default _.extend({}, Base, { .addClass('regexp-matches'); _.each(matches, (match => { - match.setContainer(this.matchContainer.group()); - match.render(); - return match.container; + match.render(this.matchContainer.group()); }).bind(this)); } }, diff --git a/src/js/parser/javascript/root.js b/src/js/parser/javascript/root.js index 343aba1..43fd222 100644 --- a/src/js/parser/javascript/root.js +++ b/src/js/parser/javascript/root.js @@ -5,9 +5,9 @@ export default _.extend({}, Base, { type: 'root', _render() { - this.regexp.setContainer(this.container.group().transform(Snap.matrix() - .translate(10, 0))); - this.regexp.render(); + this.regexp.render(this.container.group()); + this.regexp.container.transform(Snap.matrix() + .translate(10, 0)); this.start = this.container.circle() .addClass('pin') diff --git a/src/js/parser/javascript/subexp.js b/src/js/parser/javascript/subexp.js index 2f8263d..209f4c6 100644 --- a/src/js/parser/javascript/subexp.js +++ b/src/js/parser/javascript/subexp.js @@ -18,8 +18,7 @@ export default _.extend({}, Base, { if (label) { this.renderLabeledBox(label); - this.regexp.setContainer(this.container.group()); - this.regexp.render(); + this.regexp.render(this.container.group()); } else { this.proxy(this.regexp); } diff --git a/src/js/regexper.js b/src/js/regexper.js index a780c51..73d3ad8 100644 --- a/src/js/regexper.js +++ b/src/js/regexper.js @@ -91,8 +91,7 @@ export default class Regexper { return Q.fcall(parser.parse.bind(parser), expression) .then((result) => { - result.setContainer(snap.group()); - result.render(); + result.render(snap.group()); return result; }, this.showError.bind(this)) .then((result) => {