diff --git a/src/js/parser/javascript/base.js b/src/js/parser/javascript/base.js index c51fd8b..66c5b99 100644 --- a/src/js/parser/javascript/base.js +++ b/src/js/parser/javascript/base.js @@ -28,13 +28,11 @@ export default { render_bbox(container, box) { container.path(box.path) - .attr({ - 'class': 'bounding-box' - }); + .addClass('bounding-box'); }, render() { - this.container.attr({ 'class': 'placeholder' }); + this.container.addClass('placeholder'); this.label = this.render_label(this.container, this.textValue); diff --git a/src/js/parser/javascript/match.js b/src/js/parser/javascript/match.js index a43eb18..881b692 100644 --- a/src/js/parser/javascript/match.js +++ b/src/js/parser/javascript/match.js @@ -11,7 +11,7 @@ export default _.extend({}, Base, { if (this.anchor_start()) { this.contents.anchor_start = this.render_label(this.container, 'Start of line') - .attr({ 'class': 'anchor' }); + .addClass('anchor'); } this.contents.parts = _.map(this.parts(), function(part) { @@ -22,7 +22,7 @@ export default _.extend({}, Base, { if (this.anchor_end()) { this.contents.anchor_end = this.render_label(this.container, 'End of line') - .attr({ 'class': 'anchor' }); + .addClass('anchor'); } }, diff --git a/src/js/parser/javascript/root.js b/src/js/parser/javascript/root.js index 31c1fed..da71f49 100644 --- a/src/js/parser/javascript/root.js +++ b/src/js/parser/javascript/root.js @@ -9,14 +9,12 @@ export default _.extend({}, Base, { .translate(10, 0)); this.regexp.render(); - this.start = this.container.circle().attr({ - r: 5, - 'class': 'pin' - }); - this.end = this.container.circle().attr({ - r: 5, - 'class': 'pin' - }); + this.start = this.container.circle() + .addClass('pin') + .attr({ r: 5 }); + this.end = this.container.circle() + .addClass('pin') + .attr({ r: 5 }); }, position() { @@ -26,7 +24,7 @@ export default _.extend({}, Base, { contentBox = this.regexp.container.getBBox(); - this.regexp.container.before( + this.container.prepend( this.container.path(Snap.format('M0,{cy}h10M{x2},{cy}h10', contentBox)) );