Skip to content

Commit

Permalink
fix(validationRenderer): correctly assign boundaryElement, set label …
Browse files Browse the repository at this point in the history
…active to avoid strange layout errors
  • Loading branch information
Thanood committed Aug 15, 2016
1 parent 5a73161 commit b9f768d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/validation/validationRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { validationRenderer } from 'aurelia-validation';
@inject(Element)
export class MaterializeFormValidationRenderer {

constructor(boundaryElement) {}
constructor(boundaryElement) {
this.boundaryElement = boundaryElement;
}

render(error, target) {
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) {
Expand All @@ -27,6 +29,7 @@ export class MaterializeFormValidationRenderer {
let label:any = target.querySelector('label');
if (label) {
label.classList.remove('valid');
label.classList.add('active');
label.classList.add('invalid');

// get error message from label
Expand Down

0 comments on commit b9f768d

Please sign in to comment.